Skip to content

Commit

Permalink
chore: Integrate noir.js into workspace and CI release workflow (#2705)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray authored Sep 15, 2023
1 parent e1687c9 commit f0032bb
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 5 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/noir-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,39 @@ jobs:
- 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
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ jobs:
token: ${{ secrets.NOIR_REPO_TOKEN }}
inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}" }'

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: noir-js.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}

dispatch-publish-abi-wasm:
name: Dispatch to publish-abi_wasm workflow
needs: [release-please]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ compiler/source-resolver/node_modules
compiler/source-resolver/lib
compiler/source-resolver/lib-node

# Noir.js
tooling/noir_js/lib

# Nix stuff
**/outputs
result
Expand Down
5 changes: 5 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"type": "json",
"path": "tooling/noirc_abi_wasm/package.json",
"jsonpath": "$.version"
},
{
"type": "json",
"path": "tooling/noir_js/package.json",
"jsonpath": "$.version"
}
]
}
Expand Down
12 changes: 12 additions & 0 deletions tooling/noir_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,17 @@
"dependencies": {
"@noir-lang/acvm_js": "0.26.1",
"@noir-lang/noirc_abi": "workspace:*"
},
"files": [
"lib",
"package.json"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc"
},
"devDependencies": {
"typescript": "^5.2.2"
}
}
File renamed without changes.
14 changes: 14 additions & 0 deletions tooling/noir_js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "esnext",
"declaration": true,
"emitDeclarationOnly": false,
"module": "ESNext",
"moduleResolution": "node",
"outDir": "./lib",
"esModuleInterop": true,
"strict": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion tooling/noirc_abi_wasm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rm -rf $self_path/result >/dev/null 2>&1
if [ -v out ]; then
echo "Will install package to $out (defined outside installPhase.sh script)"
else
out="$self_path/outputs/out"
export out="$self_path/outputs/out"
echo "Will install package to $out"
fi

Expand Down
5 changes: 3 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ __metadata:
dependencies:
"@noir-lang/acvm_js": 0.26.1
"@noir-lang/noirc_abi": "workspace:*"
typescript: ^5.2.2
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -7085,7 +7086,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.0.4":
"typescript@npm:^5.0.4, typescript@npm:^5.2.2":
version: 5.2.2
resolution: "typescript@npm:5.2.2"
bin:
Expand All @@ -7105,7 +7106,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>":
"typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>, typescript@patch:typescript@^5.2.2#~builtin<compat/typescript>":
version: 5.2.2
resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin<compat/typescript>::version=5.2.2&hash=f3b441"
bin:
Expand Down

0 comments on commit f0032bb

Please sign in to comment.