| 1 |
on: |
| 2 |
push: |
| 3 |
branches: |
| 4 |
- main |
| 5 |
pull_request: |
| 6 |
schedule: |
| 7 |
- cron: '5 21 * * 5' |
| 8 |
workflow_dispatch: |
| 9 |
|
| 10 |
name: CI |
| 11 |
|
| 12 |
jobs: |
| 13 |
test: |
| 14 |
name: Test |
| 15 |
runs-on: ${{ matrix.os }} |
| 16 |
strategy: |
| 17 |
matrix: |
| 18 |
os: [ubuntu-latest, macos-latest, windows-latest] |
| 19 |
rust: [stable, nightly, '1.56'] |
| 20 |
steps: |
| 21 |
- name: Checkout repository |
| 22 |
uses: actions/checkout@v5 |
| 23 |
- name: Install toolchain |
| 24 |
uses: dtolnay/rust-toolchain@master |
| 25 |
with: |
| 26 |
toolchain: ${{ matrix.rust }} |
| 27 |
- name: Pin to old dependency versions (Rust 1.56 only) |
| 28 |
if: matrix.rust == '1.56' |
| 29 |
run: | |
| 30 |
cargo update -p libc --precise 0.2.163 |
| 31 |
cargo update -p windows-sys --precise 0.52.0 |
| 32 |
- name: Setup cache |
| 33 |
uses: Swatinem/rust-cache@v2 |
| 34 |
- name: Test (no features) |
| 35 |
run: cargo test --no-default-features |
| 36 |
- name: Test (all features) |
| 37 |
run: cargo test --all-features |
| 38 |
|
| 39 |
|
| 40 |
wasi: |
| 41 |
name: Test WASI |
| 42 |
runs-on: ubuntu-latest |
| 43 |
steps: |
| 44 |
- name: Checkout repository |
| 45 |
uses: actions/checkout@v5 |
| 46 |
- name: Install toolchain |
| 47 |
uses: dtolnay/rust-toolchain@nightly |
| 48 |
with: |
| 49 |
targets: wasm32-wasip2 |
| 50 |
- name: Install wasmtime |
| 51 |
run: | |
| 52 |
curl https://wasmtime.dev/install.sh -sSf | bash |
| 53 |
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH |
| 54 |
- name: Test (no features) |
| 55 |
run: CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime cargo test --target wasm32-wasip2 --no-default-features |
| 56 |
- name: Test (all features) |
| 57 |
run: CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime cargo test --target wasm32-wasip2 --all-features |
| 58 |
|
| 59 |
emscripten: |
| 60 |
name: Test Emscripten |
| 61 |
runs-on: ubuntu-latest |
| 62 |
container: emscripten/emsdk:latest |
| 63 |
steps: |
| 64 |
- name: Checkout repository |
| 65 |
uses: actions/checkout@v5 |
| 66 |
- name: Install toolchain |
| 67 |
uses: dtolnay/rust-toolchain@nightly |
| 68 |
with: |
| 69 |
targets: wasm32-unknown-emscripten |
| 70 |
- name: Test (no features) |
| 71 |
run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --no-default-features |
| 72 |
- name: Test (all features) |
| 73 |
run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --all-features |
| 74 |
|
| 75 |
|
| 76 |
lints: |
| 77 |
name: Rustfmt & Clippy |
| 78 |
runs-on: ubuntu-latest |
| 79 |
steps: |
| 80 |
- name: Checkout repository |
| 81 |
uses: actions/checkout@v5 |
| 82 |
- name: Install toolchain |
| 83 |
uses: dtolnay/rust-toolchain@stable |
| 84 |
with: |
| 85 |
components: rustfmt, clippy |
| 86 |
- name: Check formatting |
| 87 |
run: cargo fmt --check |
| 88 |
- name: Check clippy |
| 89 |
run: cargo clippy -- -D warnings |