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: simplify ES workspace build and publish #2989

Merged
merged 39 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f80e6cb
fix: workspaces build
kobyhallx Oct 3, 2023
6d47c2f
fix: explicitly specify files of backend package
kobyhallx Oct 4, 2023
c7af958
chore: add publish commands
kobyhallx Oct 4, 2023
82a943a
chore: publish all js packages workflow
kobyhallx Oct 4, 2023
cdd403d
chore: dry-run
kobyhallx Oct 4, 2023
24b69df
chore: rename job
kobyhallx Oct 4, 2023
b1f655d
chore: add missing setup
kobyhallx Oct 4, 2023
2bb97e9
chore: remove commit pin
kobyhallx Oct 4, 2023
b83015f
chore: ensure permissions correct
kobyhallx Oct 4, 2023
0c2d038
chore: no yarn cache
kobyhallx Oct 4, 2023
1bf99cc
chore: step back from chmod
kobyhallx Oct 4, 2023
27a5aec
chore: ensure nix build upfront
kobyhallx Oct 4, 2023
d61a9ca
chore: output package name while publishing
kobyhallx Oct 4, 2023
b94a3e6
chore: add auth
kobyhallx Oct 4, 2023
66ab2e8
chore: call publish from release
kobyhallx Oct 4, 2023
54b91db
Update .github/workflows/publish-es-packages.yml
kobyhallx Oct 4, 2023
fcc12bb
chore: make access public
kobyhallx Oct 4, 2023
484ea9a
Merge branch 'kh-fix-workspace-build' of github.com:noir-lang/noir in…
kobyhallx Oct 4, 2023
99971e1
chore remove unused
kobyhallx Oct 4, 2023
fa9f8d3
chore: filter out more from source
kobyhallx Oct 4, 2023
80ae28f
fix: token write
kobyhallx Oct 4, 2023
62e8411
chore: more debug
kobyhallx Oct 4, 2023
5ea5d6d
chore: define action for nix
kobyhallx Oct 5, 2023
64d92b5
chore: use pre-defined nix action
kobyhallx Oct 5, 2023
95db4f2
chore: see different cache
kobyhallx Oct 5, 2023
0e9f970
chore: define inputs for nix action
kobyhallx Oct 5, 2023
65e2506
chore: add gh token input
kobyhallx Oct 5, 2023
f5e6ea1
chore: populate inputs for nix
kobyhallx Oct 5, 2023
91a34dd
chore: restore sh files
kobyhallx Oct 5, 2023
072b66d
chore: setup nix in publish step
kobyhallx Oct 5, 2023
4bb26ed
Empty-Commit
kobyhallx Oct 5, 2023
e12bc1b
chore: space check
kobyhallx Oct 5, 2023
6438b6a
chore: build separately to avoid space issue
kobyhallx Oct 5, 2023
5531af0
chore: include json and md in filter
kobyhallx Oct 5, 2023
a837f2e
chore: separate to individual steps
kobyhallx Oct 5, 2023
77a5939
chore: follo links on installation
kobyhallx Oct 5, 2023
e9116ac
chore: cleanup on push
kobyhallx Oct 5, 2023
47dd53e
chore: correct description
kobyhallx Oct 6, 2023
c0f3489
Merge branch 'master' into kh-fix-workspace-build
kobyhallx Oct 6, 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
60 changes: 60 additions & 0 deletions .github/workflows/publish-es-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Noir ES Packages

on:
workflow_dispatch:
inputs:
acvm-ref:
description: The acvm reference to checkout
required: true
kobyhallx marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build-all-wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Nix
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 wasm package
run: |
nix build -L .#all_wasm

publish-es-packages:
runs-on: ubuntu-latest
needs: [build-all-wasm]
steps:
- name: Checkout sources
uses: actions/checkout@v4

- 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: Install Yarn dependencies
run: yarn install

- name: Build ES Packages
run: yarn prepare:publish

- name: Authenticate with npm
run: echo "npmAuthToken:${{ secrets.NPM_TOKEN }}" > ~/.yarnrc.yml

- name: Publish ES PAckages
kobyhallx marked this conversation as resolved.
Show resolved Hide resolved
run: yarn publish:all

72 changes: 3 additions & 69 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,81 +65,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
inputs: '{ "tag": "${{ needs.release-please.outputs.tag-name }}", "publish": true }'

publish-wasm:
name: Publish noir_wasm package
publish-es-packages:
name: Publish ES packages
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to noir_wasm
uses: benc-uk/workflow-dispatch@v1
with:
workflow: publish-noir-wasm.yml
workflow: publish-es-packages.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}

publish-noir-js:
name: Publish noir_js package
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to noir_wasm
uses: benc-uk/workflow-dispatch@v1
with:
workflow: publish-noir-js.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}

publish-source-resolver:
name: Publish source resolver package
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to source resolver
uses: benc-uk/workflow-dispatch@v1
with:
workflow: publish-source-resolver.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}

