From 695eb7cf376374306f1dee4a376badf7b6b0ec42 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 13:17:22 +0000 Subject: [PATCH 01/15] chore(ci): deduplicate javascript testing workflows --- .github/workflows/test-abi_wasm.yml | 71 ---------- .github/workflows/test-acvm-js.yml | 99 ------------- .github/workflows/test-js-packages.yml | 183 +++++++++++++++++++++++++ .github/workflows/test-noir-js.yml | 61 --------- 4 files changed, 183 insertions(+), 231 deletions(-) delete mode 100644 .github/workflows/test-abi_wasm.yml delete mode 100644 .github/workflows/test-acvm-js.yml create mode 100644 .github/workflows/test-js-packages.yml delete mode 100644 .github/workflows/test-noir-js.yml diff --git a/.github/workflows/test-abi_wasm.yml b/.github/workflows/test-abi_wasm.yml deleted file mode 100644 index 52223d874bf..00000000000 --- a/.github/workflows/test-abi_wasm.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: ABI Wasm test - -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: - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Setup Nix - uses: ./.github/actions/nix - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - - - name: Build noirc_abi_wasm - run: | - nix build -L .#noirc_abi_wasm - cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm - cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm - - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: noirc_abi_wasm - path: ${{ env.UPLOAD_PATH }} - retention-days: 10 - - test: - runs-on: ubuntu-latest - needs: [build] - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Download wasm package artifact - uses: actions/download-artifact@v3 - 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 - diff --git a/.github/workflows/test-acvm-js.yml b/.github/workflows/test-acvm-js.yml deleted file mode 100644 index 14ce5d916c0..00000000000 --- a/.github/workflows/test-acvm-js.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Test acvm_js - -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-acvm-js-package: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup Nix - uses: ./.github/actions/nix - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - - - name: Build acvm-js - run: | - nix build -L .#acvm_js - - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: acvm-js - path: ${{ env.UPLOAD_PATH }} - retention-days: 3 - - test-acvm_js-node: - needs: [build-acvm-js-package] - name: Node.js Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: acvm-js - path: ./result - - - name: Move build artifacts - run: | - mv ./result/acvm_js/nodejs ./acvm-repo/acvm_js/nodejs - mv ./result/acvm_js/web ./acvm-repo/acvm_js/web - - - 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-package] - name: Browser Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: acvm-js - path: ./result - - - name: Move build artifacts - run: | - mv ./result/acvm_js/nodejs ./acvm-repo/acvm_js/nodejs - mv ./result/acvm_js/web ./acvm-repo/acvm_js/web - - - name: Set up test environment - uses: ./.github/actions/setup - - - name: Install playwright deps - run: | - npx playwright install - npx playwright install-deps - - - name: Run browser tests - working-directory: ./acvm-repo/acvm_js - run: yarn workspace @noir-lang/acvm_js test:browser diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml new file mode 100644 index 00000000000..e57f45a81ed --- /dev/null +++ b/.github/workflows/test-js-packages.yml @@ -0,0 +1,183 @@ +name: Test Javascript + +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-acvm-js: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build acvm-js + run: | + nix build -L .#acvm_js + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: acvm-js + path: ${{ env.UPLOAD_PATH }} + retention-days: 3 + + build-noirc-abi: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build noirc_abi_wasm + run: | + nix build -L .#noirc_abi_wasm + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: noirc_abi_wasm + path: ${{ env.UPLOAD_PATH }} + retention-days: 10 + + test-acvm_js-node: + needs: [build-acvm-js] + name: Node.js Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./result + + - name: Move build artifacts + run: | + mv ./result/acvm_js/nodejs ./acvm-repo/acvm_js/nodejs + mv ./result/acvm_js/web ./acvm-repo/acvm_js/web + + - 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 Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./acvm_repo/acvm_js + + - name: Set up test environment + uses: ./.github/actions/setup + + - name: Install playwright deps + run: | + npx playwright install + npx playwright install-deps + + - name: Run browser tests + run: yarn workspace @noir-lang/acvm_js test:browser + + test-noirc-abi: + needs: [build-noirc-abi] + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Download wasm package artifact + uses: actions/download-artifact@v3 + 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-acvm-js, build-noirc-abi] + name: Test Noir JS + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./acvm_repo/acvm_js + + - name: Download wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: ./tooling/noirc_abi_wasm + + - 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 diff --git a/.github/workflows/test-noir-js.yml b/.github/workflows/test-noir-js.yml deleted file mode 100644 index e74f2ee6015..00000000000 --- a/.github/workflows/test-noir-js.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Test Noir Js - -on: - pull_request: - merge_group: - push: - branches: - - master - -jobs: - test-noir-js: - name: Test Noir JS - runs-on: ubuntu-latest - timeout-minutes: 30 - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Yarn dependencies - uses: ./.github/actions/setup - - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - with: - targets: wasm32-unknown-unknown - - - uses: Swatinem/rust-cache@v2 - with: - key: wasm32-unknown-unknown-noir-js - cache-on-failure: true - save-if: ${{ github.event_name != 'merge_group' }} - - - name: Install jq - run: sudo apt-get install jq - - - name: Install wasm-bindgen-cli - uses: taiki-e/install-action@v2 - with: - tool: wasm-bindgen-cli@0.2.86 - - - name: Install wasm-opt - run: | - npm i wasm-opt -g - - - name: Build acvm_js - run: yarn workspace @noir-lang/acvm_js build - - - name: Build noirc_abi - run: yarn workspace @noir-lang/noirc_abi build - - - 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 From 37cd167aecf4f6396319df85e71d80e8aaef2f82 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 13:21:08 +0000 Subject: [PATCH 02/15] chore: update naming --- .github/workflows/test-js-packages.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index e57f45a81ed..cea05b9b1fc 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -70,7 +70,7 @@ jobs: test-acvm_js-node: needs: [build-acvm-js] - name: Node.js Tests + name: Test ACVM JS (Node.js) runs-on: ubuntu-latest steps: @@ -96,7 +96,7 @@ jobs: test-acvm_js-browser: needs: [build-acvm-js] - name: ACVM_JS Browser Tests + name: Test ACVM JS (Browser) runs-on: ubuntu-latest steps: @@ -122,6 +122,7 @@ jobs: test-noirc-abi: needs: [build-noirc-abi] + name: Test noirc_abi runs-on: ubuntu-latest steps: From c6ea77bdd062e387c4e1655bc107cea31d92e7b8 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 13:24:15 +0000 Subject: [PATCH 03/15] chore: fix artifact handling --- .github/workflows/test-js-packages.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index cea05b9b1fc..1f2926d4f48 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -31,7 +31,7 @@ jobs: nix build -L .#acvm_js - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV + run: echo "UPLOAD_PATH=$(readlink -f result/acvm_js)" >> $GITHUB_ENV - name: Upload artifact uses: actions/upload-artifact@v3 @@ -81,12 +81,7 @@ jobs: uses: actions/download-artifact@v3 with: name: acvm-js - path: ./result - - - name: Move build artifacts - run: | - mv ./result/acvm_js/nodejs ./acvm-repo/acvm_js/nodejs - mv ./result/acvm_js/web ./acvm-repo/acvm_js/web + path: ./acvm_repo/acvm_js - name: Set up test environment uses: ./.github/actions/setup From debbbe82a18749d30cf90a418d9c44f8ce0666c1 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 13:43:45 +0000 Subject: [PATCH 04/15] chore: fix path --- .github/workflows/test-js-packages.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 1f2926d4f48..e90272bc00d 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -81,7 +81,7 @@ jobs: uses: actions/download-artifact@v3 with: name: acvm-js - path: ./acvm_repo/acvm_js + path: ./acvm-repo/acvm_js - name: Set up test environment uses: ./.github/actions/setup @@ -102,7 +102,7 @@ jobs: uses: actions/download-artifact@v3 with: name: acvm-js - path: ./acvm_repo/acvm_js + path: ./acvm-repo/acvm_js - name: Set up test environment uses: ./.github/actions/setup @@ -156,7 +156,7 @@ jobs: uses: actions/download-artifact@v3 with: name: acvm-js - path: ./acvm_repo/acvm_js + path: ./acvm-repo/acvm_js - name: Download wasm package artifact uses: actions/download-artifact@v3 From 12eb9d98af2208612756352fcea76fc122aab245 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 13:45:07 +0000 Subject: [PATCH 05/15] chore: renaming --- .github/workflows/test-js-packages.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index e90272bc00d..4e79a46b86f 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -1,4 +1,4 @@ -name: Test Javascript +name: Javascript Tests on: pull_request: @@ -70,7 +70,7 @@ jobs: test-acvm_js-node: needs: [build-acvm-js] - name: Test ACVM JS (Node.js) + name: ACVM JS (Node.js) runs-on: ubuntu-latest steps: @@ -91,7 +91,7 @@ jobs: test-acvm_js-browser: needs: [build-acvm-js] - name: Test ACVM JS (Browser) + name: ACVM JS (Browser) runs-on: ubuntu-latest steps: @@ -117,7 +117,7 @@ jobs: test-noirc-abi: needs: [build-noirc-abi] - name: Test noirc_abi + name: noirc_abi runs-on: ubuntu-latest steps: @@ -144,7 +144,7 @@ jobs: test-noir-js: needs: [build-acvm-js, build-noirc-abi] - name: Test Noir JS + name: Noir JS runs-on: ubuntu-latest timeout-minutes: 30 From cd3c759a2efb5aa5c3f5ab2115f032349892f555 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 13:55:05 +0000 Subject: [PATCH 06/15] chore: bundle in noir wasm tests --- .github/workflows/test-js-packages.yml | 110 ++++++++++++++++++++++ .github/workflows/test-noir_wasm.yml | 125 ------------------------- 2 files changed, 110 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/test-noir_wasm.yml diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 4e79a46b86f..72bc5bfb627 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -13,6 +13,67 @@ concurrency: cancel-in-progress: true jobs: + build-nargo: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout Noir repo + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.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@v3 + with: + name: nargo + path: ./dist/* + retention-days: 3 + + build-noir-wasm: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build wasm package + run: | + nix build -L .#noir_wasm + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: noir_wasm + path: ${{ env.UPLOAD_PATH }} + retention-days: 3 + + build-acvm-js: runs-on: ubuntu-latest steps: @@ -177,3 +238,52 @@ jobs: 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 + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noir_wasm + path: ./compiler/wasm/downloaded + + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - 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 + popd + done + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Install Playwright + uses: ./.github/actions/install-playwright + + - name: Install dependencies + run: | + cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm + cp -r ./compiler/wasm/downloaded/web ./compiler/wasm + yarn workspace @noir-lang/source-resolver build + + - 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 diff --git a/.github/workflows/test-noir_wasm.yml b/.github/workflows/test-noir_wasm.yml deleted file mode 100644 index 2175e20acd7..00000000000 --- a/.github/workflows/test-noir_wasm.yml +++ /dev/null @@ -1,125 +0,0 @@ -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 - strategy: - matrix: - target: [x86_64-unknown-linux-gnu] - - steps: - - name: Checkout Noir repo - uses: actions/checkout@v4 - - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.target }} - 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@v3 - with: - name: nargo - path: ./dist/* - retention-days: 3 - - build-wasm: - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup Nix - uses: ./.github/actions/nix - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - - - name: Build wasm package - run: | - nix build -L .#noir_wasm - - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $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/downloaded - - - name: Download nargo binary - uses: actions/download-artifact@v3 - with: - name: nargo - path: ./nargo - - - 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 - popd - done - - - name: Install Yarn dependencies - uses: ./.github/actions/setup - - - name: Install Playwright - uses: ./.github/actions/install-playwright - - - name: Install dependencies - run: | - cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm - cp -r ./compiler/wasm/downloaded/web ./compiler/wasm - yarn workspace @noir-lang/source-resolver build - - - 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 From 09846af612b79b08506c2a6fbd529573d864e082 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 14:07:41 +0000 Subject: [PATCH 07/15] chore: merge in integration tests --- .github/workflows/test-integration.yml | 199 ------------------------- .github/workflows/test-js-packages.yml | 58 +++++++ 2 files changed, 58 insertions(+), 199 deletions(-) delete mode 100644 .github/workflows/test-integration.yml diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml deleted file mode 100644 index ad28d9c8e86..00000000000 --- a/.github/workflows/test-integration.yml +++ /dev/null @@ -1,199 +0,0 @@ -name: test-integration - -on: - workflow_dispatch: - pull_request: - merge_group: - schedule: - - cron: "0 2 * * *" # Run nightly at 2 AM UTC - -jobs: - build-nargo: - runs-on: ubuntu-latest - strategy: - matrix: - target: [x86_64-unknown-linux-gnu] - - steps: - - name: Checkout Noir repo - uses: actions/checkout@v4 - - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.target }} - 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@v3 - with: - name: nargo - path: ./dist/* - retention-days: 3 - - build-acvm-js: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup Nix - uses: ./.github/actions/nix - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - - - name: Build acvm-js - run: | - nix build -L .#acvm_js - - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f result/acvm_js)" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: acvm-js - path: ${{ env.UPLOAD_PATH }} - retention-days: 3 - - build-wasm: - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup Nix - uses: ./.github/actions/nix - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - - - name: Build wasm package - run: | - nix build -L .#noir_wasm - - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: noir_wasm - path: ${{ env.UPLOAD_PATH }} - retention-days: 3 - - build-noirc: - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Setup Nix - uses: ./.github/actions/nix - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - - - name: Build noirc_abi_wasm - run: | - nix build -L .#noirc_abi_wasm - cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm - cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm - - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: noirc_abi_wasm - path: ${{ env.UPLOAD_PATH }} - retention-days: 10 - - test-solidity-verifier: - runs-on: ubuntu-latest - needs: [build-acvm-js, build-wasm, build-nargo, build-noirc] - env: - CACHED_PATH: /tmp/nix-cache - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Download nargo binary - uses: actions/download-artifact@v3 - with: - name: nargo - path: ./nargo - - - name: Download acvm_js package artifact - uses: actions/download-artifact@v3 - with: - name: acvm-js - path: ./acvm-repo/acvm_js - - - name: Download noir_wasm package artifact - uses: actions/download-artifact@v3 - with: - name: noir_wasm - path: ./compiler/wasm - - - name: Download noirc_abi package artifact - uses: actions/download-artifact@v3 - 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: Install Playwright - uses: ./.github/actions/install-playwright - - - name: Setup `integration-tests` - run: | - yarn workspace @noir-lang/source-resolver build - yarn workspace @noir-lang/types build - yarn workspace @noir-lang/backend_barretenberg build - yarn workspace @noir-lang/noir_js build - - - name: Run `integration-tests` - run: | - yarn test:integration - - - name: Alert on nightly test failure - uses: JasonEtco/create-an-issue@v2 - if: ${{ failure() && github.event_name == 'schedule' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - WORKFLOW_NAME: ${{ github.workflow }} - WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - with: - update_existing: true - filename: .github/NIGHTLY_TEST_FAILURE.md diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 72bc5bfb627..5d3d86a9148 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -287,3 +287,61 @@ jobs: - name: Run browser tests run: yarn workspace @noir-lang/noir_wasm test:browser + + test-integration: + name: Integration Tests + runs-on: ubuntu-latest + needs: [build-acvm-js, build-noir-wasm, build-nargo, build-noirc-abi] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - name: Download acvm_js package artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./acvm-repo/acvm_js + + - name: Download noir_wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noir_wasm + path: ./compiler/wasm + + - name: Download noirc_abi package artifact + uses: actions/download-artifact@v3 + 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: Install Playwright + uses: ./.github/actions/install-playwright + + - name: Setup `integration-tests` + run: | + yarn workspace @noir-lang/source-resolver build + yarn workspace @noir-lang/types build + yarn workspace @noir-lang/backend_barretenberg build + yarn workspace @noir-lang/noir_js build + + - name: Run `integration-tests` + run: | + yarn test:integration From b6c00b2846f493482da5206986f5ac115ab17239 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 17:08:03 +0000 Subject: [PATCH 08/15] chore: build packages in parallel for integration tests --- .github/workflows/test-js-packages.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 5d3d86a9148..4434f4485c8 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -337,10 +337,9 @@ jobs: - name: Setup `integration-tests` run: | - yarn workspace @noir-lang/source-resolver build - yarn workspace @noir-lang/types build - yarn workspace @noir-lang/backend_barretenberg build - yarn workspace @noir-lang/noir_js build + # Note the lack of spaces between package names. + PACKAGES_TO_BUILD="@noir-lang/source-resolver,noir-lang/types,noir-lang/backend_barretenberg,noir-lang/noir_js" + yarn workspaces foreach -vp --from "{$PACKAGES_TO_BUILD}" run build - name: Run `integration-tests` run: | From c35a1310d167b5c9c93461979d55afee1cefee26 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 17:17:50 +0000 Subject: [PATCH 09/15] chore: add workflow to tie together all test results. --- .github/workflows/test-js-packages.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 4434f4485c8..a14b0a4b57a 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -344,3 +344,14 @@ jobs: - name: Run `integration-tests` run: | yarn test:integration + + # This is a noop job which depends on all test jobs + # This allows us to add/remove test jobs without having to update the required workflows. + tests-end: + name: End + runs-on: ubuntu-latest + needs: [build-noirc-abi, test-acvm_js-node, test-acvm_js-browser, test-noirc-abi, test-noir-js, test-noir-wasm, test-integration] + + steps: + - name: Noop + run: echo "noop" From 9270e347d157c6499ac66b72c747a1ff6841540c Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 17:22:00 +0000 Subject: [PATCH 10/15] chore: add missing @s --- .github/workflows/test-js-packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index a14b0a4b57a..adf91f1f5dd 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -338,7 +338,7 @@ jobs: - name: Setup `integration-tests` run: | # Note the lack of spaces between package names. - PACKAGES_TO_BUILD="@noir-lang/source-resolver,noir-lang/types,noir-lang/backend_barretenberg,noir-lang/noir_js" + PACKAGES_TO_BUILD="@noir-lang/source-resolver,@noir-lang/types,@noir-lang/backend_barretenberg,@noir-lang/noir_js" yarn workspaces foreach -vp --from "{$PACKAGES_TO_BUILD}" run build - name: Run `integration-tests` From e0f3b34e1bcb85026edf9c55ca378f5b3c191727 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 17:45:34 +0000 Subject: [PATCH 11/15] chore: merge in source resolver tests --- .github/workflows/test-js-packages.yml | 27 +++++++++++++++++++++- .github/workflows/test-source-resolver.yml | 26 --------------------- 2 files changed, 26 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/test-source-resolver.yml diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index adf91f1f5dd..a54401ccbdd 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -239,6 +239,23 @@ jobs: yarn workspace @noir-lang/noir_js build yarn workspace @noir-lang/noir_js test + test-source-resolver: + name: source-resolver + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Build @noir-lang/source-resolver + run: yarn workspace @noir-lang/source-resolver build + + - name: Run tests + run: yarn workspace @noir-lang/source-resolver test + test-noir-wasm: needs: [build-noir-wasm, build-nargo] name: noir_wasm @@ -350,7 +367,15 @@ jobs: tests-end: name: End runs-on: ubuntu-latest - needs: [build-noirc-abi, test-acvm_js-node, test-acvm_js-browser, test-noirc-abi, test-noir-js, test-noir-wasm, test-integration] + needs: + - build-noirc-abi + - test-acvm_js-node + - test-acvm_js-browser + - test-noirc-abi + - test-noir-js + - test-source-resolver + - test-noir-wasm + - test-integration steps: - name: Noop diff --git a/.github/workflows/test-source-resolver.yml b/.github/workflows/test-source-resolver.yml deleted file mode 100644 index 5dafe4c5fd9..00000000000 --- a/.github/workflows/test-source-resolver.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Test Source Resolver - -on: - push: - paths: - - "compiler/source-resolver/**" - pull_request: - paths: - - "compiler/source-resolver/**" - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Yarn dependencies - uses: ./.github/actions/setup - - - name: Build @noir-lang/source-resolver - run: yarn workspace @noir-lang/source-resolver build - - - name: Run tests - run: yarn workspace @noir-lang/source-resolver test From 0c20e8c3498924a73a446cccc3eee0f0684cc6e3 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 17:46:21 +0000 Subject: [PATCH 12/15] chore: remove unnecessary dependency --- .github/workflows/test-js-packages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index a54401ccbdd..d0575fc0812 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -368,7 +368,6 @@ jobs: name: End runs-on: ubuntu-latest needs: - - build-noirc-abi - test-acvm_js-node - test-acvm_js-browser - test-noirc-abi From d12c79351a36ef28fd94523888daa5aed6ffd156 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 24 Nov 2023 18:59:13 +0000 Subject: [PATCH 13/15] chore: remove unnecessary steps --- .github/workflows/test-js-packages.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index d0575fc0812..9b69e2f79ac 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -268,7 +268,7 @@ jobs: uses: actions/download-artifact@v3 with: name: noir_wasm - path: ./compiler/wasm/downloaded + path: ./compiler/wasm - name: Download nargo binary uses: actions/download-artifact@v3 @@ -295,8 +295,6 @@ jobs: - name: Install dependencies run: | - cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm - cp -r ./compiler/wasm/downloaded/web ./compiler/wasm yarn workspace @noir-lang/source-resolver build - name: Run node tests From 31e34d465f7cbcef0823c2fdc00feee52c5aff50 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 27 Nov 2023 10:04:34 +0000 Subject: [PATCH 14/15] chore: merge in testing job to main workflow --- .github/workflows/test-js-packages.yml | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 9b69e2f79ac..519c94f3de0 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -303,6 +303,38 @@ jobs: - name: Run browser tests run: yarn workspace @noir-lang/noir_wasm test:browser + test-noir-codegen: + needs: [build-acvm-js, build-noirc-abi] + name: noir_codegen + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download acvm_js package artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./acvm-repo/acvm_js + + - name: Download noirc_abi package artifact + uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: ./tooling/noirc_abi_wasm + + - 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: name: Integration Tests runs-on: ubuntu-latest @@ -359,7 +391,7 @@ jobs: - name: Run `integration-tests` run: | yarn test:integration - + # This is a noop job which depends on all test jobs # This allows us to add/remove test jobs without having to update the required workflows. tests-end: @@ -372,6 +404,7 @@ jobs: - test-noir-js - test-source-resolver - test-noir-wasm + - test-noir-codegen - test-integration steps: From 83401d0afb0012efdd45443a15cb8c89bee410a3 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 27 Nov 2023 10:07:04 +0000 Subject: [PATCH 15/15] chore: delete unwanted workflow --- .github/workflows/test-noir_codegen.yml | 97 ------------------------- 1 file changed, 97 deletions(-) delete mode 100644 .github/workflows/test-noir_codegen.yml diff --git a/.github/workflows/test-noir_codegen.yml b/.github/workflows/test-noir_codegen.yml deleted file mode 100644 index d5a04a9dcd0..00000000000 --- a/.github/workflows/test-noir_codegen.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: noir_codegen - -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 - strategy: - matrix: - target: [x86_64-unknown-linux-gnu] - - steps: - - name: Checkout Noir repo - uses: actions/checkout@v4 - - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.target }} - 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@v3 - with: - name: nargo - path: ./dist/* - retention-days: 3 - - test: - needs: [build-nargo] - name: Test noir_codegen - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Yarn dependencies - uses: ./.github/actions/setup - - - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.71.1 - with: - targets: wasm32-unknown-unknown - - - uses: Swatinem/rust-cache@v2 - with: - key: wasm32-unknown-unknown-noir-js - cache-on-failure: true - save-if: ${{ github.event_name != 'merge_group' }} - - - name: Install jq - run: sudo apt-get install jq - - - name: Install wasm-bindgen-cli - uses: taiki-e/install-action@v2 - with: - tool: wasm-bindgen-cli@0.2.86 - - - name: Install wasm-opt - run: | - npm i wasm-opt -g - - - name: Build acvm_js - run: yarn workspace @noir-lang/acvm_js build - - - name: Build noirc_abi - run: yarn workspace @noir-lang/noirc_abi build - - - 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