81 lines
1.9 KiB
YAML
81 lines
1.9 KiB
YAML
name: Code style
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
cargo-fmt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
# Cache cargo registry
|
|
- name: Hash the lock file
|
|
uses: https://gitea.com/seepine/hash-files@v1
|
|
id: get-hash
|
|
with:
|
|
patterns: |
|
|
**/Cargo.lock
|
|
|
|
- name: Setup rust
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: rustfmt,clippy
|
|
cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
|
|
|
|
- name: Rustfmt Check
|
|
uses: actions-rust-lang/rustfmt@v1
|
|
|
|
cargo-check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
# Cache cargo registry
|
|
- name: Hash the lock file
|
|
uses: https://gitea.com/seepine/hash-files@v1
|
|
id: get-hash
|
|
with:
|
|
patterns: |
|
|
**/Cargo.lock
|
|
|
|
- name: Setup rust
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: rustfmt,clippy
|
|
cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
|
|
|
|
- name: Cargo check
|
|
run: cargo check --workspace
|
|
|
|
clippy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
# Cache cargo registry
|
|
- name: Hash the lock file
|
|
uses: https://gitea.com/seepine/hash-files@v1
|
|
id: get-hash
|
|
with:
|
|
patterns: |
|
|
**/Cargo.lock
|
|
|
|
- name: Setup rust
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: rustfmt,clippy
|
|
cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
|
|
|
|
- name: Cargo check
|
|
run: cargo clippy --all-targets --all-features -- -Dwarnings
|