Skip to content

Commit 1c046d0

Browse files
authored
feat: Wasm32 wasi 0.41.0 (#888)
feat: Add wasi compatibility. - wasip2 will require +nightly until rust-lang/rust#130323 is resolved and/or std::os::wasip2 is available in stable. - Support was added to rustix for version 0.38.39 bytecodealliance/rustix#1205 - Support was added to tempfile for version 3.14 Stebalien/tempfile#305 - Tempfile is not supported in wasip1 - Working remote manifest fetch. Tests passing with WASI. CARGO_TARGET_WASM32_WASIP2_RUNNER="wasmtime -S common -S http --dir ."
1 parent 49667a0 commit 1c046d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1103
-592
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,56 @@ jobs:
287287
run: wasm-pack test --chrome --headless
288288
working-directory: ./cawg_identity
289289

290+
tests-wasi:
291+
name: Unit tests (WASI)
292+
if: |
293+
github.event_name != 'pull_request' ||
294+
github.event.pull_request.author_association == 'COLLABORATOR' ||
295+
github.event.pull_request.author_association == 'MEMBER' ||
296+
github.event.pull_request.user.login == 'dependabot[bot]' ||
297+
contains(github.event.pull_request.labels.*.name, 'safe to test')
298+
299+
runs-on: ubuntu-latest
300+
301+
steps:
302+
- name: Checkout repository
303+
uses: actions/checkout@v4
304+
305+
# nightly required for testing until this issue is resolved:
306+
# wasip2 target should not conditionally feature gate stdlib APIs rust-lang/rust#130323 https://github.com/rust-lang/rust/issues/130323
307+
- name: Install Rust toolchain
308+
uses: dtolnay/rust-toolchain@nightly
309+
310+
- name: Install wasmtime
311+
run: |
312+
curl https://wasmtime.dev/install.sh -sSf | bash
313+
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
314+
315+
- name: Install WASI SDK
316+
run: |
317+
if [ "${RUNNER_ARCH}" = "X64" ]; then
318+
ARCH="x86_64";
319+
else
320+
ARCH="${RUNNER_ARCH}";
321+
fi
322+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
323+
tar xvf wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
324+
mv $(echo wasi-sdk-25.0-${ARCH}-${RUNNER_OS} | tr '[:upper:]' '[:lower:]') /opt/wasi-sdk
325+
326+
- name: Add wasm32-wasip2 target
327+
run: rustup target add --toolchain nightly wasm32-wasip2
328+
329+
- name: Cache Rust dependencies
330+
uses: Swatinem/rust-cache@v2
331+
332+
- name: Run WASI tests (c2pa-rs)
333+
env:
334+
CARGO_TARGET_WASM32_WASIP2_RUNNER: "wasmtime -S cli -S http --dir ."
335+
CC: /opt/wasi-sdk/bin/clang
336+
WASI_SDK_PATH: /opt/wasi-sdk
337+
RUST_MIN_STACK: 16777216
338+
run: cargo +nightly test --target wasm32-wasip2 -p c2pa -p c2pa-crypto --all-features
339+
290340
test-direct-minimal-versions:
291341
name: Unit tests with minimum versions of direct dependencies
292342
if: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/target/
22

33
**/*.rs.bk
4+
**/*.tmp*
45

56
.DS_Store
67
.idea

0 commit comments

Comments
 (0)