Skip to content

Commit

Permalink
chore: Bring acvm_js package into the workspace (noir-lang#459)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom French <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: Savio <[email protected]>
Co-authored-by: Globallager <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: jonybur <[email protected]>
Co-authored-by: kevaundray <[email protected]>
Co-authored-by: vezenovm <[email protected]>
Co-authored-by: Maddiaa <[email protected]>
  • Loading branch information
10 people authored Aug 8, 2023
1 parent 0f28784 commit 85b9adc
Show file tree
Hide file tree
Showing 59 changed files with 11,245 additions and 12 deletions.
20 changes: 20 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Based on https://github.com/direnv/direnv-vscode/blob/158e8302c2594cc0eaa5f8b4f0cafedd4e1c0315/.envrc

# You can define your system-specific logic (like Git settings or GH tokens) in .envrc.local
# If that logic is usable by other people and might improve development environment, consider
# contributing it to this file!

source_env_if_exists .envrc.local

if [[ -z "${SKIP_NIX:-}" ]] && has nix; then

if nix flake metadata &>/dev/null && has use_flake; then
# use flakes if possible
use flake

else
# Otherwise fall back to pure nix
use nix
fi

fi
22 changes: 22 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Yarn Cache and Install
description: Installs dependencies and caches them

inputs:
working-directory:
default: ./
required: false

runs:
using: composite
steps:
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: "**/node_modules"
key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install
working-directory: ${{ inputs.working-directory }}
run: yarn --immutable
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,18 @@ jobs:
workflow: publish.yml
ref: master
inputs: '{ "acvm-ref": "${{ needs.release-please.outputs.tag-name }}" }'

dispatch-acvm-js-wasm:
name: Dispatch to acvm-js-wasm
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to acvm-js-wasm
uses: benc-uk/workflow-dispatch@v1
with:
workflow: update.yml
repo: noir-lang/acvm-js-wasm
token: ${{ secrets.ACVM_JS_RELEASES_TOKEN }}
inputs: '{ "acvm-js-ref": "${{ needs.release-please.outputs.tag-name }}" }'

58 changes: 49 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,54 @@ name: Rust
on: [push, pull_request]

jobs:
check_n_test:
name: cargo check & test
uses: noir-lang/.github/.github/workflows/rust-test.yml@main
clippy-n-test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30

clippy:
name: cargo clippy
uses: noir-lang/.github/.github/workflows/rust-clippy.yml@main
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu
runner: ubuntu-latest
target: x86_64-linux

format:
name: cargo fmt
uses: noir-lang/.github/.github/workflows/rust-format.yml@main
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-22.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: cachix/cachix-action@v12
with:
name: barretenberg

- name: Restore nix store cache
id: nix-store-cache
uses: actions/cache@v3
with:
path: /tmp/nix-cache
key: ${{ runner.os }}-flake-${{ 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.nix-store-cache.outputs.cache-hit == 'true'
# We don't check the signature because we're the one that created the cache
run: |
for narinfo in /tmp/nix-cache/*.narinfo; do
path=$(head -n 1 "$narinfo" | awk '{print $2}')
nix copy --no-check-sigs --from "file:///tmp/nix-cache" "$path"
done
- name: Run `nix flake check`
run: |
nix flake check -L
- name: Export cache from nix store
if: steps.nix-store-cache.outputs.cache-hit != 'true'
run: |
nix copy --to "file:///tmp/nix-cache?compression=zstd&parallel-compression=true" .#cargo-artifacts
93 changes: 93 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Test acvm_js

on: [push, pull_request]

# 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@v3

- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-22.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: cachix/cachix-action@v12
with:
name: barretenberg
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Build acvm-js
run: |
nix build .#
- 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@v3

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./result

- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./acvm_js

- name: Run node tests
working-directory: ./acvm_js
run: yarn test

test-acvm_js-browser:
needs: [build-acvm-js-package]
name: Browser Tests
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./result

- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./acvm_js

- name: Install playwright deps
working-directory: ./acvm_js
run: |
npx playwright install
npx playwright install-deps
- name: Run browser tests
working-directory: ./acvm_js
run: yarn test:browser
26 changes: 26 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Typescript

on: [push, pull_request]

# 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:
eslint:
name: Eslint
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/setup
with:
working-directory: ./acvm_js

- name: Run eslint
working-directory: ./acvm_js
run: yarn lint
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/target
.DS_Store
.vscode
Cargo.lock
# Cargo.lock
result
outputs/
.direnv
Loading

0 comments on commit 85b9adc

Please sign in to comment.