name: Rust CI/CD
permissions:
contents: read
actions: read
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint (fmt + clippy)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Ensure Rust toolchain
run: |
rustup default stable
rustup component add rustfmt clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check Formatting (CLI)
run: cargo fmt --all -- --check
- name: Run Clippy (CLI)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check Formatting (Backend)
working-directory: apps/backend
run: cargo fmt --all -- --check
- name: Run Clippy (Backend)
working-directory: apps/backend
run: cargo clippy --all-targets --all-features -- -D warnings
test-matrix:
name: Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Ensure Rust toolchain
run: |
rustup default stable
rustup component add rustfmt clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run CLI Tests
run: cargo test --all-features --verbose
- name: Run Backend Tests
working-directory: apps/backend
run: cargo test --all-features --verbose