diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8647ac90..b80b12e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,19 @@ jobs: version: "23.3" repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run clippy + - name: Install wasm Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + target: wasm32-unknown-unknown + + - name: Run clippy for native run: cargo clippy --all --all-targets -- -D warnings + - name: Run clippy for wasm32 + run: cargo clippy --all --all-targets --target=wasm32-unknown-unknown -- -D warnings + fmt: runs-on: ubuntu-latest @@ -68,6 +78,9 @@ jobs: - name: Test node crate run: wasm-pack test --headless --chrome node + - name: Test node-wasm crate + run: wasm-pack test --headless --chrome node-wasm + - name: Build and pack node-wasm run: wasm-pack build --release --target web node-wasm && wasm-pack pack node-wasm diff --git a/rpc/tests/blob.rs b/rpc/tests/blob.rs index e2d2fed6..e2affbd6 100644 --- a/rpc/tests/blob.rs +++ b/rpc/tests/blob.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_arch = "wasm32"))] + use std::time::Duration; use celestia_rpc::prelude::*; diff --git a/rpc/tests/header.rs b/rpc/tests/header.rs index 4c91594f..304e8228 100644 --- a/rpc/tests/header.rs +++ b/rpc/tests/header.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_arch = "wasm32"))] + use celestia_rpc::prelude::*; pub mod utils; diff --git a/rpc/tests/p2p.rs b/rpc/tests/p2p.rs index d7e78cf5..e7deaccb 100644 --- a/rpc/tests/p2p.rs +++ b/rpc/tests/p2p.rs @@ -1,4 +1,4 @@ -#![cfg(feature = "p2p")] +#![cfg(all(not(target_arch = "wasm32"), feature = "p2p"))] use crate::utils::client::{new_test_client, AuthLevel}; use celestia_rpc::prelude::*; use celestia_types::p2p; diff --git a/rpc/tests/share.rs b/rpc/tests/share.rs index fcf68db8..b08efd37 100644 --- a/rpc/tests/share.rs +++ b/rpc/tests/share.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_arch = "wasm32"))] + use celestia_rpc::prelude::*; use celestia_types::consts::appconsts::{ CONTINUATION_SPARSE_SHARE_CONTENT_SIZE, FIRST_SPARSE_SHARE_CONTENT_SIZE, SEQUENCE_LEN_BYTES, diff --git a/rpc/tests/state.rs b/rpc/tests/state.rs index ab5d5ecc..ce80dab6 100644 --- a/rpc/tests/state.rs +++ b/rpc/tests/state.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_arch = "wasm32"))] + use celestia_rpc::prelude::*; pub mod utils; diff --git a/rpc/tests/utils/mod.rs b/rpc/tests/utils/mod.rs index bfe148d2..8755e6ed 100644 --- a/rpc/tests/utils/mod.rs +++ b/rpc/tests/utils/mod.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_arch = "wasm32"))] + use celestia_types::nmt::{Namespace, NS_ID_V0_SIZE}; use rand::{Rng, RngCore};