Add setup steps to the readme #1081
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
# https://github.com/tox-dev/action-pre-commit-uv | |
name: "pre-commit" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: ~ | |
env: | |
PYTHON_VERSION: 3.13.1 | |
UV_VERSION: 0.5.24 | |
PRE_COMMIT_VERSION: 4.1.0 | |
PRE_COMMIT_UV_VERSION: 4.1.4 | |
jobs: | |
run-pre-commit: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout | |
- name: Install uv ${{ env.UV_VERSION }} & Python ${{ env.PYTHON_VERSION }} | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
python-version: ${{ env.PYTHON_VERSION }} | |
version: ${{ env.UV_VERSION }} | |
- name: pre-commit cache | |
id: precommit_cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ env.PRE_COMMIT_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: pre-commit-${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ env.PRE_COMMIT_VERSION }}- | |
- name: Run pre-commit | |
# TODO: | |
# Try to separate the installation of pre-commit and pre-commit-uv, | |
# without hurting the cache. | |
run: uv run --no-sync --with pre-commit==${{ env.PRE_COMMIT_VERSION }} --with pre-commit-uv==${{ env.PRE_COMMIT_UV_VERSION }} pre-commit run --all-files |