name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: clippy-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
- run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
test:
name: Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
- run: cargo test --workspace --all-targets --all-features --locked
msrv:
name: Rust 1.95 compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - run: rustup toolchain install 1.95 --profile minimal
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: msrv-${{ runner.os }}-1.95-${{ hashFiles('Cargo.lock') }}
- run: cargo +1.95 check --workspace --all-targets --all-features --locked
rustdoc:
name: rustdoc
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: rustdoc-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
- run: cargo doc --workspace --no-deps --all-features --locked
rulewright:
name: Rulewright self-analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: rulewright-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
- run: cargo run --locked -- --strict
- run: bash scripts/generate-rules.sh
- run: git diff --exit-code -- RULES.md
downstream:
name: Custom rule-pack fixture
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
examples/custom-rule-pack/target
key: downstream-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock', 'examples/custom-rule-pack/Cargo.toml') }}
- run: cargo test --manifest-path examples/custom-rule-pack/Cargo.toml --locked
package:
name: Package validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 - run: bash scripts/test-release.sh
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: package-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
- run: cargo package --list --locked
- run: cargo package --locked
- name: Test extracted package
shell: bash
run: |
package_dir="$(find target/package -mindepth 1 -maxdepth 1 -type d -name 'rulewright-*' | sort | tail -n 1)"
test -n "${package_dir}"
cargo test --manifest-path "${package_dir}/Cargo.toml" --all-targets --locked