Skip to content

Commit 3ce3898

Browse files
authored
chore: remove wasm pack (#1556)
* fix: wasm32 unused warnings
1 parent 14f8937 commit 3ce3898

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

.github/workflows/beta-preflight.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,26 @@ jobs:
200200
- name: Install Rust toolchain
201201
uses: dtolnay/rust-toolchain@beta
202202

203-
- name: Install wasm-pack
204-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
203+
- name: Set up Chrome
204+
uses: browser-actions/setup-chrome@v2
205+
with:
206+
chrome-version: 142
207+
install-chromedriver: true
208+
209+
- name: Add wasm web target
210+
run: rustup target add wasm32-unknown-unknown
211+
212+
- name: Install cargo-binstall
213+
uses: cargo-bins/cargo-binstall@main
214+
215+
- name: Install wasm-bindgen-cli
216+
run: cargo binstall -y wasm-bindgen-cli --version 0.2.105
205217

206218
- name: Run Wasm tests
207-
run: wasm-pack test --chrome --headless
208-
working-directory: ./sdk
219+
run: cargo test -p c2pa --no-default-features --features rust_native_crypto,fetch_remote_manifests --target wasm32-unknown-unknown
220+
env:
221+
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner
222+
WASM_BINDGEN_TEST_TIMEOUT: 60
209223

210224
clippy_check:
211225
name: Clippy

.github/workflows/ci.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,24 @@ jobs:
300300
uses: dtolnay/rust-toolchain@stable
301301

302302
- name: Set up Chrome
303-
id: setup-chrome
304303
uses: browser-actions/setup-chrome@v2
305304
with:
306305
chrome-version: 142
307306
install-chromedriver: true
308307

309-
- name: Install wasm-pack
310-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
308+
- name: Add wasm web target
309+
run: rustup target add wasm32-unknown-unknown
310+
311+
- name: Install cargo-binstall
312+
uses: cargo-bins/cargo-binstall@main
313+
314+
- name: Install wasm-bindgen-cli
315+
run: cargo binstall -y wasm-bindgen-cli --version 0.2.105
311316

312317
- name: Run Wasm tests
313-
run: wasm-pack test --chrome --chromedriver ${{ steps.setup-chrome.outputs.chromedriver-path }} --headless --no-default-features --features rust_native_crypto,fetch_remote_manifests
314-
working-directory: ./sdk
318+
run: cargo test -p c2pa --no-default-features --features rust_native_crypto,fetch_remote_manifests --target wasm32-unknown-unknown
315319
env:
320+
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner
316321
WASM_BINDGEN_TEST_TIMEOUT: 60
317322

318323
benchmarks:

sdk/src/crypto/cose/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ pub use sign1::{
4545
};
4646

4747
mod sigtst;
48+
#[cfg(not(target_arch = "wasm32"))]
49+
pub(crate) use sigtst::timestamptoken_from_timestamprsp;
4850
pub(crate) use sigtst::{
49-
add_sigtst_header, add_sigtst_header_async, timestamptoken_from_timestamprsp,
50-
validate_cose_tst_info, validate_cose_tst_info_async,
51+
add_sigtst_header, add_sigtst_header_async, validate_cose_tst_info,
52+
validate_cose_tst_info_async,
5153
};
5254

5355
mod time_stamp_storage;

sdk/src/reader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,10 @@ pub mod tests {
11921192
}
11931193

11941194
#[test]
1195-
#[cfg(not(target_os = "wasi"))] // todo: enable when disable we find out wasi trust issues
11961195
fn test_reader_trusted() -> Result<()> {
1196+
#[cfg(target_os = "wasi")]
1197+
Settings::reset().unwrap();
1198+
11971199
let reader =
11981200
Reader::from_stream("image/jpeg", std::io::Cursor::new(IMAGE_COMPLEX_MANIFEST))?;
11991201
assert_eq!(reader.validation_state(), ValidationState::Trusted);

sdk/src/store.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ impl Store {
483483
placeholder
484484
}
485485

486+
#[cfg(not(target_arch = "wasm32"))]
486487
fn get_cose_sign1_signature(&self, manifest_id: &str) -> Option<Vec<u8>> {
487488
let manifest = self.get_claim(manifest_id)?;
488489

0 commit comments

Comments
 (0)