Skip to content

Commit

Permalink
Merge branch 'master' into tf/explicit-package-type-handling
Browse files Browse the repository at this point in the history
* master:
  chore: Move tooling related items into their own directory (#2644)
  chore: add `CompilationResult` helper type (#2639)
  fix: initialise arrays returned by brillig (#2048)
  chore: clippy fix (#2631)
  fix(wasm): Remove stacker from dependencies (#2637)
  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)
  chore(ci): enforce clippy and `cargo fmt` in CI (#2628)
  • Loading branch information
TomAFrench committed Sep 11, 2023
2 parents 7afc69c + bc53432 commit c017d1f
Show file tree
Hide file tree
Showing 1,112 changed files with 5,165 additions and 262 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}}`
15 changes: 8 additions & 7 deletions .github/workflows/abi_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ jobs:
- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./crates/noirc_abi_wasm
working-directory: ./tooling/noirc_abi_wasm

- name: Run node tests
working-directory: ./crates/noirc_abi_wasm
run: yarn test
working-directory: ./tooling/noirc_abi_wasm
run: yarn install && yarn test

noirc-abi-wasm-test-browser:
needs: [noirc-abi-wasm-build]
Expand All @@ -110,6 +110,7 @@ jobs:
path: ./result

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

- name: Cache playwright binaries
Expand All @@ -123,15 +124,15 @@ jobs:
- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./crates/noirc_abi_wasm
working-directory: ./tooling/noirc_abi_wasm

- name: Install playwright deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./crates/noirc_abi_wasm
working-directory: ./tooling/noirc_abi_wasm
run: |
npx playwright install
npx playwright install-deps
- name: Run browser tests
working-directory: ./crates/noirc_abi_wasm
run: yarn test:browser
working-directory: ./tooling/noirc_abi_wasm
run: yarn install && yarn test:browser
64 changes: 64 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Clippy

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:
clippy:
name: cargo clippy
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu

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

- name: Restore cargo cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable # We do not use MSRV so we can benefit from newer lints
targets: ${{ matrix.target }}
components: clippy, rustfmt

- name: Run `cargo clippy`
run: cargo clippy --workspace --locked --release

- name: Run `cargo fmt`
run: cargo fmt --all --check

- uses: actions/cache/save@v3
# Write a cache entry even if the tests fail but don't create any for the merge queue.
if: ${{ always() && steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
12 changes: 6 additions & 6 deletions .github/workflows/release-source-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

- name: Bump version
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
id: bump_version
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
Expand All @@ -27,15 +27,15 @@ jobs:
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Install dependencies
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
run: npm install

- name: Build noir-source-resolver
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
run: npm run build

- name: Publish to NPM
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Commit updates
run: |
git add crates/source-resolver/package-lock.json
git add crates/source-resolver/package.json
git add compiler/source-resolver/package-lock.json
git add compiler/source-resolver/package.json
git commit -m "chore: Update source-resolver to ${{ env.NEW_VERSION }}"
git push
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: ./compiler/integration-tests
run: yarn install

- name: Run `integration-tests`
working-directory: ./compiler/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
10 changes: 5 additions & 5 deletions .github/workflows/test-source-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Test Source Resolver
on:
push:
paths:
- "crates/source-resolver/**"
- "compiler/source-resolver/**"
pull_request:
paths:
- "crates/source-resolver/**"
- "compiler/source-resolver/**"

jobs:
test:
Expand All @@ -17,13 +17,13 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
run: npm install

- name: Build noir-source-resolver
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
run: npm run build

- name: Run tests
working-directory: ./crates/source-resolver
working-directory: ./compiler/source-resolver
run: npm run test
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: ./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
Loading

0 comments on commit c017d1f

Please sign in to comment.