Skip to content

chore: Rust & CI update #359

chore: Rust & CI update

chore: Rust & CI update #359

Workflow file for this run

---
name: Continuous Integration
on:
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
- "LICENSE"
push:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
- "LICENSE"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# Principle of least privilege: all jobs only read the repo (checkout + cargo).
# Per-job override is unnecessary because no job pushes, creates releases or PRs.
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 10
CARGO_NET_TIMEOUT: 60
jobs:
fast-checks:
name: 🏁 Fast Checks (Format)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ubuntu
- name: Install taplo
run: cargo install taplo-cli --locked
- name: Run format checks
run: |
taplo format --check --config taplo.toml
cargo +nightly fmt --all -- --check
build-and-test-matrix:
name: 🛠️ Build & Test Matrix
needs: fast-checks
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Ubuntu
if: matrix.os == 'ubuntu-latest'
uses: ./.github/actions/ubuntu
- name: Setup macOS
if: matrix.os == 'macos-latest'
uses: ./.github/actions/macos
- name: Build (all targets)
run: cargo build --locked
- name: Build (library only)
run: cargo build --lib --locked
- name: Test (all targets)
run: cargo test --locked
analysis:
name: 🤖 Analysis (Clippy & Doc)
needs: fast-checks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ubuntu
- name: Run clippy (all targets)
run: SKIP_CIRCUIT_BUILD=1 cargo clippy --all-targets --locked -- -D warnings
- name: Run clippy (library only)
run: SKIP_CIRCUIT_BUILD=1 cargo clippy --lib --locked -- -D warnings
- name: Generate documentation
run: SKIP_CIRCUIT_BUILD=1 cargo doc --locked --no-deps
- name: Check documentation (with private items)
run: SKIP_CIRCUIT_BUILD=1 cargo doc --locked --no-deps --document-private-items
security-audit:
name: 🔒 Security Audit
needs: fast-checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run security audit
run: cargo audit
examples:
name: 📚 Examples
needs: fast-checks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ubuntu
- name: Build examples
run: cargo build --examples --locked
- name: Check example compilation
run: |
for example in examples/*.rs; do
example_name=$(basename "$example" .rs)
echo "Checking example: $example_name"
cargo check --example "$example_name" --locked
done