publish-abi-wasm:
name: Dispatch to publish-abi_wasm workflow
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Trigger publish-abi_wasm.yml workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: publish-abi_wasm.yml
repo: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}" }'

publish-acvm:
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: publish-acvm.yml
ref: master
inputs: '{ "acvm-ref": "${{ needs.release-please.outputs.tag-name }}" }'

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: publish-acvm-js.yml
ref: master
inputs: '{ "acvm-ref": "${{ needs.release-please.outputs.tag-name }}" }'
3 changes: 2 additions & 1 deletion acvm-repo/acvm_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:browser": "web-test-runner",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
"clean": "chmod u+w web nodejs && rm -rf web nodejs"
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
Expand Down
1 change: 1 addition & 0 deletions compiler/source-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"test": "ava",
"generate-types": "tsc src/*.ts --declaration --emitDeclarationOnly --outDir types",
"clean": "rm -rf ./lib ./lib-node",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion compiler/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:browser": "web-test-runner",
"clean": "chmod u+w web nodejs && rm -rf ./nodejs ./web ./target ./result",
"clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
},
"peerDependencies": {
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
"install:from:nix: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",
"install:from:nix:noir_wasm": "cp -r ./result/noir_wasm/nodejs ./compiler/wasm && cp -r ./result/noir_wasm/web ./compiler/wasm",
"install:from:nix:acvm_js": "cp -rf ./result/acvm_js/nodejs ./acvm-repo/acvm_js && cp -rf ./result/acvm_js/web ./acvm-repo/acvm_js",
"install:from:nix": "yarn build:with:nix && yarn install:from:nix:noirc_abi_wasm && yarn install:from:nix:noir_wasm && yarn install:from:nix:acvm_js"
"install:from:nix": "yarn build:with:nix && yarn install:from:nix:noirc_abi_wasm && yarn install:from:nix:noir_wasm && yarn install:from:nix:acvm_js",
"build:types": "yarn workspace @noir-lang/types run build",
"build:source-resolver": "yarn workspace @noir-lang/source-resolver run build",
"build:backend_barretenberg": "yarn workspace @noir-lang/backend_barretenberg run build",
"build:noir_js": "yarn workspace @noir-lang/noir_js run build",
"build:js:only": "yarn build:types && yarn build:source-resolver && yarn build:backend_barretenberg && yarn build:noir_js",
"prepare:publish": "yarn clean && yarn install:from:nix && yarn build:js:only",
"publish:all": "yarn install && yarn workspaces foreach run publish"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.3",
Expand All @@ -38,7 +45,7 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"packageManager": "yarn@3.6.3",
"packageManager": "yarn@3.6.4",
kobyhallx marked this conversation as resolved.
Show resolved Hide resolved
"dependencies": {
"tslog": "^4.9.2"
}
Expand Down
1 change: 1 addition & 0 deletions tooling/noir_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"prettier": "prettier 'src/**/*.ts'",
"prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"clean": "rm -rf ./lib"
},
"devDependencies": {
Expand Down
21 changes: 12 additions & 9 deletions tooling/noir_js_backend_barretenberg/fixup.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/usr/bin/env bash

# Put these package.json files in the cjs and
# mjs directory respectively, so that
# tools can recognise that the .js files are either
# tools can recognise that the .js files are either
# commonjs or ESM files.
cat >lib/cjs/package.json <<!EOF
{
self_path=$(dirname "$(readlink -f "$0")")

cjs_package='{
"type": "commonjs"
}
!EOF
}'

cat >lib/esm/package.json <<!EOF
{
esm_package='{
"type": "module"
}
!EOF
}'

echo "$cjs_package" > $self_path/lib/cjs/package.json
echo "$esm_package" > $self_path/lib/esm/package.json
8 changes: 7 additions & 1 deletion tooling/noir_js_backend_barretenberg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
"default": "./lib/esm/index.js"
},
"types": "lib/esm/index.d.ts",
"files": [
"lib",
"package.json"
],
"scripts": {
"dev": "tsc --watch",
"build": "yarn clean && tsc && tsc -p ./tsconfig.cjs.json && ./fixup.sh",
"generate:package": "bash ./fixup.sh",
"build": "yarn clean && tsc && tsc -p ./tsconfig.cjs.json && yarn generate:package",
"clean": "rm -rf ./lib",
"prettier": "prettier 'src/**/*.ts'",
"prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions tooling/noir_js_types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"build:esm": "tsc",
"build:cjs": "tsc --module CommonJS --outDir lib/cjs",
"build": "yarn run build:cjs && yarn run build:esm",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
},
"exports": {
Expand Down
3 changes: 2 additions & 1 deletion tooling/noirc_abi_wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"build": "bash ./build.sh",
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test:browser": "web-test-runner",
"clean": "chmod u+w web nodejs && rm -rf ./nodejs ./web ./target ./result",
"clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
},
"devDependencies": {
Expand Down