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: Integrate noir.js into workspace and CI release workflow #2705

Merged
merged 20 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
kevaundray marked this conversation as resolved.
Show resolved Hide resolved
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
kevaundray marked this conversation as resolved.
Show resolved Hide resolved
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",
kevaundray marked this conversation as resolved.
Show resolved Hide resolved
"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": {
kevaundray marked this conversation as resolved.
Show resolved Hide resolved
"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"
kevaundray marked this conversation as resolved.
Show resolved Hide resolved
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