Skip to content

8 improve ci for speed and maintainability #24

8 improve ci for speed and maintainability

8 improve ci for speed and maintainability #24

Workflow file for this run

name: CI
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.rust }}
- name: Check formatting
run: cargo fmt --all -- --check
if: matrix.rust == 'stable'
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
if: matrix.rust == 'stable'
- name: Run tests
run: cargo test --verbose
- name: Build
run: cargo build --verbose
if: matrix.rust != 'stable'
- name: Build (release)
run: cargo build --verbose --release
if: matrix.rust == 'stable'
security_audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
# coverage:
# name: Code Coverage
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v5
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
# with:
# components: llvm-tools-preview
# - name: Cache dependencies
# uses: actions/cache@v4
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Install cargo-llvm-cov
# uses: taiki-e/install-action@cargo-llvm-cov
# - name: Generate code coverage
# run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: lcov.info
# fail_ci_if_error: true
cross_platform:
name: Cross Platform Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Build
run: cargo build --verbose --release
- name: Test
run: cargo test --verbose