name: CI
on:
push:
branches: [master, main]
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/ci.yml"
pull_request:
branches: [master, main]
types: [opened, synchronize, reopened]
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/ci.yml"
env:
CARGO_TERM_COLOR: always
jobs:
rust:
name: Rust Check&Fmt&Test
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !startsWith(github.head_ref, 'release-plz') }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo check
run: cargo check --all-targets --all-features
- name: Run cargo build
run: cargo build --all-targets --all-features
- name: Run cargo test
run: cargo test --all-features
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
fmt:
name: Format
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !startsWith(github.head_ref, 'release-plz') }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check formatting
run: cargo +nightly fmt -- --check