Skip to content

ci: update checks workflow #81

ci: update checks workflow

ci: update checks workflow #81

Workflow file for this run

name: checks
on:
push:
branches: [master]
paths-ignore: ["**.md"]
pull_request:
paths-ignore: ["**.md"]
workflow_dispatch:
jobs:
extract-toolchain:
name: extract toolchain
runs-on: ubuntu-latest
outputs:
toolchain: ${{ steps.toolchain.outputs.value }}
steps:
- uses: actions/checkout@v4
- uses: sebrollen/[email protected]
id: toolchain
with:
file: rust-toolchain.toml
field: toolchain.channel
- run: echo "toolchain=${{ steps.toolchain.outputs.value || 'stable' }}" >> $GITHUB_OUTPUT
clippy:
name: cargo clippy
runs-on: ubuntu-latest
needs: extract-toolchain
env:
TOOLCHAIN: ${{ needs.extract-toolchain.outputs.toolchain }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
components: clippy
- uses: swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings
test:
name: cargo test
needs: extract-toolchain
runs-on: ubuntu-latest
env:
TOOLCHAIN: ${{ needs.extract-toolchain.outputs.toolchain }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
- uses: swatinem/rust-cache@v2
- run: cargo test
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- uses: swatinem/rust-cache@v2
- run: cargo fmt --all -- --check