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

feat: publish aztec build of noir_wasm #3049

Merged
merged 5 commits into from
Oct 10, 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
28 changes: 21 additions & 7 deletions .github/workflows/publish-es-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ on:
noir-ref:
description: The noir reference to checkout
required: false
nightly:
description: Indicates this is a nightly release
npm-tag:
description: Repository Tag to publish under
required: false
type: boolean
default: true
default: 'nightly'

run-name: Publish ES Packages from ${{ inputs.noir-ref }} under @${{ inputs.npm-tag }} tag.

jobs:
build-noir_wasm:
Expand All @@ -28,6 +29,11 @@ jobs:
nix-cache-name: ${{ vars.NIX_CACHE_NAME }}
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }}

- name: Enable aztec features
if: ${{ inputs.npm-tag == 'aztec' }}
run: |
echo "\ndefault = [\"aztec\"]" >> compiler/noirc_frontend/Cargo.toml
- name: Build wasm package
run: |
nix build -L .#noir_wasm
Expand Down Expand Up @@ -89,17 +95,25 @@ jobs:
- name: Install Yarn dependencies
run: yarn install

- name: Enable aztec features
if: ${{ inputs.npm-tag == 'aztec' }}
run: |
echo "\ndefault = [\"aztec\"]" >> compiler/noirc_frontend/Cargo.toml
- name: Build ES Packages
run: yarn prepare:publish

- name: Prepare nightly version
if: ${{ inputs.nightly }}
if: ${{ inputs.npm-tag != 'latest' }}
run: |
sudo apt-get install jq
yarn nightly:version
- name: Update Version as specific tag
run: |
jq '.version = .version + "-${{ inputs.npm-tag }}"' package.json > package-tmp.json && mv package-tmp.json package.json
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
- name: Authenticate with npm
run: "echo npmAuthToken: ${{ secrets.NPM_TOKEN }} > ~/.yarnrc.yml"

- name: Publish ES Packages
run: yarn publish:all --access public ${{ inputs.nightly && ' --tag nightly' }}
run: yarn publish:all --access public --tag ${{ inputs.npm-tag }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
with:
workflow: publish-es-packages.yml
token: ${{ secrets.NOIR_REPO_TOKEN }}
inputs: "{ \"noir-ref\": \"${{ env.GITHUB_REF }}\", \"nightly\": true }"
inputs: "{ \"noir-ref\": \"${{ env.GITHUB_REF }}\", \"npm-tag\": \"nightly\" }"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ jobs:
workflow: publish-es-packages.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}
inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "nightly": false }'
inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "npm-tag": "latest" }'
2 changes: 1 addition & 1 deletion compiler/wasm/buildPhaseCargoCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NODE_WASM=${NODE_DIR}/${pname}_bg.wasm
BROWSER_WASM=${BROWSER_DIR}/${pname}_bg.wasm

# Build the new wasm package
run_or_fail cargo build --lib --release --target $TARGET --package ${pname}
run_or_fail cargo build --lib --release --target $TARGET --package ${pname} ${cargoExtraArgs}
run_or_fail wasm-bindgen $WASM_BINARY --out-dir $NODE_DIR --typescript --target nodejs
run_or_fail wasm-bindgen $WASM_BINARY --out-dir $BROWSER_DIR --typescript --target web
run_if_available wasm-opt $NODE_WASM -o $NODE_WASM -O
Expand Down
4 changes: 1 addition & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,13 @@
doCheck = false;
});

noir_wasm = craneLib.buildPackage (wasmConfig // rec {
noir_wasm = craneLib.buildPackage (wasmConfig // {
pname = "noir_wasm";

inherit GIT_COMMIT GIT_DIRTY;

cargoArtifacts = noir-wasm-cargo-artifacts;

cargoExtraArgs = "--package ${pname} --target wasm32-unknown-unknown";

buildPhaseCargoCommand = ''
bash compiler/wasm/buildPhaseCargoCommand.sh release
'';
Expand Down
Loading