Add GitHub Actions validation
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
stable:
|
||||
name: Stable checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy, rustfmt
|
||||
- uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: nextest
|
||||
- name: Check formatting
|
||||
run: cargo fmt --all -- --check
|
||||
- name: Run strict Clippy
|
||||
run: cargo clippy --all-targets --all-features -- -D warnings
|
||||
- name: Run unit tests
|
||||
run: cargo nextest run
|
||||
- name: Run doctests
|
||||
run: cargo test --doc
|
||||
|
||||
msrv:
|
||||
name: Rust 1.85
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@1.85.0
|
||||
- name: Test on the minimum supported Rust version
|
||||
run: cargo test
|
||||
|
||||
miri:
|
||||
name: Miri
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
components: miri
|
||||
- name: Run Miri tests and doctests
|
||||
run: cargo +nightly miri test
|
||||
|
||||
coverage:
|
||||
name: Coverage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
components: llvm-tools-preview
|
||||
- uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-llvm-cov,nextest
|
||||
- name: Require complete region, function, line, and branch coverage
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail
|
||||
cargo +nightly llvm-cov nextest \
|
||||
--workspace \
|
||||
--all-features \
|
||||
--branch \
|
||||
--show-missing-lines \
|
||||
--fail-under-regions 100 \
|
||||
--fail-under-functions 100 \
|
||||
--fail-under-lines 100 \
|
||||
| tee coverage.txt
|
||||
awk '
|
||||
$1 == "TOTAL" {
|
||||
found = 1
|
||||
if ($NF != "100.00%") {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
END {
|
||||
if (!found) {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
' coverage.txt
|
||||
cargo +nightly llvm-cov report \
|
||||
--branch \
|
||||
--html \
|
||||
--output-dir target/coverage-report
|
||||
- name: Upload HTML coverage report
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: coverage-report
|
||||
path: target/coverage-report
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
Reference in New Issue
Block a user