---
name: CI & Publish
on:
push:
branches: [master]
tags: ['*']
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 with:
toolchain: stable
components: clippy, rustfmt
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - uses: taiki-e/install-action@cf39a74df4a72510be4e5b63348d61067f11e64a with:
tool: cargo-deny
- name: Check formatting
run: cargo fmt --check
- name: Clippy (default features)
run: cargo clippy -- -D warnings
- name: Clippy (all features)
run: cargo clippy --all-features -- -D warnings
- name: Test (default features)
run: cargo test
- name: Test (all features)
run: cargo test --all-features
- name: Deny check
run: cargo deny check
publish:
needs: ci
if: startsWith(github.ref, 'refs/tags/')
name: Publish to crates.io
runs-on: ubuntu-latest
environment: crates-io
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 with:
toolchain: stable
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}