diff --git a/.github/workflows/auto-pr-rebuild-script.yml b/.github/workflows/auto-pr-rebuild-script.yml index 1f9434178df..928735027cb 100644 --- a/.github/workflows/auto-pr-rebuild-script.yml +++ b/.github/workflows/auto-pr-rebuild-script.yml @@ -43,22 +43,21 @@ jobs: - name: Checkout Noir repo uses: actions/checkout@v4 - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 + - name: Setup Nix + uses: ./.github/actions/nix with: - key: ${{ matrix.target }} - cache-on-failure: true - save-if: ${{ github.event_name != 'merge_group' }} + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build Nargo - run: cargo build --package nargo_cli --release + run: | + nix build -L . - name: Package artifacts run: | mkdir dist - cp ./target/release/nargo ./dist/nargo + cp ./result/bin/nargo ./dist/nargo 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz - name: Upload artifact diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index 41a68c65852..9c2b45e716a 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -17,29 +17,25 @@ jobs: - name: Checkout Noir repo uses: actions/checkout@v4 - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 + - name: Setup Nix + uses: ./.github/actions/nix with: - key: ${{ matrix.target }} - cache-on-failure: true - save-if: ${{ github.event_name != 'merge_group' }} + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build Nargo - run: cargo build --package nargo_cli --release - - - name: Package artifacts run: | - mkdir dist - cp ./target/release/nargo ./dist/nargo - 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz + nix build -L . + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/bin/nargo)" >> $GITHUB_ENV - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: nargo - path: ./dist/* + name: nargo-x86_64-unknown-linux-gnu + path: ${{ env.UPLOAD_PATH }} retention-days: 3 @@ -51,22 +47,27 @@ jobs: steps: - uses: actions/checkout@v3 - with: - submodules: recursive - name: Download nargo binary uses: actions/download-artifact@v3 with: - name: nargo - path: ./nargo + name: nargo-x86_64-unknown-linux-gnu + path: ./nargo_bin - name: Set nargo on PATH run: | - nargo_binary="${{ github.workspace }}/nargo/nargo" + ls -l . + + nargo_bin_dir="./nargo_bin" + nargo_binary="$nargo_bin_dir/nargo" chmod +x $nargo_binary - echo "$(dirname $nargo_binary)" >> $GITHUB_PATH - export PATH="$PATH:$(dirname $nargo_binary)" - nargo -V + ls -l $nargo_bin_dir + + echo "$nargo_bin_dir" >> $GITHUB_PATH + export PATH="$PATH:$nargo_bin_dir" + echo $(which nargo) + + nargo --version - name: Generate gates report working-directory: ./tooling/nargo_cli/tests diff --git a/.github/workflows/publish-es-packages.yml b/.github/workflows/publish-es-packages.yml index 14630434453..3511eb5c49e 100644 --- a/.github/workflows/publish-es-packages.yml +++ b/.github/workflows/publish-es-packages.yml @@ -28,7 +28,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} nix-cache-name: ${{ vars.NIX_CACHE_NAME }} - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Enable aztec features if: ${{ inputs.npm-tag == 'aztec' }} @@ -59,7 +59,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} nix-cache-name: ${{ vars.NIX_CACHE_NAME }} - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build wasm package run: | @@ -85,7 +85,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} nix-cache-name: ${{ vars.NIX_CACHE_NAME }} - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build wasm package run: | diff --git a/.github/workflows/test-abi_wasm.yml b/.github/workflows/test-abi_wasm.yml index 7fecb66fd7f..ffcc747c5f5 100644 --- a/.github/workflows/test-abi_wasm.yml +++ b/.github/workflows/test-abi_wasm.yml @@ -15,23 +15,17 @@ concurrency: jobs: build: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v3 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build noirc_abi_wasm run: | diff --git a/.github/workflows/test-acvm-js.yml b/.github/workflows/test-acvm-js.yml index c69f4995198..48a37d64b62 100644 --- a/.github/workflows/test-acvm-js.yml +++ b/.github/workflows/test-acvm-js.yml @@ -19,15 +19,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v20 + - name: Setup Nix + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-22.11 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build acvm-js run: | diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index ad0caf15f47..4078e2f7228 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -18,22 +18,21 @@ jobs: - name: Checkout Noir repo uses: actions/checkout@v4 - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 + - name: Setup Nix + uses: ./.github/actions/nix with: - key: ${{ matrix.target }} - cache-on-failure: true - save-if: ${{ github.event_name != 'merge_group' }} + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build Nargo - run: cargo build --package nargo_cli --release + run: | + nix build -L . - name: Package artifacts run: | mkdir dist - cp ./target/release/nargo ./dist/nargo + cp ./result/bin/nargo ./dist/nargo 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz - name: Upload artifact @@ -45,40 +44,22 @@ jobs: build-wasm: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v4 - name: Setup Nix - uses: cachix/install-nix-action@v22 - with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 + uses: ./.github/actions/nix with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build wasm package run: | nix build -L .#noir_wasm - - name: Export cache from nix store - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - run: | - nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noir-wasm-cargo-artifacts - - - uses: actions/cache/save@v3 - # Don't create cache entries for the merge queue. - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - with: - path: ${{ env.CACHED_PATH }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - name: Dereference symlink run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV @@ -91,40 +72,17 @@ jobs: build-noirc: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v3 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - name: Restore nix store cache - uses: actions/cache/restore@v3 - id: cache - with: - path: ${{ env.CACHED_PATH }} - key: ${{ runner.os }}-flake-abi-wasm-${{ hashFiles('*.lock') }} - - # Based on https://github.com/marigold-dev/deku/blob/b5016f0cf4bf6ac48db9111b70dd7fb49b969dfd/.github/workflows/build.yml#L26 - - name: Copy cache into nix store - if: steps.cache.outputs.cache-hit == 'true' - # We don't check the signature because we're the one that created the cache - run: | - for narinfo in ${{ env.CACHED_PATH }}/*.narinfo; do - path=$(head -n 1 "$narinfo" | awk '{print $2}') - nix copy --no-check-sigs --from "file://${{ env.CACHED_PATH }}" "$path" - done + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build noirc_abi_wasm run: | @@ -132,18 +90,6 @@ jobs: cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm - - name: Export cache from nix store - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - run: | - nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noirc-abi-wasm-cargo-artifacts - - - uses: actions/cache/save@v3 - # Don't create cache entries for the merge queue. - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - with: - path: ${{ env.CACHED_PATH }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - name: Dereference symlink run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV @@ -157,8 +103,6 @@ jobs: test-solidity-verifier: runs-on: ubuntu-latest needs: [build-wasm, build-nargo, build-noirc] - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout @@ -188,7 +132,6 @@ jobs: chmod +x $nargo_binary echo "$(dirname $nargo_binary)" >> $GITHUB_PATH export PATH="$PATH:$(dirname $nargo_binary)" - nargo -V - name: Install Yarn dependencies uses: ./.github/actions/setup diff --git a/.github/workflows/test-noir_wasm.yml b/.github/workflows/test-noir_wasm.yml index 900ca5872ff..43545ccc9a6 100644 --- a/.github/workflows/test-noir_wasm.yml +++ b/.github/workflows/test-noir_wasm.yml @@ -22,22 +22,21 @@ jobs: - name: Checkout Noir repo uses: actions/checkout@v4 - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 + - name: Setup Nix + uses: ./.github/actions/nix with: - key: ${{ matrix.target }} - cache-on-failure: true - save-if: ${{ github.event_name != 'merge_group' }} + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build Nargo - run: cargo build --package nargo_cli --release + run: | + nix build -L . - name: Package artifacts run: | mkdir dist - cp ./target/release/nargo ./dist/nargo + cp ./result/bin/nargo ./dist/nargo 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz - name: Upload artifact @@ -49,23 +48,17 @@ jobs: build-wasm: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v4 - name: Setup Nix - uses: cachix/install-nix-action@v22 - with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 + uses: ./.github/actions/nix with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: barretenberg + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build wasm package run: | @@ -101,14 +94,19 @@ jobs: name: nargo path: ./nargo + - name: Set nargo on PATH + run: | + nargo_binary="${{ github.workspace }}/nargo/nargo" + chmod +x $nargo_binary + echo "$(dirname $nargo_binary)" >> $GITHUB_PATH + export PATH="$PATH:$(dirname $nargo_binary)" + - name: Compile fixtures with Nargo CLI working-directory: ./compiler/wasm/fixtures run: | - nargo_binary=${{ github.workspace }}/nargo/nargo - chmod +x $nargo_binary for dir in $(ls -d */); do pushd $dir/noir-script - $nargo_binary compile + nargo compile popd done diff --git a/cspell.json b/cspell.json index 4df858ffcfa..9c5de0c8d40 100644 --- a/cspell.json +++ b/cspell.json @@ -15,6 +15,7 @@ "bitand", "blackbox", "brillig", + "cachix", "callsite", "callsites", "canonicalize",