Skip to content

Commit

Permalink
Merge branch 'master' of github.com:noir-lang/noir into jb/update-npm…
Browse files Browse the repository at this point in the history
…-token
  • Loading branch information
jonybur committed Sep 13, 2023
2 parents 42b4c7b + f173c05 commit 31a93b9
Show file tree
Hide file tree
Showing 1,122 changed files with 6,013 additions and 917 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}}`
30 changes: 23 additions & 7 deletions .github/workflows/abi_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ 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:
Expand Down Expand Up @@ -85,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 @@ -106,17 +109,30 @@ jobs:
name: noirc_abi_wasm
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
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- 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
working-directory: ./crates/noirc_abi_wasm
if: steps.playwright-cache.outputs.cache-hit != 'true'
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 }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Release ABI Wasm
name: Publish ABI Wasm

on:
push:
tags:
- "*"
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -40,4 +43,4 @@ jobs:
working-directory: ./temp_publish_dir
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,13 @@ jobs:
with:
targets: ${{ matrix.target }}

- name: Install Cross
uses: taiki-e/install-action@v2
with:
tool: cross@0.2.5

- name: Build Nargo
run: |
cargo install cross --version 0.2.5 --force
cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"

- uses: actions/cache/save@v3
# Don't create cache entries for the merge queue.
Expand Down
14 changes: 7 additions & 7 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,18 +27,18 @@ 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_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Configure git
run: |
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
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Test
on:
pull_request:
merge_group:
push:
branches:
- master

# This will cancel previous runs when a branch or PR is updated
concurrency:
Expand Down Expand Up @@ -39,7 +42,7 @@ jobs:
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ runner.os }}-flake-${{ hashFiles('*.lock') }}
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0
Expand Down
Loading

0 comments on commit 31a93b9

Please sign in to comment.