Skip to content

fix: Fix tokenization of unquoted types in macros #8529

fix: Fix tokenization of unquoted types in macros

fix: Fix tokenization of unquoted types in macros #8529

name: Javascript Tests
on:
pull_request:
merge_group:
push:
branches:
- master
# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-nargo:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Checkout Noir repo
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.74.1
- uses: Swatinem/rust-cache@v2
with:
key: x86_64-unknown-linux-gnu
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}
- 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
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nargo
path: ./dist/*
retention-days: 3
build-noirc-abi:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Noir repo
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.74.1
- uses: Swatinem/rust-cache@v2
with:
key: noirc-abi
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build noirc_abi
run: ./.github/scripts/noirc-abi-build.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: noirc_abi_wasm
path: |
./tooling/noirc_abi_wasm/nodejs
./tooling/noirc_abi_wasm/web
retention-days: 10
build-noir-wasm:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.74.1
- uses: Swatinem/rust-cache@v2
with:
key: noir-wasm
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build noir_js_types
run: yarn workspace @noir-lang/types build
- name: Build noir_wasm
run: ./.github/scripts/noir-wasm-build.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: noir_wasm
path: |
./compiler/wasm/dist
./compiler/wasm/build
retention-days: 3
build-acvm-js:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.74.1
- uses: Swatinem/rust-cache@v2
with:
key: acvm-js
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build acvm_js
run: ./.github/scripts/acvm_js-build.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: acvm-js
path: |
./acvm-repo/acvm_js/nodejs
./acvm-repo/acvm_js/web
retention-days: 3
test-acvm_js-node:
needs: [build-acvm-js]
name: ACVM JS (Node.js)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Set up test environment
uses: ./.github/actions/setup
- name: Run node tests
run: yarn workspace @noir-lang/acvm_js test
test-acvm_js-browser:
needs: [build-acvm-js]
name: ACVM JS (Browser)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Set up test environment
uses: ./.github/actions/setup
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Run browser tests
run: yarn workspace @noir-lang/acvm_js test:browser
test-noirc-abi:
needs: [build-noirc-abi]
name: noirc_abi
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download wasm package artifact
uses: actions/download-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Run node tests
run: yarn workspace @noir-lang/noirc_abi test
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Run browser tests
run: yarn workspace @noir-lang/noirc_abi test:browser
test-noir-js:
needs: [build-nargo, build-acvm-js, build-noirc-abi]
name: Noir JS
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download nargo binary
uses: actions/download-artifact@v4
with:
name: nargo
path: ./nargo
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download wasm package artifact
uses: actions/download-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- 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)"
nargo -V
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build noir_js_types
run: yarn workspace @noir-lang/types build
- name: Build barretenberg wrapper
run: yarn workspace @noir-lang/backend_barretenberg build
- name: Run noir_js tests
run: |
yarn workspace @noir-lang/noir_js build
yarn workspace @noir-lang/noir_js test
test-noir-wasm:
needs: [build-noir-wasm, build-nargo]
name: noir_wasm
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download wasm package artifact
uses: actions/download-artifact@v4
with:
name: noir_wasm
path: ./compiler/wasm
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Download nargo binary
uses: actions/download-artifact@v4
with:
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: Build fixtures
run: yarn workspace @noir-lang/noir_wasm test:build_fixtures
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Run node tests
run: yarn workspace @noir-lang/noir_wasm test:node
- name: Run browser tests
run: yarn workspace @noir-lang/noir_wasm test:browser
test-noir-codegen:
needs: [build-acvm-js, build-noirc-abi, build-nargo]
name: noir_codegen
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download nargo binary
uses: actions/download-artifact@v4
with:
name: nargo
path: ./nargo
- name: Download acvm_js package artifact
uses: actions/download-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download noirc_abi package artifact
uses: actions/download-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- 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)"
nargo -V
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build noir_js_types
run: yarn workspace @noir-lang/types build
- name: Build noir_js
run: yarn workspace @noir-lang/noir_js build
- name: Run noir_codegen tests
run: yarn workspace @noir-lang/noir_codegen test
test-integration-node:
name: Integration Tests (Node)
runs-on: ubuntu-latest
needs: [build-acvm-js, build-noir-wasm, build-nargo, build-noirc-abi]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install `bb`
run: |
./scripts/install_bb.sh
echo "$HOME/.bb/" >> $GITHUB_PATH
- name: Download nargo binary
uses: actions/download-artifact@v4
with:
name: nargo
path: ./nargo
- name: Download acvm_js package artifact
uses: actions/download-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download noir_wasm package artifact
uses: actions/download-artifact@v4
with:
name: noir_wasm
path: ./compiler/wasm
- name: Download noirc_abi package artifact
uses: actions/download-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- 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)"
nargo -V
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Setup `integration-tests`
run: |
# Note the lack of spaces between package names.
PACKAGES_TO_BUILD="@noir-lang/types,@noir-lang/backend_barretenberg,@noir-lang/noir_js"
yarn workspaces foreach -vtp --from "{$PACKAGES_TO_BUILD}" run build
- name: Run `integration-tests`
working-directory: ./compiler/integration-tests
run: |
yarn test:node
test-integration-browser:
name: Integration Tests (Browser)
runs-on: ubuntu-latest
needs: [build-acvm-js, build-noir-wasm, build-noirc-abi]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download acvm_js package artifact
uses: actions/download-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download noir_wasm package artifact
uses: actions/download-artifact@v4
with:
name: noir_wasm
path: ./compiler/wasm
- name: Download noirc_abi package artifact
uses: actions/download-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Setup `integration-tests`
run: |
# Note the lack of spaces between package names.
PACKAGES_TO_BUILD="@noir-lang/types,@noir-lang/backend_barretenberg,@noir-lang/noir_js"
yarn workspaces foreach -vtp --from "{$PACKAGES_TO_BUILD}" run build
- name: Run `integration-tests`
working-directory: ./compiler/integration-tests
run: |
yarn test:browser
test-examples:
name: Example scripts
runs-on: ubuntu-latest
needs: [build-nargo]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1.2.0
- name: Install `bb`
run: |
./scripts/install_bb.sh
echo "$HOME/.bb/" >> $GITHUB_PATH
- name: Download nargo binary
uses: actions/download-artifact@v4
with:
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)"
nargo -V
- name: Run `prove_and_verify`
working-directory: ./examples/prove_and_verify
run: ./test.sh
- name: Run `codegen_verifier`
working-directory: ./examples/codegen_verifier
run: ./test.sh
# This is a job which depends on all test jobs and reports the overall status.
# This allows us to add/remove test jobs without having to update the required workflows.
tests-end:
name: End
runs-on: ubuntu-latest
# We want this job to always run (even if the dependant jobs fail) as we want this job to fail rather than skipping.
if: ${{ always() }}
needs:
- test-acvm_js-node
- test-acvm_js-browser
- test-noirc-abi
- test-noir-js
- test-noir-wasm
- test-noir-codegen
- test-integration-node
- test-integration-browser
- test-examples
steps:
- name: Report overall success
run: |
if [[ $FAIL == true ]]; then
exit 1
else
exit 0
fi
env:
# We treat any skipped or failing jobs as a failure for the workflow as a whole.
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}