Skip to content

Commit

Permalink
Merge branch 'master' into jb-track-acvm-integration-tests
Browse files Browse the repository at this point in the history
* master:
  chore(ci): Treat clippy warnings as errors in CI (#2684)
  chore(ci): Cache yarn and playwright dependencies in CI (#2697)
  chore: Add noir-wasm publishing as a workflow (#2721)
  fix: failing js tests (#2722)
  chore: Add deprecation message for default type in for loop (#2689)
  chore!: Change `noir-lang/noir-source-resolver` to `noir-lang/source-resolver` (#2718)
  chore: clippy fixes (#2719)
  chore: Integrate noir.js into workspace and CI release workflow (#2705)
  feat: Add initial version of noir.js (#2681)
  chore: switch `release-source-resolver.yml` to use yarn (#2704)
  chore: move stranded test to correct directory (#2701)
  chore(ci): deny wildcard dependencies (#2702)
  chore: fix `noirc_abi_wasm` publish for release-please (#2699)
  • Loading branch information
TomAFrench committed Sep 15, 2023
2 parents ff8ff34 + 507c725 commit 64b1114
Show file tree
Hide file tree
Showing 64 changed files with 544 additions and 323 deletions.
24 changes: 24 additions & 0 deletions .github/actions/install-playwright/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Install Playwright
description: Installs Playwright and its dependencies and caches them.

runs:
using: composite
steps:
- name: Query playwright version
shell: bash
run: echo "PLAYWRIGHT_VERSION=$(yarn workspace @noir-lang/noirc_abi info @web/test-runner-playwright --json | jq .children.Version | tr -d '"')" >> $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: Install playwright deps
shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: |
npx playwright install
npx playwright install-deps
16 changes: 3 additions & 13 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
name: Setup

inputs:
working-directory:
default: ./
required: false
name: Install Yarn dependencies
description: Installs the workspace's yarn dependencies and caches them

runs:
using: composite
steps:
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: "**/node_modules"
key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: |
cd ${{ inputs.working-directory }}
yarn --immutable
run: yarn --immutable
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
46 changes: 20 additions & 26 deletions .github/workflows/abi_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

jobs:
noirc-abi-wasm-build:
build:
runs-on: ubuntu-latest
env:
CACHED_PATH: /tmp/nix-cache
Expand Down Expand Up @@ -72,35 +72,29 @@ jobs:
path: ${{ env.UPLOAD_PATH }}
retention-days: 10

- name: Install workspace dependencies
run: |
yarn install --immutable
- name: Run node tests
run: |
yarn workspace @noir-lang/noirc_abi test
test:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm

- name: Install Yarn dependencies
uses: ./.github/actions/setup

- 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: Run node tests
run: yarn workspace @noir-lang/noirc_abi test

- name: Install playwright deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./tooling/noirc_abi_wasm
run: |
npx playwright install
npx playwright install-deps
- name: Install Playwright
uses: ./.github/actions/install-playwright

- name: Run browser tests
working-directory: ./tooling/noirc_abi_wasm
run: |
yarn workspace @noir-lang/noirc_abi test:browser
run: yarn workspace @noir-lang/noirc_abi test:browser

7 changes: 4 additions & 3 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
name: cargo clippy
runs-on: ${{ matrix.runner }}
timeout-minutes: 30

env:
RUSTFLAGS: -Dwarnings

strategy:
fail-fast: false
matrix:
Expand All @@ -30,9 +32,8 @@ jobs:
uses: actions/checkout@v4

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

Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/noir-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release and Publish Noir Js

on:
workflow_dispatch:

jobs:
release-noir-js:
name: Release and Publish Noir Js
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: yarn install --immutable

- name: Install jq
run: sudo apt-get install jq

- name: Install cargo and wasm-bindgen
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo install -f wasm-bindgen-cli --version 0.2.86
- name: Install toml2json
run: |
source $HOME/.cargo/env
cargo install toml2json
- name: Install wasm-opt
run: |
npm i wasm-opt -g
- name: Install wasm32-unknown-unknwown target
run: |
rustup target add wasm32-unknown-unknown
- name: Build noirc_abi
run: yarn workspace @noir-lang/noirc_abi build

- name: Build noir_js
run: yarn workspace @noir-lang/noir_js build

- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Publish to NPM
working-directory: ./tooling/noir_js
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17 changes: 11 additions & 6 deletions .github/workflows/publish-abi_wasm.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Publish ABI Wasm

on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
noir-ref:
description: The noir reference to checkout
required: true

jobs:
noirc-abi-wasm-build:
Expand All @@ -15,6 +16,9 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: "noir-lang/noir"
ref: ${{ inputs.noir-ref }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -39,8 +43,9 @@ jobs:
mkdir temp_publish_dir
cp -r ${{ env.BUILD_OUTPUT_PATH }}/* temp_publish_dir/
- name: Publish to NPM
- name: Publish to npm
working-directory: ./temp_publish_dir
run: npm publish
run: |
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 8 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ jobs:
path: ./dist/*
retention-days: 3

- name: Install Yarn dependencies
if: matrix.target == 'x86_64-apple-darwin'
uses: ./.github/actions/setup

- name: Test built artifact
if: matrix.target == 'x86_64-apple-darwin'
run: |
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/
yarn install --immutable
yarn workspace release-tests test
- name: Upload binaries to release tag
Expand Down Expand Up @@ -139,11 +142,14 @@ jobs:
path: ./dist/*
retention-days: 3

- name: Install Yarn dependencies
if: startsWith(matrix.target, 'x86_64-unknown-linux')
uses: ./.github/actions/setup

- name: Test built artifact
if: startsWith(matrix.target, 'x86_64-unknown-linux')
run: |
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/
yarn install --immutable
yarn workspace release-tests test
- name: Upload binaries to release tag
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/release-noir-wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release Noir Wasm

on:
workflow_dispatch:

jobs:
publish-noir-wasm:
runs-on: ubuntu-22.04

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

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-23.05

- name: Build with Nix
run: |
nix build -L .#wasm
- name: Copy output
run: |
cp -r $(readlink result)/* .
- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Publish to npm
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 changes: 3 additions & 32 deletions .github/workflows/release-source-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Release and Publish Source Resolver

on:
workflow_dispatch:
inputs:
version:
description: "Version number"
required: false

jobs:
release-source-resolver:
Expand All @@ -15,39 +11,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Bump version
working-directory: ./compiler/source-resolver
id: bump_version
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
NEW_VERSION=$(npm version patch --no-git-tag-version)
else
NEW_VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version)
fi
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Install dependencies
working-directory: ./compiler/source-resolver
run: npm install
run: yarn install --immutable

- name: Build noir-source-resolver
working-directory: ./compiler/source-resolver
run: npm run build
run: yarn workspace @noir-lang/source-resolver build

- name: Publish to NPM
working-directory: ./compiler/source-resolver
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Configure git
run: |
git config user.name kevaundray
git config user.email kevtheappdev@gmail.com
- name: Commit updates
run: |
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
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit 64b1114

Please sign in to comment.