name: Rust CI/CD
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
lint-and-test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check Formatting (cargo fmt)
run: cargo fmt --all -- --check
- name: Run Clippy (cargo clippy)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run Unit Tests (cargo test)
run: cargo test --verbose