-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: simplify ES workspace build and publish (#2989)
Co-authored-by: kevaundray <[email protected]>
- Loading branch information
1 parent
5ea522b
commit 054047e
Showing
13 changed files
with
153 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Setup Nix | ||
description: Installs and setups Nix components | ||
|
||
inputs: | ||
github-token: | ||
description: 'Github Access Token' | ||
required: true | ||
nix-cache-name: | ||
description: 'Name of the Cachix cache to use' | ||
required: true | ||
cachix-auth-token: | ||
description: 'Cachix Auth Token' | ||
required: true | ||
|
||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: cachix/install-nix-action@v22 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-23.05 | ||
github_access_token: ${{ inputs.github-token }} | ||
|
||
- uses: cachix/cachix-action@v12 | ||
with: | ||
name: ${{ inputs.nix-cache-name }} | ||
authToken: ${{ inputs.cachix-auth-token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Publish Noir ES Packages | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-noir_wasm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Nix | ||
uses: ./.github/actions/nix | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
nix-cache-name: ${{ vars.NIX_CACHE_NAME }} | ||
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} | ||
|
||
- name: Build wasm package | ||
run: | | ||
nix build -L .#noir_wasm | ||
build-noirc_abi_wasm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Nix | ||
uses: ./.github/actions/nix | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
nix-cache-name: ${{ vars.NIX_CACHE_NAME }} | ||
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} | ||
|
||
- name: Build wasm package | ||
run: | | ||
nix build -L .#noirc_abi_wasm | ||
build-acvm_js: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Nix | ||
uses: ./.github/actions/nix | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
nix-cache-name: ${{ vars.NIX_CACHE_NAME }} | ||
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} | ||
|
||
- name: Build wasm package | ||
run: | | ||
nix build -L .#acvm_js | ||
publish-es-packages: | ||
runs-on: ubuntu-latest | ||
needs: [build-acvm_js, build-noirc_abi_wasm, build-noir_wasm] | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Nix | ||
uses: ./.github/actions/nix | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
nix-cache-name: ${{ vars.NIX_CACHE_NAME }} | ||
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} | ||
|
||
- 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 | ||
run: yarn publish:all --access public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,17 @@ | |
"clean": "yarn clean:workspaces && yarn clean:root", | ||
"lint": "yarn workspaces foreach --verbose run lint", | ||
"build:with:nix": "nix build -L .#all_wasm", | ||
"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:noirc_abi_wasm": "cp -rL ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm && cp -rL ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm", | ||
"install:from:nix:noir_wasm": "cp -rL ./result/noir_wasm/nodejs ./compiler/wasm && cp -rL ./result/noir_wasm/web ./compiler/wasm", | ||
"install:from:nix:acvm_js": "cp -rL ./result/acvm_js/nodejs ./acvm-repo/acvm_js && cp -rL ./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", | ||
"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", | ||
|
@@ -38,7 +45,7 @@ | |
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
}, | ||
"packageManager": "[email protected].3", | ||
"packageManager": "[email protected].4", | ||
"dependencies": { | ||
"tslog": "^4.9.2" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters