-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): update noir to build wasm with a nix flake file (#1208)
* wip * Change repo link * Update workflow * Use jq * Fix yarn * Dependency test * Create noir-script.json * Implement nix/cachix * Update path * Fix path * Change branch for noir-wasm-testing * Update workflow * Remove comment * Fix import * Symlink * Test fix * Output nix result * Revert and build wasm with build-wasm * Fix path * Debug * Test flake * Fix package * implements nix to build-wasm, testing * Run build-wasm * Change path * Update bash file * Output contents * Use wasm-pack again * Change quotes * Revert build-wasm * Update yml to use flake * Fix relative path * Print directory * Update path for wasm-pack * Add chmod * Update buildPhase * Try to fix path * Fix jq path * Fix jq * Fix missing commands * Change buildInputs * Fix missing improts * Install jq * Fix imports * Add dependencies to flake nix file * Debug errors * Debugging wip * Add install wasm step * Debugging * Remove wasm-pack installation on workflow * Ensure logging * Output full logs to a file * Log when failure happens * Typo * Fix logging * Remove workflow step * Debug wip * Debug wip * Stop on failure * Trying to output debug information * Fix path * Fix output file * Fix * Use xtracefd flag * Accidentally removed installPhase * Change workflow * Print from flake * Revert build stage * Remove output from noir_wasm build stage * Revert logging * Further logging tests * Trying experimental features * Other config * Remove experimental config * Remove logs * Output build log file location * Log out Hello World file from nix to workflow * Output hello_world.txt * Add else * Copy file from nix to workflow * Fix flake run * Change hello world to build log * Revert build-wasm * Output build-wasm build * Print all files in build-wasm * Add verbose on wasm-pack * Add which wasm-pack * Replace which with command -v * Manually generate output folders * Add debug flag * Remove further comments * Output wasm-pack version * Output rustc version * Add rustc to build inputs * Set up dev flag * Fix src path * add wasm32 target * wip - fix for section too large error * progress: build with wasm-pack * Downgrade wasm-bindgen - wip * chore: building with correct versions * choir: rely on stock wasm-binden-cli * Cleanup, implement build on flake file * Fix conditional * Test workflow * Edit workflow * Fix workflow * Test fix * Clone nodejs * Fix copy * Add recursive step to copy * Fix output * Remove noir_wasm publish step * Fix branch name * Remove condition on dispatch-noir_wasm * Update cargoArtifacts name * Remove wasm workflow, now noir_wasm runs the flake * Comment all the release workflow except for the dispatch * Readd wasm workflow * Typo * Remove wasm-pack * Update script * Update script * Update targets * wip - changes to build * Fix build * Fix link * Remove unused scripts * Update Cargo.lock * Update wasm-bindgen * Update flake lock * Update wasm-bindgen-cli to 0.2.86 * Rollback flake.lock changes * Rollback Cargo.lock changes * Remove space * Rollback flake.lock * Update packages (Cargo.lock) * Remove nix build flags * Kh noir wasm nix flake (#1657) * chore: ignoring output dir * chore: refactor noir_wasm package build * Uncomment workflows * Revert workflow changes * Revert workflow * Remove unfinished testing workflow * Remove output from build wasm package * Revision * Split nix flake * Add preBuild and postBuild to build.sh * Remove cleanCargoSource * Remove preBuild * Removes package.json generation on installPhase * Remove package version extraction from cargo.toml * Readd preBuild (not in flake) * Remove extra --release flag * Add package.json, output debug info * Add package.json for noir_wasm * Fix package.json path * Bump package version * Fix path * Fix path * Output debug info * Fix order on workflow * Run release-please on wasm workflow * Fix wasm and release workflows * Update crates/wasm/README.md Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com> * Update .github/workflows/wasm.yml Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com> * Update flake.nix Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com> * Update release-please-config.json Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com> * Fix README.md * some todos * remove duplicated props * Change browser for web on path --------- Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com> Co-authored-by: kobyhallx <kobyhall@proton.me> Co-authored-by: Koby Hall <102518238+kobyhallx@users.noreply.github.com>
- Loading branch information
1 parent
97d6747
commit 2209369
Showing
16 changed files
with
209 additions
and
85 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
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ node_modules | |
pkg/ | ||
|
||
# Nix stuff | ||
**/outputs | ||
result | ||
.envrc.local | ||
.direnv/ | ||
|
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,4 @@ | ||
{ | ||
".": "0.6.0", | ||
"crates/wasm": "0.6.0" | ||
} |
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
function require_command { | ||
if ! command -v "$1" >/dev/null 2>&1; then | ||
echo "Error: $1 is required but not installed." >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_command toml2json | ||
require_command jq | ||
require_command cargo | ||
require_command wasm-bindgen | ||
require_command wasm-opt | ||
|
||
export pname=$(toml2json < Cargo.toml | jq -r .package.name) | ||
|
||
./preBuild.sh | ||
cargo build --lib --release --package noir_wasm --target wasm32-unknown-unknown | ||
./postBuild.sh | ||
./installPhase.sh | ||
|
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p $out | ||
cp README.md $out/ | ||
cp ./crates/wasm/package.json $out/ | ||
cp -r ./pkg/* $out/ |
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,23 @@ | ||
{ | ||
"name": "@noir-lang/noir_wasm", | ||
"collaborators": [ | ||
"The Noir Team <team@noir-lang.org>" | ||
], | ||
"version": "0.6.0", | ||
"files": [ | ||
"nodejs", | ||
"web", | ||
"package.json" | ||
], | ||
"main": "./nodejs/noir_wasm.js", | ||
"types": "./web/noir_wasm.d.ts", | ||
"module": "./web/noir_wasm.js", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"@noir-lang/noir-source-resolver": "1.1.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/noir-lang/noir_wasm.git" | ||
} | ||
} |
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
# TODO: Handle the wasm target being built in release mode | ||
WASM_BINARY=./target/wasm32-unknown-unknown/release/${pname}.wasm | ||
NODE_WASM=./pkg/nodejs/${pname}_bg.wasm | ||
BROWSER_WASM=./pkg/web/${pname}_bg.wasm | ||
|
||
wasm-bindgen $WASM_BINARY --out-dir ./pkg/nodejs --typescript --target nodejs | ||
wasm-bindgen $WASM_BINARY --out-dir ./pkg/web --typescript --target web | ||
wasm-opt $NODE_WASM -o $NODE_WASM -O | ||
wasm-opt $BROWSER_WASM -o $BROWSER_WASM -O |
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Clear out the existing build artifacts as these aren't automatically removed by wasm-pack. | ||
if [ -d ./pkg/ ]; then | ||
rm -rf ./pkg/ | ||
fi |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"bootstrap-sha": "63d84a30fcbc117443cd3b404e872cb3c2f26111", | ||
"release-type": "simple", | ||
"bump-minor-pre-major": true, | ||
"bump-patch-for-minor-pre-major": true, | ||
"prerelease": true, | ||
"group-pull-request-title-pattern": "chore(noir): Release ${version}", | ||
"packages": { | ||
".": { | ||
"release-type": "simple", | ||
"component": "root", | ||
"extra-files": ["Cargo.toml", "flake.nix"] | ||
}, | ||
"crates/wasm": { | ||
"release-type": "node", | ||
"component": "noir_wasm" | ||
} | ||
}, | ||
"plugins": [ | ||
{ | ||
"type": "linked-versions", | ||
"groupName": "noir", | ||
"components": ["root", "noir_wasm"] | ||
} | ||
] | ||
} |
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,37 @@ | ||
{ lib | ||
, rustPlatform | ||
, fetchCrate | ||
, nodejs | ||
, pkg-config | ||
, openssl | ||
, stdenv | ||
, curl | ||
, darwin | ||
, runCommand | ||
}: | ||
|
||
rustPlatform.buildRustPackage rec { | ||
pname = "wasm-bindgen-cli"; | ||
version = "0.2.86"; | ||
|
||
src = fetchCrate { | ||
inherit pname version; | ||
sha256 = "sha256-56EOiLbdgAcoTrkyvB3t9TjtLaRvGxFUXx4haLwE2QY="; | ||
}; | ||
|
||
cargoSha256 = "sha256-4CPBmz92PuPN6KeGDTdYPAf5+vTFk9EN5Cmx4QJy6yI="; | ||
|
||
nativeBuildInputs = [ pkg-config ]; | ||
|
||
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ curl darwin.apple_sdk.frameworks.Security ]; | ||
|
||
doCheck = false; | ||
|
||
meta = with lib; { | ||
homepage = "https://rustwasm.github.io/docs/wasm-bindgen/"; | ||
license = with licenses; [ asl20 /* or */ mit ]; | ||
description = "Facilitating high-level interactions between wasm modules and JavaScript"; | ||
maintainers = with maintainers; [ nitsky rizary ]; | ||
mainProgram = "wasm-bindgen"; | ||
}; | ||
} |