name: CI
on:
push:
branches: [dev, qa, main]
pull_request:
branches: [dev, qa, main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: fmt + clippy + build + test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
- name: cargo fmt --all --check
run: cargo fmt --all --check
- name: cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: cargo build --all-targets
run: cargo build --all-targets
- name: cargo build --examples
run: cargo build --examples
- name: cargo test
run: cargo test
- name: cargo doc
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc --no-deps --all-features
msrv:
name: MSRV (1.87)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: "1.87" - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - name: cargo check on MSRV
run: cargo check --all-targets --all-features
semver:
name: semver-checks (advisory)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
fetch-depth: 0
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - name: Install cargo-semver-checks
uses: taiki-e/install-action@cargo-semver-checks
- name: Fetch baseline branch
run: git fetch --no-tags --depth=100 origin "${{ github.base_ref }}"
- name: Check for semver-breaking changes
run: cargo semver-checks --baseline-rev FETCH_HEAD
build:
name: release build
if: github.ref == 'refs/heads/qa' || github.ref == 'refs/heads/main'
needs: check
runs-on: macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - name: cargo build --release
run: cargo build --release --locked