Skip to content

Commit

Permalink
ci: add autofix-ci (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen authored Dec 5, 2024
1 parent 3560c80 commit 8d6da48
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 36 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: autofix.ci # For security reasons, the workflow in which the autofix.ci action is used must be named "autofix.ci".

on:
pull_request:
types: [opened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
autofix:
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1

- uses: Boshen/setup-rust@main
with:
restore-cache: false
tools: just,cargo-shear@1,taplo-cli
components: rustfmt

- run: just fmt

- uses: autofix-ci/action@v1.3.1
with:
fail-fast: false
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,41 +98,6 @@ jobs:
with:
files: .

unused-deps:
name: Check Unused Dependencies
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
- uses: Boshen/setup-rust@main
with:
restore-cache: false
if: steps.filter.outputs.src == 'true'
- uses: cargo-bins/cargo-binstall@main
if: steps.filter.outputs.src == 'true'
- run: cargo binstall --no-confirm cargo-shear@1
if: steps.filter.outputs.src == 'true'
- run: cargo shear
if: steps.filter.outputs.src == 'true'

format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
components: rustfmt
restore-cache: false
- run: cargo fmt --all -- --check

lint:
name: Clippy
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ example *args='':

# Format all files
fmt:
cargo fmt
cargo shear --fix # remove all unused dependencies
cargo fmt --all
taplo format

# Run cargo check
Expand Down

0 comments on commit 8d6da48

Please sign in to comment.