Skip to content

feat: input validation - Validate trait, Valid<E> extractor and #[derive(Validate)] #726

feat: input validation - Validate trait, Valid<E> extractor and #[derive(Validate)]

feat: input validation - Validate trait, Valid<E> extractor and #[derive(Validate)] #726

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
format_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all -- --check
clippy_check:
runs-on: ubuntu-latest
needs: format_check
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features --locked -- -D warnings
msrv_check:
runs-on: ubuntu-latest
needs: format_check
# Every other job runs on the runner's default stable toolchain, so the MSRV
# advertised by `rust-version` in the workspace manifest (and by the README
# badge) is otherwise never exercised. `--all-targets` pulls in dev-dependencies,
# which is where an MSRV regression is most likely to sneak in.
steps:
- uses: actions/checkout@v4
- name: Read MSRV from the workspace manifest
id: msrv
run: echo "version=$(grep -m1 '^rust-version' Cargo.toml | cut -d'"' -f2)" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.version }}
- name: Check the published crates on MSRV
run: cargo check --locked --all-features --all-targets
workspace_check:
runs-on: ubuntu-latest
needs: format_check
# `default-members` excludes `examples/*`, so no other job ever compiles them
# and a dependency bump can leave an example behind without failing CI.
# `--workspace` overrides `default-members` and covers every member.
steps:
- uses: actions/checkout@v4
- name: Check the entire workspace, examples included
run: cargo check --locked --workspace --all-features --all-targets
audit:
runs-on: ubuntu-latest
needs: format_check
# audit-check publishes results via the Checks API; without `checks: write`
# it fails hard on push and silently passes on pull_request.
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- name: Security audit
uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc_check:
runs-on: ubuntu-latest
needs: format_check
steps:
- uses: actions/checkout@v4
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --all-features --locked
build:
environment: CICD
runs-on: ubuntu-latest
needs: [clippy_check, doc_check]
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --locked
test:
environment: CICD
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --locked
- name: Run tests - Full
run: cargo test --locked --all-features
- name: Run tests - http1
run: cargo test --locked --features http1
- name: Run tests - http2
run: cargo test --locked --features http2
coverage:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Code coverage check
env:
# The `trybuild` cases spend minutes in a nested cargo build and cover nothing
# measurable; under instrumentation they outlive tarpaulin's per-test timeout
SKIP_UI_TESTS: 1
run: |
cargo tarpaulin --locked --all-features --workspace --config coverage.toml --fail-under 80