Skip to content

Commit

Permalink
Adds binary build GitHub Action for x86_64-unknown-linux-gnu target (#…
Browse files Browse the repository at this point in the history
…460)

Co-authored-by: Koby <koby@aztecprotocol.com>
  • Loading branch information
kobyhallx and Koby authored Nov 11, 2022
1 parent 8dcc8db commit 0070622
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/build-nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env nix-shell
#!nix-shell ../nix/mixed.nix -i bash

echo ✨ System Details
uname -a

echo ✨ PWD=$PWD

echo ✨ CC=$CC
echo ✨ CXX=$CXX

echo ✨ rustup target add $1
rustup target add $1

echo 👷 Cargo Build
cargo build --release --locked --target $1
64 changes: 64 additions & 0 deletions .github/workflows/publish-x86_64-unknown-linux-gnu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: build-x86_64-unknown-linux-gnu
# <arch>-<vendor>-<os>-<env>

on:
workflow_dispatch:
push:
tags:
- "v*"

jobs:
build-x86_64-unknown-linux-gnu:
runs-on: ubuntu-22.04
strategy:
max-parallel: 1
matrix:
target: [x86_64-unknown-linux-gnu]

steps:
- name: Checkout
uses: actions/checkout@v1

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-22.05

- uses: cachix/cachix-action@v11
with:
name: nargo-cache
# If you chose signing key for write access
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
# If you chose API tokens for write access OR if you have a private cache
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Build environment and Compile
run: |
chmod +x .github/build-nix
.github/build-nix ${{ matrix.target }}
- name: Package artifacts
run: |
mkdir dist
cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo
mkdir -p ./dist/noir-lang/std
cp crates/std_lib/src/*.nr ./dist/noir-lang/std
7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.gz
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./nargo-${{ matrix.target }}.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions nix/mixed.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
nativeBuildInputs = with pkgs; [
which
git
pkg-config
cmake
];

buildInputs = with pkgs; [
llvmPackages.openmp
openssl
rustup
];

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.llvmPackages.openmp
pkgs.openssl
];

shellHook = ''
echo 🧪 NIX_CFLAGS_COMPILE=$NIX_CFLAGS_COMPILE
echo 🧪 NIX_LDFLAGS=$NIX_LDFLAGS
echo 🧪 LD_LIBRARY_PATH=$LD_LIBRARY_PATH
echo 🧪 CPATH=$CPATH
echo 🧪 $CC $AR $CXX $LD
echo 🧪 $(which $CC)
echo 🧪 $(which $AR)
echo 🧪 $(which $CXX)
echo 🧪 $(which $LD)
echo 🧪 $(which pkg-config)
echo 🧪 pkg-config --list-all ↩️
pkg-config --list-all
echo ⌛
'';

}

0 comments on commit 0070622

Please sign in to comment.