From d6a861267a18e541667939fb0cc30637a02dad6e Mon Sep 17 00:00:00 2001 From: soruh Date: Fri, 31 Jul 2026 04:34:00 +0200 Subject: [PATCH] Add GitHub Actions validation --- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f8e0e2c --- /dev/null +++ b/.github/workflows/ci.yml @@ -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