Skip to content

Commit

Permalink
merge conflcits w/ master
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Sep 19, 2023
2 parents 682c5bb + 8617008 commit af1b4a0
Show file tree
Hide file tree
Showing 234 changed files with 7,461 additions and 14,608 deletions.
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
"comma-spacing": ["error", { before: false, after: true }],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"prettier/prettier": "error",
},
};
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Ideas
url: https://github.com/orgs/noir-lang/discussions/new?category=ideas
about: Share ideas for new features
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature Request
description: Suggest an idea.
labels: [enhancement]
name: Idea Action Plan
description: Outline the scope and steps for implementing an enhancement. Start with "Ideas" instead to request and discuss new features.
labels: ["enhancement"]
body:
- type: markdown
attributes:
Expand Down
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.15
- 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'
66 changes: 14 additions & 52 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 @@ -47,6 +47,8 @@ jobs:
- name: Build noirc_abi_wasm
run: |
nix build -L .#noirc_abi_wasm
cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm
cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm
- name: Export cache from nix store
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
Expand All @@ -61,7 +63,7 @@ jobs:
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Dereference symlink
run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV

- name: Upload artifact
uses: actions/upload-artifact@v3
Expand All @@ -70,69 +72,29 @@ jobs:
path: ${{ env.UPLOAD_PATH }}
retention-days: 10

noirc-abi-wasm-test-node:
needs: [noirc-abi-wasm-build]
name: Node.js Tests
test:
runs-on: ubuntu-latest
needs: [build]

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

- name: Download artifact
- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noirc_abi_wasm
path: ./result
path: ./tooling/noirc_abi_wasm

- name: Set up test environment
- name: Install Yarn dependencies
uses: ./.github/actions/setup
with:
working-directory: ./tooling/noirc_abi_wasm

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

noirc-abi-wasm-test-browser:
needs: [noirc-abi-wasm-build]
name: Browser Tests
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3
run: yarn workspace @noir-lang/noirc_abi test

- name: Download artifact
uses: actions/download-artifact@v3
with:
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: ./tooling/noirc_abi_wasm

- 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 install && yarn test:browser
run: yarn workspace @noir-lang/noirc_abi test:browser

26 changes: 26 additions & 0 deletions .github/workflows/deny.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: deny

on:
push:
branches: [master]
paths: [Cargo.lock]
pull_request:
branches: [master]
paths: [Cargo.lock]
merge_group:

env:
RUSTFLAGS: -D warnings
CARGO_TERM_COLOR: always

concurrency: deny-${{ github.head_ref || github.run_id }}

jobs:
deny:
name: deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
47 changes: 24 additions & 23 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Clippy
name: Formatting

on:
pull_request:
Expand All @@ -18,13 +18,8 @@ jobs:
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
RUSTFLAGS: -Dwarnings

strategy:
fail-fast: false
matrix:
Expand All @@ -36,29 +31,35 @@ jobs:
- 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
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

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- 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 }}
eslint:
name: eslint
runs-on: ubuntu-latest
timeout-minutes: 30

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

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

- name: Run `yarn lint`
run: yarn lint
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 }}
Loading

0 comments on commit af1b4a0

Please sign in to comment.