Skip to content

Commit

Permalink
Run tests on the WASM package as part of the GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andiflabs committed Nov 13, 2024
1 parent 5cc13d7 commit c41047e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
35 changes: 33 additions & 2 deletions .github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "ironfish-phase2/**"
- "ironfish-rust/**"
- "ironfish-rust-nodejs/**"
- "ironfish-rust-wasm/**"
- "ironfish-zkp/**"
- "rust-toolchain"
- ".github/workflows/rust*"
Expand All @@ -20,6 +21,7 @@ on:
- "ironfish-phase2/**"
- "ironfish-rust/**"
- "ironfish-rust-nodejs/**"
- "ironfish-rust-wasm/**"
- "ironfish-zkp/**"
- "rust-toolchain"
- ".github/workflows/rust*"
Expand Down Expand Up @@ -48,11 +50,14 @@ jobs:
- name: Check for license headers for ironfish-rust-nodejs
run: ./ci/lintHeaders.sh ./ironfish-rust-nodejs/src *.rs

- name: "`cargo fmt` check on ironfish-rust"
- name: Check for license headers for ironfish-rust-wasm
run: ./ci/lintHeaders.sh ./ironfish-rust-wasm/src *.rs

- name: cargo fmt
run: |
cargo fmt --all -- --check
- name: "Clippy check on ironfish-rust"
- name: cargo clippy
run: |
cargo clippy --all-targets --all-features -- -D warnings
Expand Down Expand Up @@ -220,3 +225,29 @@ jobs:
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: ironfish-zkp

ironfish_wasm:
name: Test ironfish-rust-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: wasm

- name: Install wasm-pack
# use the installation method reccommended on
# https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/continuous-integration.html#github-actions
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Run tests in Firefox
run: |
cd ironfish-rust-wasm
wasm-pack test --headless --firefox
- name: Run tests in Chrome
run: |
cd ironfish-rust-wasm
wasm-pack test --headless --chrome
4 changes: 4 additions & 0 deletions ironfish-rust-wasm/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
Expand Down
4 changes: 4 additions & 0 deletions ironfish-rust-wasm/src/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use crate::errors::IronfishError;
use group::GroupEncoding;
use ironfish::errors::IronfishErrorKind;
Expand Down

0 comments on commit c41047e

Please sign in to comment.