Skip to content

feat: compile circuits and query circuit sizes in parallel for nargo info #8037

feat: compile circuits and query circuit sizes in parallel for nargo info

feat: compile circuits and query circuit sizes in parallel for nargo info #8037

Workflow file for this run

name: Wasm
on:
pull_request:
merge_group:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-nargo:
runs-on: ubuntu-22.04
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]
steps:
- name: Checkout Noir repo
uses: actions/checkout@v4
- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup toolchain
uses: dtolnay/[email protected]
- name: Build Nargo
run: cargo build --package nargo_cli --release
- 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_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- 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
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nargo
path: ./dist/*
retention-days: 3
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-22.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Restore nix store cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATH }}
key: ${{ runner.os }}-flake-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
- name: Build wasm package
run: |
nix build -L .#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&parallel-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)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: noir_wasm
path: ${{ env.UPLOAD_PATH }}
retention-days: 3
test:
needs: [build-wasm, build-nargo]
name: Test noir_wasm
runs-on: ubuntu-latest
steps:
- name: Checkout noir-lang/noir
uses: actions/checkout@v4
- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noir_wasm
path: ./compiler/wasm/result
- name: Download nargo binary
uses: actions/download-artifact@v3
with:
name: nargo
path: ./nargo
- name: Compile test program with Nargo CLI
working-directory: ./compiler/wasm/noir-script
run: |
nargo_binary=${{ github.workspace }}/nargo/nargo
chmod +x $nargo_binary
$nargo_binary compile
- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./compiler/wasm
- name: Install dependencies
working-directory: ./compiler/wasm
run: yarn install
- name: Install playwright deps
working-directory: ./compiler/wasm
run: |
npx playwright install
npx playwright install-deps
- name: Run tests
working-directory: ./compiler/wasm
run: |
yarn test:browser
yarn test:node