-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.42 KB
/
pre-commit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: pre-commit
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- trunk
workflow_dispatch:
env:
RUST_VERSION: 1.83.0
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# For unknown reasons, pre-commit fails with error: component download failed for cargo-x86_64-unknown-linux-gnu: could not rename downloaded file ...
# unless we install with rustup first manually.
- name: Update rust
run: rustup install "$RUST_VERSION" --no-self-update && rustup default "${RUST_VERSION}"
- name: Install rustfmt
run: rustup component add rustfmt
- name: Install clippy
run: rustup component add clippy
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
~/.cache/pre-commit/
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Set up Python environment
uses: glotzerlab/workflows/setup-uv@1747bc5c994ec280440dd051f2928791407692c8 # 0.5.1
with:
lockfile: ".github/workflows/pre-commit-requirements.txt"
- name: Run pre-commit
run: pre-commit run --all-files