name: ci
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
test:
name: cargo test (${{ matrix.toolchain }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, "1.85"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo test -p zrip-core -p zrip-encode -p zrip-decode -p zrip --lib --tests
- run: cargo test -p zrip-core -p zrip-encode -p zrip-decode -p zrip --lib --tests --features dict_builder
- run: cargo check -p zrip-core -p zrip-encode -p zrip-decode -p zrip --no-default-features --features alloc
nightly:
name: nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- run: cargo +nightly test -p zrip-core -p zrip-encode -p zrip-decode -p zrip --lib --tests
lint:
name: fmt + clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo +nightly fmt --all -- --check
- run: cargo +nightly clippy -p zrip-core -p zrip-encode -p zrip-decode -p zrip --lib --tests --features dict_builder
ci-success:
name: CI success
needs: [test, nightly, lint]
runs-on: ubuntu-latest
if: always()
steps:
- name: check all jobs passed
run: |
if [[ '${{ toJSON(needs.*.result) }}' =~ (failure|cancelled) ]]; then
exit 1
fi