-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
587c147
commit 4cc83c3
Showing
1 changed file
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,61 @@ | ||
name: Lint and Format | ||
on: | ||
push: | ||
pull_request: | ||
|
||
branches: [main] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
fmt: | ||
rustfmt: | ||
name: Rustfmt [Formatter] | ||
runs-on: ubuntu-latest | ||
name: nightly / fmt | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable | ||
# We run in nightly to make use of some features only available there. | ||
# Check out `rustfmt.toml` to see which ones. | ||
uses: dtolnay/rust-toolchain@nightly | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup | Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: cargo fmt --all --check | ||
run: cargo fmt --all --check | ||
|
||
- name: Build | Format | ||
run: cargo fmt --all -- --check | ||
|
||
# Run the `clippy` linting tool | ||
clippy: | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.toolchain }} / clippy | ||
permissions: | ||
contents: read | ||
checks: write | ||
name: Clippy [Linter] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Get early warning of new lints which are regularly introduced in beta | ||
# channels. | ||
toolchain: [stable, beta] | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install ${{ matrix.toolchain }} | ||
uses: dtolnay/rust-toolchain@master | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup | Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
components: clippy | ||
- name: cargo clippy | ||
uses: giraffate/clippy-action@v1 | ||
with: | ||
reporter: "github-pr-check" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup | Cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build | Lint | ||
uses: giraffate/clippy-action@94e9bd8deab2618756ec5380f12eb35bcb0a88ca | ||
|
||
# Ensure that the project could be successfully compiled | ||
cargo_check: | ||
name: Compile | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup | Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Setup | Cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build | Check | ||
run: cargo check --workspace --locked | ||
|