Skip to content

Commit dd52f23

Browse files
authored
fix: Reset settings after test_stream_thumbnail (#1339)
* fix: Reset settings after test_stream_thumbnail Wasm is single threaded and runs tests in sequence. * Add WASI back into CI.
1 parent 4a0745f commit dd52f23

File tree

3 files changed

+51
-61
lines changed

3 files changed

+51
-61
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,55 @@ jobs:
311311
env:
312312
WASM_BINDGEN_TEST_TIMEOUT: 60
313313

314+
tests-wasi:
315+
name: Unit tests (WASI)
316+
needs: get-features
317+
if: contains(github.event.pull_request.labels.*.name, 'release') || contains(github.event.pull_request.labels.*.name, 'check-release')
318+
runs-on: ubuntu-latest
319+
320+
steps:
321+
- name: Checkout repository
322+
uses: actions/checkout@v4
323+
324+
# nightly required for testing until this issue is resolved:
325+
# wasip2 target should not conditionally feature gate stdlib APIs rust-lang/rust#130323 https://github.com/rust-lang/rust/issues/130323
326+
- name: Install Rust toolchain
327+
uses: dtolnay/rust-toolchain@master
328+
with:
329+
toolchain: nightly-2025-08-25
330+
331+
- name: Install wasmtime
332+
run: |
333+
curl https://wasmtime.dev/install.sh -sSf | bash
334+
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
335+
336+
- name: Install WASI SDK
337+
run: |
338+
if [ "${RUNNER_ARCH}" = "X64" ]; then
339+
ARCH="x86_64";
340+
else
341+
ARCH="${RUNNER_ARCH}";
342+
fi
343+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
344+
tar xf wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
345+
mv $(echo wasi-sdk-25.0-${ARCH}-${RUNNER_OS} | tr '[:upper:]' '[:lower:]') /opt/wasi-sdk
346+
347+
- name: Add wasm32-wasip2 target
348+
run: rustup target add --toolchain nightly-2025-08-25 wasm32-wasip2
349+
350+
- name: Cache Rust dependencies
351+
uses: Swatinem/rust-cache@v2
352+
353+
- name: Run WASI tests (c2pa-rs)
354+
env:
355+
CARGO_TARGET_WASM32_WASIP2_RUNNER: "wasmtime -S cli -S http --dir ."
356+
CC: /opt/wasi-sdk/bin/clang
357+
WASI_SDK_PATH: /opt/wasi-sdk
358+
RUST_MIN_STACK: 16777216
359+
FEATURES: ${{needs.get-features.outputs.rust-native-features}}
360+
run: |
361+
cargo +nightly-2025-08-25 test --target wasm32-wasip2 -p c2pa --features "$FEATURES" --no-default-features -- --no-capture
362+
314363
clippy_check:
315364
name: Clippy
316365
needs: get-features

.github/workflows/release_readiness.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -136,67 +136,6 @@ jobs:
136136
run: |
137137
cross test --all-targets --features "$FEATURES" --target ${{ matrix.target }}
138138
139-
tests-wasi:
140-
name: Unit tests (WASI)
141-
needs: get-features
142-
if: contains(github.event.pull_request.labels.*.name, 'release') || contains(github.event.pull_request.labels.*.name, 'check-release')
143-
runs-on: ubuntu-latest
144-
145-
steps:
146-
- name: Checkout repository
147-
uses: actions/checkout@v4
148-
149-
# nightly required for testing until this issue is resolved:
150-
# wasip2 target should not conditionally feature gate stdlib APIs rust-lang/rust#130323 https://github.com/rust-lang/rust/issues/130323
151-
- name: Install Rust toolchain
152-
uses: dtolnay/rust-toolchain@master
153-
with:
154-
toolchain: nightly-2025-05-14
155-
# Pinning to specific nightly build for now. More recent versions seem
156-
# be running doc tests that aren't intended for WASI.
157-
158-
- name: Install wasmtime
159-
run: |
160-
curl https://wasmtime.dev/install.sh -sSf | bash
161-
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
162-
163-
- name: Install WASI SDK
164-
run: |
165-
if [ "${RUNNER_ARCH}" = "X64" ]; then
166-
ARCH="x86_64";
167-
else
168-
ARCH="${RUNNER_ARCH}";
169-
fi
170-
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
171-
tar xf wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
172-
mv $(echo wasi-sdk-25.0-${ARCH}-${RUNNER_OS} | tr '[:upper:]' '[:lower:]') /opt/wasi-sdk
173-
174-
- name: Add wasm32-wasip2 target
175-
run: rustup target add --toolchain nightly-2025-05-14 wasm32-wasip2
176-
177-
- name: Cache Rust dependencies
178-
uses: Swatinem/rust-cache@v2
179-
180-
- name: Run WASI tests (c2pa-rs)
181-
env:
182-
CARGO_TARGET_WASM32_WASIP2_RUNNER: "wasmtime -S cli -S http --dir ."
183-
CC: /opt/wasi-sdk/bin/clang
184-
WASI_SDK_PATH: /opt/wasi-sdk
185-
RUST_MIN_STACK: 16777216
186-
FEATURES: ${{needs.get-features.outputs.rust-native-features}}
187-
run: |
188-
cargo +nightly-2025-05-14 test --target wasm32-wasip2 -p c2pa --features "$FEATURES" --no-default-features -- --no-capture
189-
190-
# - name: Run WASI tests (c2patool)
191-
# env:
192-
# CARGO_TARGET_WASM32_WASIP2_RUNNER: "wasmtime -S cli -S http --dir ."
193-
# CC: /opt/wasi-sdk/bin/clang
194-
# WASI_SDK_PATH: /opt/wasi-sdk
195-
# RUST_MIN_STACK: 16777216
196-
# FEATURES: ${{needs.get-features.outputs.rust-native-features}}
197-
# run: |
198-
# cargo +nightly-2025-05-14 test --target wasm32-wasip2 -p c2patool --features "$FEATURES" --no-default-features -- --no-capture
199-
200139
test-direct-minimal-versions:
201140
name: Unit tests with minimum versions of direct dependencies
202141
needs: get-features

sdk/src/ingredient.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,8 @@ mod tests {
16551655

16561656
let ingredient = Ingredient::from_memory("image/png", image_bytes).unwrap();
16571657
assert!(ingredient.thumbnail().is_none());
1658+
#[cfg(target_os = "wasi")]
1659+
Settings::reset().unwrap();
16581660
}
16591661

16601662
#[c2pa_test_async]

0 commit comments

Comments
 (0)