Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Migrate ACVM without merging flakes #2773

Merged
merged 8 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/acvm-publish-acvm-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish acvm_js

on:
workflow_dispatch:
inputs:
acvm-ref:
description: The acvm reference to checkout
required: true

jobs:
publish-acvm-js-package:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.acvm-ref }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: "https://registry.npmjs.org"
node-version: 18.15

- 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: Build acvm-js
working-directory: acvm-repo
run: |
nix build .#

- name: Discover Build Output Path
working-directory: acvm-repo
run: echo "BUILD_OUTPUT_PATH=$(readlink -f ./result)" >> $GITHUB_ENV

- name: Copy Build Output to Temporary Directory
working-directory: acvm-repo
run: |
mkdir temp_publish_dir
cp -r ${{ env.BUILD_OUTPUT_PATH }}/* temp_publish_dir/

- name: Publish to NPM
working-directory: ./acvm-repo/temp_publish_dir
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
80 changes: 80 additions & 0 deletions .github/workflows/acvm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish ACVM crates

on:
workflow_dispatch:
inputs:
acvm-ref:
description: The acvm reference to checkout
required: true

jobs:
publish:
name: Publish in order
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.acvm-ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.66.0

# These steps are in a specific order so crate dependencies are updated first
- name: Publish acir_field
working-directory: acvm-repo
run: |
cargo publish --package acir_field
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish brillig
working-directory: acvm-repo
run: |
cargo publish --package brillig
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish acir
working-directory: acvm-repo
run: |
cargo publish --package acir
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish acvm_blackbox_solver
working-directory: acvm-repo
run: |
cargo publish --package acvm_blackbox_solver
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish barretenberg_blackbox_solver
working-directory: acvm-repo
run: |
cargo publish --package barretenberg_blackbox_solver
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish acvm_stdlib
working-directory: acvm-repo
run: |
cargo publish --package acvm_stdlib
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish brillig_vm
working-directory: acvm-repo
run: |
cargo publish --package brillig_vm
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish acvm
working-directory: acvm-repo
run: |
cargo publish --package acvm
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/acvm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ACVM Release

on:
push:
branches:
- master

jobs:
release-please:
name: Create Release
outputs:
release-pr: ${{ steps.release.outputs.pr }}
tag-name: ${{ steps.release.outputs.tag_name }}
runs-on: ubuntu-latest
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.ACVM_RELEASE_TOKEN }}
command: manifest

publish:
name: Publish crates
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to publish workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: acvm-publish.yml
ref: master
inputs: '{ "acvm-ref": "${{ needs.release-please.outputs.tag-name }}" }'

dispatch-publish-acvm-js:
name: Dispatch to publish-acvm-js workflow
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Trigger publish-acvm-js.yml workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: acvm-publish-acvm-js.yml
ref: master
inputs: '{ "acvm-ref": "${{ needs.release-please.outputs.tag-name }}" }'
58 changes: 58 additions & 0 deletions .github/workflows/acvm-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ACVM Rust

on: [push, pull_request]

jobs:
clippy-n-test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu
runner: ubuntu-latest
target: x86_64-linux

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

- 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`
working-directory: acvm-repo
run: |
nix flake check -L

- name: Export cache from nix store
if: steps.nix-store-cache.outputs.cache-hit != 'true'
working-directory: acvm-repo
run: |
nix copy --to "file:///tmp/nix-cache?compression=zstd&parallel-compression=true" .#cargo-artifacts
120 changes: 120 additions & 0 deletions .github/workflows/acvm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
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@v4

- 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
working-directory: acvm-repo
run: |
nix build .#

- name: Dereference symlink
working-directory: acvm-repo
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: ./acvm-repo/result

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

- name: Run node tests
working-directory: ./acvm-repo/acvm_js
run: |
yarn
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@v4

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

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

- name: Install playwright deps
working-directory: ./acvm-repo/acvm_js
run: |
npx playwright install
npx playwright install-deps

- name: Run browser tests
working-directory: ./acvm-repo/acvm_js
run: |
yarn
yarn test:browser

test-acvm_js-rust:
name: Rust Tests
runs-on: ubuntu-latest

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

- name: Setup toolchain
uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown

- uses: taiki-e/install-action@v2
with:
tool: [email protected]

- name: Run rust tests
working-directory: acvm-repo
run: cargo test
28 changes: 28 additions & 0 deletions .github/workflows/acvm-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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@v4

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

- name: Run eslint
working-directory: ./acvm-repo/acvm_js
run: |
yarn
yarn lint
Loading
Loading