ci: update cache version #5
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
name: Format and Lint | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: ["v[0-9]+.[0-9]+.[0-9]+*"] | |
paths: | |
- "**.ts" | |
- "**.tsx" | |
- "**.js" | |
- "**.mjs" | |
- "**.cs" | |
- "**.rs" | |
- "Cargo*" | |
- ".github/workflows/**.yml" | |
jobs: | |
format-and-lint: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v10 | |
- name: Run the Magic Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@v4 | |
- name: Cache Rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- uses: rrbutani/use-nix-shell-action@v1 | |
with: | |
devShell: .#ci-format | |
- name: Format project source code | |
run: nix fmt | |
- name: Run Clippy | |
run: nix develop .#ci-format --command cargo clippy --all-features -- -D warnings | |
- name: Commit formatting changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Apply formatting changes | |
status_options: "--untracked-files=no" |