Skip to content

Commit a672056

Browse files
authored
Merge pull request #256 from Emurgo/ruslan/split-test-and-build-checks
Fixing GH-checks to run the build properly + Fixing `rand` dependency wasm support
2 parents 5328a28 + 9948df4 commit a672056

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

.github/workflows/pr-checks.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [submitted]
66

77
jobs:
8-
test:
8+
test-and-build:
99
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check'))
1010
runs-on: ubuntu-latest
1111
steps:
@@ -24,6 +24,11 @@ jobs:
2424
${{ runner.os }}-build-${{ env.cache-name }}-
2525
${{ runner.os }}-build-
2626
${{ runner.os }}-
27+
- name: prepare-rust
28+
run: |
29+
rustup install stable
30+
rustup target add wasm32-unknown-unknown --toolchain stable
31+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
2732
- name: install
2833
run: |
2934
npm install
@@ -33,3 +38,6 @@ jobs:
3338
- name: rust:build-nodejs
3439
run: |
3540
npm run rust:build-nodejs
41+
- name: rust:build-browser
42+
run: |
43+
npm run rust:build-browser

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "9.1.2",
44
"description": "(De)serialization functions for the Cardano blockchain along with related utility functions",
55
"scripts": {
6-
"rust:build-nodejs": "rimraf ./rust/pkg && cd rust; wasm-pack build --target=nodejs; wasm-pack pack; cd .. && npm run js:flowgen",
7-
"rust:build-browser": "rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser; wasm-pack pack; cd .. && npm run js:flowgen",
8-
"rust:build-web": "rimraf ./rust/pkg && cd rust; wasm-pack build --target=web; wasm-pack pack; cd .. && npm run js:flowgen",
9-
"rust:build-asm": "rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser --release; wasm-pack pack && npm run asm:build && npm run js:flowgen",
6+
"rust:build-nodejs": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=nodejs; wasm-pack pack) && npm run js:flowgen",
7+
"rust:build-browser": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser; wasm-pack pack) && npm run js:flowgen",
8+
"rust:build-web": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=web; wasm-pack pack) && npm run js:flowgen",
9+
"rust:build-asm": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser; wasm-pack pack) && npm run asm:build && npm run js:flowgen",
1010
"rust:publish": "cd rust && cargo publish && cd ../",
1111
"asm:build": "./binaryen/bin/wasm2js ./rust/pkg/cardano_serialization_lib_bg.wasm --output ./rust/pkg/cardano_serialization_lib.asm.js && node ./scripts/wasm-to-asm",
1212
"rust:test": "(cd rust; cargo test)",

rust/Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ num-bigint = "0.4.0"
3030
# feature or this one
3131
clear_on_drop = { version = "0.2", features = ["no_cc"] }
3232
itertools = "0.10.1"
33+
getrandom = { version = "0.2.3", features = ["js"] }
3334
rand = "0.8.4"
3435

3536
# non-wasm

0 commit comments

Comments
 (0)