name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
release:
types: [published]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Use Rust stable
run: rustup update stable && rustup default stable
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features
- name: Check documentation
run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-deps
- name: Verify package
run: cargo package
- name: Build project
run: cargo build --release
- name: Publish (on tag)
if: github.ref_type == 'tag'
run: cargo publish --verbose
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}