Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,21 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
wasm_build:
name: WASM build
runs-on: ubuntu-latest
env:
RUSTFLAGS: '--cfg getrandom_backend="wasm_js" -D warnings'
steps:
- name: Checkout sources
uses: actions/checkout@v5
- name: Cache Rust toolchain
uses: Swatinem/rust-cache@v2
with:
key: wasm32-unknown-unknown
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
toolchain: nightly
- run: cargo check -p rops --features wasm --no-default-features --target wasm32-unknown-unknown
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ aes-gcm = ["dep:aes-gcm"]
sha2 = ["dep:sha2"]
# Test utils
test-utils = ["dep:pretty_assertions", "dep:indoc", "dep:textwrap"]
# Features that are supported in WASM builds
wasm = ["age", "yaml", "json", "toml", "aes-gcm", "sha2"]

[dependencies]
anyhow.workspace = true
Expand Down Expand Up @@ -74,6 +76,11 @@ pretty_assertions = { workspace = true, optional = true }
textwrap = { workspace = true, optional = true }
indoc = { workspace = true, optional = true }

# To allow WASM builds to work
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", default-features = false, features = ["js"] }
getrandom_03 = { package = "getrandom", version = "0.3", default-features = false, features = ["wasm_js"] }

[dev-dependencies]
serial_test.workspace = true
tempfile.workspace = true
Expand Down