name: Code Check
on:
pull_request:
push:
branches:
- main
env:
RUSTFLAGS: "-Dwarnings"
jobs:
rustfmt:
name: "Format"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- name: Run Cargo Fmt
uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
clippy:
name: "Clippy"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: clippy
- name: Run Cargo Clippy
run: cargo clippy --all-features --all-targets
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Run Cargo Test
run: cargo test --verbose --workspace --all-features --all-targets
test_docs:
name: "Test Docs"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Run Cargo Test
run: cargo test --verbose --workspace --all-features --doc
doc:
name: "Build Docs"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Run Cargo Doc
run: cargo doc --workspace --all-features --no-deps
coverage_llvmcov:
name: "Coverage LlvmCov"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
profile: minimal
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 coverage-report-llvmcov.lcov
- name: Archive Code Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report-llvmcov.lcov
path: coverage-report-llvmcov.lcov
- name: Report and Check Code Coverage
uses: zgosalvez/github-actions-report-lcov@v2
with:
coverage-files: coverage-report-llvmcov.lcov
minimum-coverage: 90
artifact-name: coverage-report-llvmcov.html
coverage_grcov:
name: "Coverage GrCov"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Nightly Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Define GrCov Config
run: >
echo -e
"branch: true\noutput-type: lcov\nignore: ['/rustc/*', '/home/runner/.cargo/registry/src/*', '/cargo/registry/*']\noutput-path: coverage-report-grcov.lcov"
> grcov-config.yml
- name: Run Cargo Test with Coverage
run: cargo test --all-features --all-targets
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- name: Run GrCov
id: coverage
uses: actions-rs/grcov@v0.1
with:
config: grcov-config.yml
- name: Archive Code Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report-grcov.lcov
path: coverage-report-grcov.lcov
- name: Report and Check Code Coverage
uses: zgosalvez/github-actions-report-lcov@v2
with:
coverage-files: coverage-report-grcov.lcov
minimum-coverage: 90
artifact-name: coverage-report-grcov.html