Merge pull request #38 from njfio/fix-main-compilation-errors #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
jobs: | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
- nightly | |
include: | |
- rust: nightly | |
allow_failure: true | |
continue-on-error: ${{ matrix.allow_failure || false }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt, clippy | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ matrix.rust }}- | |
${{ runner.os }}-cargo- | |
- 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: Make test runner executable | |
run: chmod +x scripts/run_tests.sh | |
if: matrix.rust == 'stable' | |
- name: Build | |
run: cargo build --verbose --all-features | |
- name: Run critical priority tests | |
run: ./scripts/run_tests.sh critical | |
if: matrix.rust == 'stable' | |
- name: Run high priority tests | |
run: ./scripts/run_tests.sh high | |
if: matrix.rust == 'stable' | |
- name: Run medium priority tests | |
run: ./scripts/run_tests.sh medium | |
if: matrix.rust == 'stable' | |
- name: Run low priority tests | |
run: ./scripts/run_tests.sh low | |
if: matrix.rust == 'stable' | |
- name: Run all tests (fallback for non-stable) | |
run: cargo test --verbose | |
if: matrix.rust != 'stable' | |
coverage: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools-preview | |
- 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@v3 | |
with: | |
files: lcov.info | |
fail_ci_if_error: true | |
security-audit: | |
name: Security Audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-audit | |
run: cargo install cargo-audit | |
- name: Run security audit | |
run: cargo audit | |
docs: | |
name: Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build documentation | |
run: cargo doc --all-features --no-deps | |
- name: Check for broken links in docs | |
run: cargo doc --all-features --no-deps 2>&1 | grep -i "warning\|error" && exit 1 || exit 0 | |
benchmark: | |
name: Performance Benchmarks | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run benchmarks | |
run: cargo test --test performance_tests -- --ignored --nocapture |