name: CI
on:
push:
branches: [main]
pull_request:
merge_group:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
NEXTEST_NO_TESTS: warn
jobs:
branch:
name: branch name
if: github.event_name != 'push'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- run: sh scripts/check-branch.sh "$HEAD_REF" github
env:
HEAD_REF: ${{ github.head_ref }}
fmt:
name: rustfmt
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all --check
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - run: cargo clippy --workspace --all-targets --all-features -- -D warnings
style:
name: style (separators, README links, typos)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: No `// ----` separator comments
run: "! grep -rnE --include='*.rs' --exclude-dir=target --exclude-dir=.git '^[[:space:]]*//+[[:space:]]*[-=*#~_/]{4,}' ."
- name: Absolute URLs in README files
run: "! grep -rnoE --include='README.md' --exclude-dir=target --exclude-dir=.git '(\\]\\(|src=\")[^)\"]*' . | grep -vE ':(\\]\\(|src=\")(https?://|#|mailto:)'"
- name: Typos
uses: crate-ci/typos@276087d9a4f06398b3e04825487805e2d7375888
doc:
name: rustdoc
runs-on: ubuntu-latest
permissions:
contents: read
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca with:
toolchain: stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - run: cargo doc --workspace --all-features --no-deps --document-private-items
test:
name: test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca with:
toolchain: stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f with:
tool: cargo-nextest
- run: cargo nextest run --workspace --all-features
- run: cargo test --workspace --all-features --doc
coverage:
name: coverage
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca with:
toolchain: stable
components: llvm-tools-preview
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f with:
tool: cargo-llvm-cov,cargo-nextest
- run: cargo llvm-cov nextest --workspace --all-features --lcov --output-path lcov.info
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 with:
files: lcov.info
fail_ci_if_error: true
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
deny:
name: cargo-deny
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@17aeb3c839e42274e2b8adf721c8c65edfdc74dd with:
command: check
arguments: --all-features
msrv:
name: MSRV
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca with:
toolchain: stable
- uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f with:
tool: cargo-hack
- run: cargo hack check --rust-version --workspace --all-targets --ignore-private
fuzz:
name: fuzz targets build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@6a52aad76a94a5fbc50d567bb5be24419801c1fb with:
toolchain: nightly
components: rustfmt, clippy
- uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f with:
tool: cargo-fuzz
- run: cargo +nightly fuzz build --target x86_64-unknown-linux-gnu
working-directory: fuzz
- run: cargo fmt --all --check && cargo +nightly clippy --all-targets -- -D warnings
working-directory: fuzz