Skip to content

Commit cb9abc6

Browse files
committed
ci: run tests in other platforms (windows, wasm)
1 parent b71b5bb commit cb9abc6

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ on:
88

99
jobs:
1010
tests:
11-
runs-on: ubuntu-latest
11+
runs-on: "${{ matrix.platform.os }}-latest"
12+
strategy:
13+
matrix:
14+
platform: [
15+
{ os: "windows", target: "x86_64-pc-windows-msvc" },
16+
{ os: "ubuntu", target: "x86_64-unknown-linux-gnu" },
17+
{ os: "ubuntu", target: "wasm32-unknown-unknown" },
18+
]
1219
steps:
1320
- uses: actions/checkout@v2
1421
- name: Cache .cargo and target
@@ -23,15 +30,23 @@ jobs:
2330
uses: actions-rs/toolchain@v1
2431
with:
2532
toolchain: stable
33+
target: ${{ matrix.platform.target }}
2634
profile: minimal
2735
default: true
36+
- name: Install test runner for wasm
37+
if: matrix.platform.target == 'wasm32-unknown-unknown'
38+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
2839
- name: Stable Build
2940
uses: actions-rs/cargo@v1
3041
with:
3142
command: build
32-
args: --all-features
43+
args: --all-features --target ${{ matrix.platform.target }}
3344
- name: Tests
45+
if: matrix.platform.target != 'wasm32-unknown-unknown'
3446
uses: actions-rs/cargo@v1
3547
with:
3648
command: test
3749
args: --all-features
50+
- name: Tests in WASM
51+
if: matrix.platform.target == 'wasm32-unknown-unknown'
52+
run: wasm-pack test --node -- --all-features

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ edition = "2018"
88

99
[dependencies]
1010
thiserror = "1.0.24"
11+
12+
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
13+
wasm-bindgen-test = "0.3"

0 commit comments

Comments
 (0)