name: Unit testing, formatting & linting
on: [push]
jobs:
testing-formatting-linting:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- rust: stable
experimental: false
- rust: nightly
experimental: true
- rust: beta
experimental: true
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true
- uses: actions-rs/cargo@v1
name: build
with:
command: build
- uses: actions-rs/cargo@v1
name: test
with:
command: test
- uses: actions-rs/cargo@v1
name: clippy
with:
command: clippy
args: -- -D warnings
- uses: actions-rs/cargo@v1
name: fmt
with:
command: fmt
args: --all -- --check
publish_package:
runs-on: ubuntu-latest
needs: testing-formatting-linting
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}