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: introduce workspace for js packages #2677

Merged
merged 32 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
75f9457
chore: ensure same rust toolchains in nix shell
kobyhallx Sep 13, 2023
11f6703
chore: align js packages build procedure
kobyhallx Sep 13, 2023
92a0aed
chore(js): ignore build artifacst
kobyhallx Sep 13, 2023
da7eafe
chore: don't ignore test artifact
kobyhallx Sep 13, 2023
b527387
chore: introduce js workspaces
kobyhallx Sep 13, 2023
9f3bcde
chore: adjust test-integration workflow to workspace
kobyhallx Sep 13, 2023
533eb80
Merge branch 'master' into kh-js-workspace
kobyhallx Sep 13, 2023
e0f6fde
chore: cleanup package json
kobyhallx Sep 13, 2023
a764b3e
chore: build step for integration tests
kobyhallx Sep 13, 2023
edc813a
chore: remove redundant lock file
kobyhallx Sep 13, 2023
0a16d32
chore: incl. release-tests in workspace
kobyhallx Sep 13, 2023
8718dc1
chore: update lock
kobyhallx Sep 13, 2023
ec1845e
chore: adjust test runs
kobyhallx Sep 13, 2023
5c16c01
chore: update node version
kobyhallx Sep 13, 2023
a2339ff
chore: improve yarn installs
kobyhallx Sep 13, 2023
0250a50
chore: restore playwright
kobyhallx Sep 13, 2023
caa8981
fix: package location
kobyhallx Sep 13, 2023
c02c3bb
fix: package paths
kobyhallx Sep 13, 2023
0897f1a
chore: rearanging tests
kobyhallx Sep 13, 2023
be4da22
chore: fix test execution
kobyhallx Sep 14, 2023
4aab00f
fix: error Command "test:browser" not found
kobyhallx Sep 14, 2023
e71641c
chore: remove unnecessary lock file
kobyhallx Sep 14, 2023
d24f8ff
chore: add source-resolver build step
kobyhallx Sep 14, 2023
d809e84
fix: @noir-lang/noir-source-resolver test execution
kobyhallx Sep 14, 2023
2daf41e
chore: address #discussion_r1324469040
kobyhallx Sep 14, 2023
a8a7795
chore: address #discussion_r1324469040
kobyhallx Sep 14, 2023
9d5c129
chore: fixes repos url
kobyhallx Sep 14, 2023
1e1306d
chore: update command
kobyhallx Sep 14, 2023
0a640f9
chore: update repository
kobyhallx Sep 14, 2023
bfd68c6
chore: use summary reporters in CI
kobyhallx Sep 14, 2023
35a1012
chore: set up a yarn v3 workspace (#2692)
TomAFrench Sep 14, 2023
a974486
chore: clean up conflict
TomAFrench Sep 14, 2023
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
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18.15
node-version: 18.17.1
- name: Cache
uses: actions/cache@v3
id: cache
Expand Down
60 changes: 14 additions & 46 deletions .github/workflows/abi_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
- name: Build noirc_abi_wasm
run: |
nix build -L .#noirc_abi_wasm
cp -r ./result/nodejs ./tooling/noirc_abi_wasm
cp -r ./result/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 @@ -70,48 +72,13 @@ jobs:
path: ${{ env.UPLOAD_PATH }}
retention-days: 10

noirc-abi-wasm-test-node:
needs: [noirc-abi-wasm-build]
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: noirc_abi_wasm
path: ./result

- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./tooling/noirc_abi_wasm
- name: Install workspace dependencies
run: |
yarn install --immutable

- 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

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

- name: Cache playwright binaries
uses: actions/cache@v3
Expand All @@ -121,18 +88,19 @@ jobs:
~/.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: 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: 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: Run browser tests
working-directory: ./tooling/noirc_abi_wasm
run: yarn install && yarn test:browser
run: |
yarn workspace @noir-lang/noirc_abi test:browser

14 changes: 5 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ jobs:
- name: Test built artifact
if: matrix.target == 'x86_64-apple-darwin'
run: |
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/

cd release-tests
yarn install
yarn test
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/
yarn install --immutable
yarn workspace release-tests test

- name: Upload binaries to release tag
uses: svenstaro/upload-release-action@v2
Expand Down Expand Up @@ -145,10 +143,8 @@ jobs:
if: startsWith(matrix.target, 'x86_64-unknown-linux')
run: |
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/

cd release-tests
yarn install
yarn test
yarn install --immutable
yarn workspace release-tests test

- name: Upload binaries to release tag
uses: svenstaro/upload-release-action@v2
Expand Down
35 changes: 8 additions & 27 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
- 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
cp -r ./result/nodejs ./compiler/wasm
cp -r ./result/web ./compiler/wasm

- name: Upload `noir_wasm` artifact
uses: actions/upload-artifact@v3
Expand All @@ -66,9 +66,9 @@ jobs:
- 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
cp -r ./result/nodejs ./tooling/noirc_abi_wasm
cp -r ./result/web ./tooling/noirc_abi_wasm

- name: Upload `noirc_abi_wasm` artifact
uses: actions/upload-artifact@v3
Expand All @@ -77,31 +77,12 @@ jobs:
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
yarn install --immutable
yarn test:integration

- name: Alert on nightly test failure
uses: JasonEtco/create-an-issue@v2
if: ${{ failure() && github.event_name == 'schedule' }}
env:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/test-source-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ jobs:
uses: actions/checkout@v3

- 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/noir-source-resolver build

- name: Run tests
working-directory: ./compiler/source-resolver
run: npm run test
run: yarn workspace @noir-lang/noir-source-resolver test
23 changes: 8 additions & 15 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: noir_wasm
path: ./compiler/wasm/result
path: ./compiler/wasm/downloaded

- name: Download nargo binary
uses: actions/download-artifact@v3
Expand All @@ -132,23 +132,16 @@ jobs:
chmod +x $nargo_binary
$nargo_binary compile

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

- name: Install dependencies
working-directory: ./compiler/wasm
run: yarn install

- name: Install playwright deps
working-directory: ./compiler/wasm
run: |
npx playwright install
npx playwright install-deps

cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm
cp -r ./compiler/wasm/downloaded/web ./compiler/wasm
yarn install --immutable
yarn workspace @noir-lang/noir-source-resolver build

- name: Run tests
working-directory: ./compiler/wasm
run: |
yarn test:browser
yarn test:node
yarn workspace @noir-lang/noir_wasm test:browser
yarn workspace @noir-lang/noir_wasm test:node
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ examples/9
node_modules
pkg/

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Source resolver
compiler/source-resolver/node_modules
compiler/source-resolver/lib
Expand All @@ -27,7 +36,13 @@ result
**/target
!tooling/nargo_cli/tests/acir_artifacts/*/target
!tooling/nargo_cli/tests/acir_artifacts/*/target/witness.gz

!compiler/wasm/noir-script/target
# Github Actions scratch space
# This gives a location to download artifacts into the repository in CI without making git dirty.
libbarretenberg-wasm32

# Wasm build atifacts
compiler/wasm/nodejs
compiler/wasm/web
tooling/noirc_abi_wasm/nodejs
tooling/noirc_abi_wasm/web
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.6.3.cjs
33 changes: 11 additions & 22 deletions compiler/integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
{
"name": "integration-tests",
"version": "1.0.0",
"description": "",
"license": "(MIT OR Apache-2.0)",
"main": "index.js",
"scripts": {
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"build": "echo Integration Test build step",
"test": "yarn test:browser",
"test:browser": "web-test-runner",
"test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:integration:browser": "web-test-runner test//integration/browser/**/*.test.ts",
"test:integration:browser:watch": "web-test-runner test/integration/browser/**/*.test.ts --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.15.3",
"@web/test-runner-webdriver": "^0.7.0",
"chai": "^4.3.7",
"fflate": "^0.8.0",
"mocha": "^10.2.0",
"smol-toml": "^1.1.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"dependencies": {
"@aztec/bb.js": "^0.5.1",
"@noir-lang/acvm_js": "./../../.packages/acvm_js",
"@noir-lang/noir-source-resolver": "^1.1.4",
"@noir-lang/noir_wasm": "./../../.packages/noir_wasm",
"@noir-lang/noirc_abi": "./../../.packages/noirc_abi_wasm"
"@noir-lang/acvm_js": "^0.26.0",
"@noir-lang/noir-source-resolver": "workspace:*",
"@noir-lang/noir_wasm": "workspace:*",
"@noir-lang/noirc_abi": "workspace:*",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.15.3",
"@web/test-runner-playwright": "^0.10.0",
"@web/test-runner-webdriver": "^0.7.0"
}
}
7 changes: 7 additions & 0 deletions compiler/integration-tests/web-test-runner.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { defaultReporter } from "@web/test-runner";
import { summaryReporter } from "@web/test-runner";
import { fileURLToPath } from "url";
import { esbuildPlugin } from "@web/dev-server-esbuild";
import { webdriverLauncher } from "@web/test-runner-webdriver";

// eslint-disable-next-line no-undef
const reporter = process.env.CI ? summaryReporter() : defaultReporter();

export default {
browsers: [
webdriverLauncher({
Expand All @@ -26,6 +31,8 @@ export default {
ui: "bdd",
},
},
// eslint-disable-next-line no-undef
rootDir: fileURLToPath(new URL("./../..", import.meta.url)),
testsFinishTimeout: 60 * 20e3, // 20 minutes
reporters: [reporter],
};
Loading
Loading