| 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@v4 |
| 23 |
- name: Install toolchain |
| 24 |
uses: dtolnay/rust-toolchain@master |
| 25 |
with: |
| 26 |
toolchain: ${{ matrix.rust }} |
| 27 |
- name: Setup cache |
| 28 |
uses: Swatinem/rust-cache@v2 |
| 29 |
- name: Test (no features) |
| 30 |
run: cargo test --no-default-features |
| 31 |
- name: Test (all features) |
| 32 |
run: cargo test --all-features |
| 33 |
|
| 34 |
|
| 35 |
wasi: |
| 36 |
name: Test WASI |
| 37 |
runs-on: ubuntu-latest |
| 38 |
steps: |
| 39 |
- name: Checkout repository |
| 40 |
uses: actions/checkout@v4 |
| 41 |
- name: Install toolchain |
| 42 |
uses: dtolnay/rust-toolchain@nightly |
| 43 |
with: |
| 44 |
targets: wasm32-wasi |
| 45 |
- name: Install wasmtime |
| 46 |
run: | |
| 47 |
curl https://wasmtime.dev/install.sh -sSf | bash |
| 48 |
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH |
| 49 |
- name: Test (no features) |
| 50 |
run: CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime cargo test --target wasm32-wasi --no-default-features |
| 51 |
- name: Test (all features) |
| 52 |
run: CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime cargo test --target wasm32-wasi --all-features |
| 53 |
|
| 54 |
|
| 55 |
lints: |
| 56 |
name: Rustfmt & Clippy |
| 57 |
runs-on: ubuntu-latest |
| 58 |
steps: |
| 59 |
- name: Checkout repository |
| 60 |
uses: actions/checkout@v4 |
| 61 |
- name: Install toolchain |
| 62 |
uses: dtolnay/rust-toolchain@stable |
| 63 |
with: |
| 64 |
components: rustfmt, clippy |
| 65 |
- name: Check formatting |
| 66 |
run: cargo fmt --check |
| 67 |
- name: Check clippy |
| 68 |
run: cargo clippy -- -D warnings |