-
Notifications
You must be signed in to change notification settings - Fork 400
chore: Add noir_wasm testing workflow
#1921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3e9e46c
Edit workflow
jonybur 1e906d4
Output built directory
jonybur 39a8434
Fix noir_wasm copy
jonybur 1d3d30e
Fix workflow
jonybur b71f94c
Add mkdir to workflow
jonybur e362da8
Merge branch 'master' of github.com:noir-lang/noir into jb/noir-testi…
jonybur 7473ce7
Remove logs
jonybur 5029bad
Merge branch 'master' into jb/noir-testing-workflow
TomAFrench 4e0a050
chore: Ensure that CLI and wasm compilers are sync in `noir_wasm_test…
TomAFrench 6c320e1
Update .github/workflows/wasm.yml
TomAFrench 0d2d438
Merge branch 'master' into jb/noir-testing-workflow
TomAFrench e33058f
chore: run browser tests rather than nodejs tests
TomAFrench 99ba717
chore: fix test command in CI
TomAFrench 778b095
chore: bring noir-wasm-testing repo contents into wasm crate
TomAFrench 8a545c6
chore: update compile command to handle not being at repo root
TomAFrench c31e681
chore: remove unnecessary checkout
TomAFrench f283748
chore: update location to look for nargo binary
TomAFrench bea37a1
chore: add missing $
TomAFrench 978551d
chore: remove self-referential dependency
TomAFrench 9552903
chore: switch to `noir-lang/noir-source-resolver` version which exists
TomAFrench d693242
chore: place downloaded wasm artifact in `crates/wasm` so it can reso…
TomAFrench f4a94a9
Revisions
jonybur cdc4ab1
Merge branch 'jb/noir-testing-workflow' of github.com:noir-lang/noir …
jonybur 7eb2668
chore: fix CI workflow
TomAFrench 1dd0d58
chore: remove usage of `matrix.target`
TomAFrench ed04d05
chore: fix path to binary
TomAFrench fc4571d
chore: remove unwanted printing when compiling noir program
TomAFrench 62b5947
chore: update `Nargo.toml` to be compliant with new format
TomAFrench 98ed3fd
chore: remove unnecessary checkout
TomAFrench b6eac52
chore: add todo to workflow
TomAFrench 1b7eca9
Merge branch 'master' into jb/noir-testing-workflow
TomAFrench 8d1758f
Update .github/workflows/wasm.yml
TomAFrench 5bba829
Update crates/wasm/noir-script/src/main.nr
TomAFrench 6ae95f4
Update crates/wasm/test/browser/index.test.ts
TomAFrench File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [build] | ||
| # pre-build = [ | ||
| # "dpkg --add-architecture $CROSS_DEB_ARCH", | ||
| # "apt-get update && apt-get install --assume-yes xz-utils pkgconfig build-essential cmake openssl libssl-dev libomp-dev libssl-dev:$CROSS_DEB_ARCH libomp-dev:$CROSS_DEB_ARCH", | ||
| # ] | ||
|
|
||
| [build.env] | ||
| passthrough = [ | ||
| "HOME", | ||
| "RUST_BACKTRACE", | ||
| "BARRETENBERG_BIN_DIR" | ||
| ] | ||
| volumes = [ | ||
| "HOME", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,193 @@ | ||
| name: Wasm | ||
|
|
||
| on: | ||
| pull_request: | ||
| merge_group: | ||
| push: | ||
| branches: | ||
| - jb/noir-testing-workflow | ||
| - tom/noir-wasm-testing | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build Wasm | ||
| build-barretenberg: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Noir repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Checkout Build Nargo repo | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: noir-lang/build-nargo | ||
| path: build-nargo | ||
| ref: ${{ inputs.build-nargo-ref || 'master' }} | ||
|
|
||
| - name: Collect locked barretenberg rev | ||
| run: | | ||
| echo "BB_REV=$(jq -r .nodes.barretenberg.locked.rev ./flake.lock)" >> $GITHUB_ENV | ||
| echo "BB_REV is ${{ env.BB_REV }}" | ||
|
|
||
| - uses: cachix/install-nix-action@v20 | ||
| 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 }}" | ||
|
|
||
| # Upload does not work with symlinks, using this workaround: | ||
| # https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032 | ||
| - name: Build barretenberg as libbarretenberg-wasm32 | ||
| run: | | ||
| echo "BB_REV is ${{ env.BB_REV }}" | ||
| nix build "github:AztecProtocol/barretenberg/${{ env.BB_REV }}#wasm32" | ||
| echo "ARTIFACT_UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: libbarretenberg-wasm32 | ||
| path: ${{ env.ARTIFACT_UPLOAD_PATH }} | ||
| retention-days: 3 | ||
|
|
||
| build-nargo: | ||
| needs: [build-barretenberg] | ||
| runs-on: ubuntu-22.04 | ||
| env: | ||
| CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| target: [x86_64-unknown-linux-gnu] | ||
|
TomAFrench marked this conversation as resolved.
Outdated
|
||
|
|
||
| steps: | ||
| - name: Checkout Noir repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Checkout Build Nargo repo | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: noir-lang/build-nargo | ||
| path: build-nargo | ||
| ref: ${{ inputs.build-nargo-ref || 'master' }} | ||
|
|
||
| - 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') }} | ||
|
|
||
| - name: Download artifact | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: libbarretenberg-wasm32 | ||
| path: ${{ github.workspace }}/libbarretenberg-wasm32 | ||
|
|
||
| - name: Setup toolchain | ||
| uses: dtolnay/rust-toolchain@1.66.0 | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
|
|
||
| - name: Build Nargo | ||
| env: | ||
| BARRETENBERG_BIN_DIR: ${{ github.workspace }}/libbarretenberg-wasm32/bin | ||
| run: | | ||
| cargo install cross --force --git https://github.com/cross-rs/cross | ||
| cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features plonk_bn254_wasm | ||
|
TomAFrench marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Package artifacts | ||
| run: | | ||
| mkdir dist | ||
| cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo | ||
| 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: nargo | ||
| path: ./dist/* | ||
| retention-days: 3 | ||
|
|
||
| build-wasm: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Nix | ||
| uses: cachix/install-nix-action@v22 | ||
| - uses: cachix/install-nix-action@v20 | ||
|
TomAFrench marked this conversation as resolved.
Outdated
|
||
| with: | ||
| nix_path: nixpkgs=channel:nixos-22.11 | ||
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build wasm package | ||
| run: | | ||
| nix build -L .#wasm | ||
|
|
||
| - 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 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout noir-wasm-testing | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: noir-lang/noir-wasm-testing | ||
|
|
||
| - name: Download wasm package artifact | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: noir_wasm | ||
| path: ./@noir-lang_noir_wasm | ||
|
|
||
| - name: Inject built wasm into noir-wasm-testing | ||
| run: | | ||
| jq '.dependencies["@noir-lang/noir_wasm"] = "file:./@noir-lang_noir_wasm"' ./package.json > ./package.json.tmp | ||
| mv ./package.json.tmp ./package.json | ||
|
|
||
| - name: Download nargo binary | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: nargo | ||
| path: ./nargo | ||
|
|
||
| - name: Install dependencies and Run noir-wasm-testing program | ||
| run: | | ||
| nargo_binary=$(find $(pwd) -name "nargo" -type f) | ||
| echo "nargo binary found at $nargo_binary." | ||
| ls -l $nargo_binary | ||
| echo "Attempting to make nargo binary executable:" | ||
| chmod +x $nargo_binary || echo "chmod failed with exit code $?" | ||
| echo "File permissions after chmod:" | ||
| ls -l $nargo_binary | ||
| echo "Library dependencies of nargo binary:" | ||
| ldd $nargo_binary | ||
| if [ -x "$nargo_binary" ]; then | ||
| $nargo_binary -p "${{ github.workspace }}/src/noir-script" compile noir-wasm-testing | ||
|
TomAFrench marked this conversation as resolved.
Outdated
|
||
| else | ||
| echo "nargo binary NOT found or is not executable." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.