Skip to content

Commit c41047e

Browse files
committed
Run tests on the WASM package as part of the GitHub workflow
1 parent 5cc13d7 commit c41047e

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.github/workflows/rust_ci.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "ironfish-phase2/**"
77
- "ironfish-rust/**"
88
- "ironfish-rust-nodejs/**"
9+
- "ironfish-rust-wasm/**"
910
- "ironfish-zkp/**"
1011
- "rust-toolchain"
1112
- ".github/workflows/rust*"
@@ -20,6 +21,7 @@ on:
2021
- "ironfish-phase2/**"
2122
- "ironfish-rust/**"
2223
- "ironfish-rust-nodejs/**"
24+
- "ironfish-rust-wasm/**"
2325
- "ironfish-zkp/**"
2426
- "rust-toolchain"
2527
- ".github/workflows/rust*"
@@ -48,11 +50,14 @@ jobs:
4850
- name: Check for license headers for ironfish-rust-nodejs
4951
run: ./ci/lintHeaders.sh ./ironfish-rust-nodejs/src *.rs
5052

51-
- name: "`cargo fmt` check on ironfish-rust"
53+
- name: Check for license headers for ironfish-rust-wasm
54+
run: ./ci/lintHeaders.sh ./ironfish-rust-wasm/src *.rs
55+
56+
- name: cargo fmt
5257
run: |
5358
cargo fmt --all -- --check
5459
55-
- name: "Clippy check on ironfish-rust"
60+
- name: cargo clippy
5661
run: |
5762
cargo clippy --all-targets --all-features -- -D warnings
5863
@@ -220,3 +225,29 @@ jobs:
220225
with:
221226
token: ${{secrets.CODECOV_TOKEN}}
222227
flags: ironfish-zkp
228+
229+
ironfish_wasm:
230+
name: Test ironfish-rust-wasm
231+
runs-on: ubuntu-latest
232+
steps:
233+
- uses: actions/checkout@v4
234+
235+
- name: Cache Rust
236+
uses: Swatinem/rust-cache@v2
237+
with:
238+
shared-key: wasm
239+
240+
- name: Install wasm-pack
241+
# use the installation method reccommended on
242+
# https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/continuous-integration.html#github-actions
243+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
244+
245+
- name: Run tests in Firefox
246+
run: |
247+
cd ironfish-rust-wasm
248+
wasm-pack test --headless --firefox
249+
250+
- name: Run tests in Chrome
251+
run: |
252+
cd ironfish-rust-wasm
253+
wasm-pack test --headless --chrome

ironfish-rust-wasm/src/errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4+
15
use wasm_bindgen::prelude::*;
26

37
#[wasm_bindgen]

ironfish-rust-wasm/src/primitives.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4+
15
use crate::errors::IronfishError;
26
use group::GroupEncoding;
37
use ironfish::errors::IronfishErrorKind;

0 commit comments

Comments
 (0)