@@ -146,4 +146,88 @@ jobs:
146146 run : cargo miri nextest run --all-features -j${{ steps.cores.outputs.count }}
147147 - name : Run Miri tests (serial)
148148 if : steps.cores.outputs.use_nextest == 'false'
149- run : cargo miri test --all-features
149+ run : cargo miri test --all-features
150+
151+ test-no-std :
152+ name : Test no_std
153+ runs-on : ubuntu-latest
154+ strategy :
155+ matrix :
156+ target :
157+ - thumbv7em-none-eabihf # ARM Cortex-M4F/M7F
158+ - thumbv8m.main-none-eabihf # ARM Cortex-M33/M35P
159+ - riscv32imac-unknown-none-elf # RISC-V 32-bit
160+ rust-toolchain :
161+ - " 1.81" # minimum for this crate
162+ - " stable"
163+ - " nightly"
164+ steps :
165+ - uses : actions/checkout@v4 # not pinning to commit hash since this is a GitHub action, which we trust
166+ - uses : actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1.12.0
167+ with :
168+ toolchain : ${{ matrix.rust-toolchain }}
169+ target : ${{ matrix.target }}
170+ components : rustfmt, clippy
171+ cache-key : ${{ matrix.target }}-${{ matrix.rust-toolchain }}
172+ - name : Check no_std (no features)
173+ run : cargo check --target ${{ matrix.target }} --no-default-features --lib
174+ - name : Check no_std with alloc
175+ run : cargo check --target ${{ matrix.target }} --no-default-features --features alloc --lib
176+ - name : Check no_std with cache
177+ run : cargo check --target ${{ matrix.target }} --no-default-features --features cache --lib
178+ - if : ${{ matrix.target == 'thumbv7em-none-eabihf' }}
179+ name : Build no_std example
180+ run : cargo build --target ${{ matrix.target }} --manifest-path examples/no_std_embedded/Cargo.toml --release
181+ - name : Run no_std tests (on host with std test harness)
182+ run : cargo test --test no_std_tests
183+
184+ test-wasm :
185+ name : Test WASM
186+ runs-on : ubuntu-latest
187+ strategy :
188+ matrix :
189+ include :
190+ # WASM 1.0/2.0 (32-bit) - all toolchains
191+ - target : wasm32-unknown-unknown
192+ rust-toolchain : " 1.81"
193+ - target : wasm32-unknown-unknown
194+ rust-toolchain : " stable"
195+ - target : wasm32-unknown-unknown
196+ rust-toolchain : " nightly"
197+ # WASI preview 1 (32-bit) - all toolchains
198+ - target : wasm32-wasip1
199+ rust-toolchain : " 1.81"
200+ - target : wasm32-wasip1
201+ rust-toolchain : " stable"
202+ - target : wasm32-wasip1
203+ rust-toolchain : " nightly"
204+ # WASI preview 2 (32-bit) - nightly only (experimental)
205+ - target : wasm32-wasip2
206+ rust-toolchain : " nightly"
207+ # WASM 3.0 (64-bit address space) - nightly only (experimental)
208+ - target : wasm64-unknown-unknown
209+ rust-toolchain : " nightly"
210+ steps :
211+ - uses : actions/checkout@v4 # not pinning to commit hash since this is a GitHub action, which we trust
212+ - uses : actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1.12.0
213+ with :
214+ toolchain : ${{ matrix.rust-toolchain }}
215+ target : ${{ matrix.target }}
216+ components : rustfmt, clippy
217+ cache-key : ${{ matrix.target }}-${{ matrix.rust-toolchain }}
218+ - name : Check WASM (no features)
219+ run : cargo check --target ${{ matrix.target }} --no-default-features --lib
220+ - name : Check WASM with alloc
221+ run : cargo check --target ${{ matrix.target }} --no-default-features --features alloc --lib
222+ - name : Check WASM with cache
223+ run : cargo check --target ${{ matrix.target }} --no-default-features --features cache --lib
224+ - name : Build WASM release
225+ run : cargo build --target ${{ matrix.target }} --no-default-features --features alloc --lib --release
226+ - name : Run WASM tests (on host with std test harness)
227+ run : cargo test --test wasm_tests
228+ - if : ${{ matrix.target == 'wasm32-unknown-unknown' && matrix.rust-toolchain == 'stable' }}
229+ name : Install wasm-pack
230+ run : curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
231+ - if : ${{ matrix.target == 'wasm32-unknown-unknown' && matrix.rust-toolchain == 'stable' }}
232+ name : Build WASM package with wasm-pack
233+ run : wasm-pack build --target web --no-default-features --features alloc
0 commit comments