From f6008e4a45585cbea54cdd33d55cc4b3bf4cfcc3 Mon Sep 17 00:00:00 2001 From: Koby Date: Thu, 10 Nov 2022 17:56:23 +0100 Subject: [PATCH] Adds binary build GitHub Action for x86_64-unknown-linux-gnu target --- .github/build-nix | 16 +++++ .../publish-x86_64-unknown-linux-gnu.yml | 64 +++++++++++++++++++ nix/mixed.nix | 38 +++++++++++ 3 files changed, 118 insertions(+) create mode 100644 .github/build-nix create mode 100644 .github/workflows/publish-x86_64-unknown-linux-gnu.yml create mode 100644 nix/mixed.nix diff --git a/.github/build-nix b/.github/build-nix new file mode 100644 index 00000000000..2fc8039d0de --- /dev/null +++ b/.github/build-nix @@ -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 \ No newline at end of file diff --git a/.github/workflows/publish-x86_64-unknown-linux-gnu.yml b/.github/workflows/publish-x86_64-unknown-linux-gnu.yml new file mode 100644 index 00000000000..1940e5c18f5 --- /dev/null +++ b/.github/workflows/publish-x86_64-unknown-linux-gnu.yml @@ -0,0 +1,64 @@ +name: build-x86_64-unknown-linux-gnu +# --- + +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 }} diff --git a/nix/mixed.nix b/nix/mixed.nix new file mode 100644 index 00000000000..b797616505d --- /dev/null +++ b/nix/mixed.nix @@ -0,0 +1,38 @@ +{ pkgs ? import {} }: + +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 ⌛ + ''; + +}