Skip to content

Commit a91bf0f

Browse files
Merge pull request #57 from BitGo/BTC-0.debug-wasm-opt
fix: compilation issues due to rust-nightly
2 parents 233220b + 4e7c34b commit a91bf0f

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,35 @@ jobs:
2525
with:
2626
ref: ${{ github.event.pull_request.head.sha }}
2727

28-
- name: Setup node ${{ matrix.node-version }}
29-
uses: actions/setup-node@v3
30-
with:
31-
node-version: ${{ matrix.node-version }}
32-
3328
- name: Install Rust
3429
uses: dtolnay/rust-toolchain@v1
3530
with:
3631
toolchain: nightly
3732

33+
- name: Cache Rust dependencies
34+
uses: Swatinem/rust-cache@v2
35+
with:
36+
workspaces: "packages/wasm-miniscript"
37+
cache-on-failure: true
38+
39+
- name: Setup node ${{ matrix.node-version }}
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
3844
- name: Install wasm-pack
3945
run: |
4046
rustup component add rustfmt
41-
cargo install wasm-pack
47+
cargo install wasm-pack --version 0.13.1
48+
cargo install wasm-opt --version 0.116.1
4249
4350
- name: Build Info
4451
run: |
4552
echo "node $(node --version)"
4653
echo "npm $(npm --version)"
54+
echo "rustc $(rustc --version)"
55+
echo "wasm-pack $(wasm-pack --version)"
56+
echo "wasm-opt $(wasm-opt --version)"
4757
git --version
4858
echo "base ref $GITHUB_BASE_REF"
4959
echo "head ref $GITHUB_HEAD_REF"

packages/wasm-miniscript/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
WASM_PACK = wasm-pack
2+
WASM_OPT = wasm-opt
23
WASM_PACK_FLAGS = --no-pack --weak-refs
34

45
ifdef WASM_PACK_DEV
56
WASM_PACK_FLAGS += --dev
67
endif
78

89
define WASM_PACK_COMMAND
9-
$(WASM_PACK) build --out-dir $(1) $(WASM_PACK_FLAGS) --target $(2)
10+
$(WASM_PACK) build --no-opt --out-dir $(1) $(WASM_PACK_FLAGS) --target $(2)
11+
endef
12+
13+
# run wasm-opt separately so we can pass `--enable-bulk-memory`
14+
define WASM_OPT_COMMAND
15+
$(WASM_OPT) --enable-bulk-memory -Oz $(1)/*.wasm -o $(1)/*.wasm
1016
endef
1117

1218
define REMOVE_GITIGNORE
@@ -22,6 +28,7 @@ endef
2228
define BUILD
2329
rm -rf $(1)
2430
$(call WASM_PACK_COMMAND,$(1),$(2))
31+
$(call WASM_OPT_COMMAND,$(1))
2532
$(call REMOVE_GITIGNORE,$(1))
2633
$(call SHOW_WASM_SIZE,$(1))
2734
endef

0 commit comments

Comments
 (0)