Skip to content

Commit 0707b84

Browse files
committed
Update wasm build workflow with caching and better rust toolchain setup
1 parent c7b55ae commit 0707b84

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/build-wasm.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020

2121
env:
2222
VERSION: 0.1.${{ github.run_number }}
23+
CARGO_TERM_COLOR: always
2324

2425
jobs:
2526
build-wasm:
@@ -34,22 +35,34 @@ jobs:
3435
with:
3536
version: 'latest'
3637

37-
- name: Install latest nightly
38-
uses: actions-rs/toolchain@v1
38+
- name: Install rust toolchain nightly
39+
run: rustup override set nightly-2024-04-17
40+
41+
- name: Output rust version for verification
42+
run: rustup --version
43+
44+
- name: Add wasm32 target
45+
run: rustup target add wasm32-unknown-unknown
46+
47+
- name: Cache dependencies
48+
uses: actions/cache@v4
3949
with:
40-
toolchain: nightly-2024-04-16
41-
override: true
42-
components: rust-src
50+
path: |
51+
~/.cargo/registry
52+
~/.cargo/git
53+
wasm_binding/target
54+
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
4355

4456
- name: Build
4557
run: |
4658
cd wasm_binding && wasm-pack build --target web --release
4759
48-
- name: version
60+
- name: Add version info
4961
run: |
5062
echo ${VERSION}>wasm_binding/pkg/version.txt
5163
52-
- uses: actions/upload-artifact@v4
64+
- name: Upload wasm artifact
65+
uses: actions/upload-artifact@v4
5366
with:
5467
name: wasm
5568
path: wasm_binding/pkg

0 commit comments

Comments
 (0)