Skip to content

Merge pull request #244 from jond01/dependabot/pip/dot-github/workflo… #252

Merge pull request #244 from jond01/dependabot/pip/dot-github/workflo…

Merge pull request #244 from jond01/dependabot/pip/dot-github/workflo… #252

Workflow file for this run

name: Pre-commit
on:
push:
branches:
- main
- "releases/**"
pull_request:
branches:
- main
- "releases/**"
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
CACHE_DIR: /opt/.cache
PRE_COMMIT_HOME: /opt/.cache/pre-commit
RUFF_CACHE_DIR: /opt/.cache/ruff
MYPY_CACHE_DIR: /opt/.cache/mypy
FORCE_COLOR: 1
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Get uv version
id: uv-version
run: |
content=$(cat .github/workflows/uv-constraint.txt)
echo "version=${content#uv==}" >> $GITHUB_OUTPUT
- uses: astral-sh/setup-uv@v3
with:
version: ${{ steps.uv-version.outputs.version }}
enable-cache: true
cache-dependency-glob: uv.lock
cache-suffix: pre-commit
- name: Install dependencies
# This step may also install the Python version set in the `.python-version` file on the fly if not available
run: uv sync
- name: Set PY
id: set-py
run: echo "PY=$(python -VV | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_DIR }}
key: pre-commit-${{ runner.os }}-python-${{ steps.set-py.outputs.PY }}-config-and-deps-${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }}
- name: Run pre-commit
env:
PRE_COMMIT_COLOR: always
run: uv run pre-commit run --all-files