Skip to content

Merge pull request #50 from glotzerlab/pre-commit-ci-update-config #252

Merge pull request #50 from glotzerlab/pre-commit-ci-update-config

Merge pull request #50 from glotzerlab/pre-commit-ci-update-config #252

Workflow file for this run

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.81.0
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
# 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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.cache/pre-commit/
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.12"
- name: Set up Python environment
uses: glotzerlab/workflows/setup-uv@ae7e7c6931098a313ef8069ef04b88a55c3a40f6 # 0.3.0
with:
lockfile: ".github/workflows/pre-commit-requirements.txt"
- name: Run pre-commit
run: pre-commit run --all-files