Skip to content
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
22 changes: 16 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,35 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "packages/wasm-miniscript"
cache-on-failure: true

- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install wasm-pack
run: |
rustup component add rustfmt
cargo install wasm-pack
cargo install wasm-pack --version 0.13.1
cargo install wasm-opt --version 0.116.1

- name: Build Info
run: |
echo "node $(node --version)"
echo "npm $(npm --version)"
echo "rustc $(rustc --version)"
echo "wasm-pack $(wasm-pack --version)"
echo "wasm-opt $(wasm-opt --version)"
git --version
echo "base ref $GITHUB_BASE_REF"
echo "head ref $GITHUB_HEAD_REF"
Expand Down
9 changes: 8 additions & 1 deletion packages/wasm-miniscript/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
WASM_PACK = wasm-pack
WASM_OPT = wasm-opt
WASM_PACK_FLAGS = --no-pack --weak-refs

ifdef WASM_PACK_DEV
WASM_PACK_FLAGS += --dev
endif

define WASM_PACK_COMMAND
$(WASM_PACK) build --out-dir $(1) $(WASM_PACK_FLAGS) --target $(2)
$(WASM_PACK) build --no-opt --out-dir $(1) $(WASM_PACK_FLAGS) --target $(2)
endef

# run wasm-opt separately so we can pass `--enable-bulk-memory`
define WASM_OPT_COMMAND
$(WASM_OPT) --enable-bulk-memory -Oz $(1)/*.wasm -o $(1)/*.wasm
endef

define REMOVE_GITIGNORE
Expand All @@ -22,6 +28,7 @@ endef
define BUILD
rm -rf $(1)
$(call WASM_PACK_COMMAND,$(1),$(2))
$(call WASM_OPT_COMMAND,$(1))
$(call REMOVE_GITIGNORE,$(1))
$(call SHOW_WASM_SIZE,$(1))
endef
Expand Down