File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff 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"
Original file line number Diff line number Diff line change 11WASM_PACK = wasm-pack
2+ WASM_OPT = wasm-opt
23WASM_PACK_FLAGS = --no-pack --weak-refs
34
45ifdef WASM_PACK_DEV
56 WASM_PACK_FLAGS += --dev
67endif
78
89define 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
1016endef
1117
1218define REMOVE_GITIGNORE
2228define 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 ) )
2734endef
You can’t perform that action at this time.
0 commit comments