name: cheby CI
on:
push:
branches: [main, master]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --all-targets
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-targets -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --all-targets
- run: cargo test --doc
coverage:
name: Test & Coverage
if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust (nightly + llvm-tools)
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Coverage (run, no report)
run: cargo +nightly llvm-cov --workspace --all-features --doctests --no-report
- name: Coverage (Cobertura XML)
run: cargo +nightly llvm-cov report --cobertura --output-path coverage.xml
- name: Coverage (HTML)
run: cargo +nightly llvm-cov report --html --output-dir coverage_html
- name: Build coverage summary (Markdown)
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
badge: true
format: markdown
output: file
- name: Publish to Job Summary
run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY"
- name: Post coverage as PR comment
if: github.event_name == 'pull_request'
uses: mshick/add-pr-comment@v2
with:
message-path: code-coverage-results.md
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Coverage gate (>=90% lines)
run: cargo +nightly llvm-cov --workspace --all-features --doctests --no-run --fail-under-lines 90
- name: Upload coverage HTML
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: coverage_html
retention-days: 7