Skip to content

Commit

Permalink
Merge branch 'master' into tf/noir-wasm-dedupe
Browse files Browse the repository at this point in the history
* master:
  chore(ci): reenable CI for `noir_wasm` (#2636)
  fix: avoid overflows in integer division (#2180)
  chore(ci): Nightly Integration testing  (#2596)
  feat(parser): allow multiple attributes (#2537)
  feat(nargo): Allow installing custom backends from the CLI (#2632)
  • Loading branch information
TomAFrench committed Sep 11, 2023
2 parents fac344b + a3b30fd commit dc6d022
Show file tree
Hide file tree
Showing 35 changed files with 4,964 additions and 147 deletions.
11 changes: 11 additions & 0 deletions .github/NIGHTLY_TEST_FAILURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "nightly test-integration failed"
assignees: kobyhallx, phated, tomafrench, jonybur
labels: bug
---

Something broke our nightly integration test.

Check the [test]({{env.WORKFLOW_URL}}) workflow for details.

This issue was raised by the workflow `{{env.WORKFLOW_NAME}}`
1 change: 1 addition & 0 deletions .github/workflows/abi_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
path: ./result

- name: Query playwright version
working-directory: ./crates/noirc_abi_wasm
run: echo "PLAYWRIGHT_VERSION=$(yarn info @web/test-runner-playwright --json | jq .children.Version)" >> $GITHUB_ENV

- name: Cache playwright binaries
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: test-integration

on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *" # Run nightly at 2 AM UTC

jobs:
wasm-packages-build-test:
runs-on: ubuntu-latest
env:
CACHED_PATH: /tmp/nix-cache

steps:
- name: Checkout noir sources
uses: actions/checkout@v4

- name: Checkout acvm sources
uses: actions/checkout@v3 # v3 is needed here otherwise this fails in local execution
with:
repository: noir-lang/acvm
path: acvm

- 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
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-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 noir_wasm package
run: |
nix build -L .#wasm
mkdir -p ./.packages/noir_wasm
cp -r ./result/* ./.packages/noir_wasm/
echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload `noir_wasm` artifact
uses: actions/upload-artifact@v3
with:
name: noir_wasm
path: ${{ env.UPLOAD_PATH }}
retention-days: 3

- name: Build noirc_abi_wasm package
run: |
nix build -L .#noirc_abi_wasm
mkdir -p ./.packages/noirc_abi_wasm
cp -r ./result/* ./.packages/noirc_abi_wasm/
echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload `noirc_abi_wasm` artifact
uses: actions/upload-artifact@v3
with:
name: noirc_abi_wasm
path: ${{ env.UPLOAD_PATH }}
retention-days: 3

- name: Build `acvm_js` package
working-directory: ./acvm
run: |
nix build -L .#
mkdir -p ../.packages/acvm_js
cp -r ./result/* ../.packages/acvm_js/
echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload `acvm_js` artifact
uses: actions/upload-artifact@v3
with:
name: acvm_js
path: ${{ env.UPLOAD_PATH }}
retention-days: 3

- name: Install `integration-tests` dependencies
working-directory: ./crates/integration-tests
run: yarn install

- name: Run `integration-tests`
working-directory: ./crates/integration-tests
run: |
yarn test:browser
- 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
89 changes: 47 additions & 42 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,45 +119,50 @@ jobs:
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: ./crates/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: ./crates/wasm/noir-script
# run: |
# nargo_binary=${{ github.workspace }}/nargo/nargo
# chmod +x $nargo_binary
# $nargo_binary compile

# - name: Install dependencies
# working-directory: ./crates/wasm
# run: yarn install

# - name: Install playwright deps
# working-directory: ./crates/wasm
# run: |
# npx playwright install
# npx playwright install-deps

# - name: Run tests
# working-directory: ./crates/wasm
# run: |
# yarn test:browser
# yarn test:node
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: ./crates/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: ./crates/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: ./crates/wasm

- name: Install dependencies
working-directory: ./crates/wasm
run: yarn install

- name: Install playwright deps
working-directory: ./crates/wasm
run: |
npx playwright install
npx playwright install-deps
- name: Run tests
working-directory: ./crates/wasm
run: |
yarn test:browser
yarn test:node
19 changes: 19 additions & 0 deletions crates/integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
"comma-spacing": ["error", { before: false, after: true }],
// "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"prettier/prettier": "error",
}
};
35 changes: 35 additions & 0 deletions crates/integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "integration-tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:browser": "web-test-runner",
"test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:integration:browser": "web-test-runner test//integration/browser/**/*.test.ts",
"test:integration:browser:watch": "web-test-runner test/integration/browser/**/*.test.ts --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.15.3",
"@web/test-runner-webdriver": "^0.7.0",
"chai": "^4.3.7",
"fflate": "^0.8.0",
"mocha": "^10.2.0",
"smol-toml": "^1.1.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"dependencies": {
"@aztec/bb.js": "^0.5.1",
"@noir-lang/acvm_js": "./../../.packages/acvm_js",
"@noir-lang/noir-source-resolver": "^1.1.4",
"@noir-lang/noir_wasm": "./../../.packages/noir_wasm",
"@noir-lang/noirc_abi": "./../../.packages/noirc_abi_wasm"
}
}
Loading

0 comments on commit dc6d022

Please sign in to comment.