• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: python + Bazel pre-commit checks
2
3on:
4  push:
5    branches: [ main ]
6  pull_request:
7    branches: [ main ]
8
9jobs:
10  pre-commit:
11    runs-on: ubuntu-latest
12    env:
13      MYPY_CACHE_DIR: "${{ github.workspace }}/.cache/mypy"
14      RUFF_CACHE_DIR: "${{ github.workspace }}/.cache/ruff"
15      PRE_COMMIT_HOME: "${{ github.workspace }}/.cache/pre-commit"
16
17    steps:
18    - uses: actions/checkout@v4
19      with:
20        fetch-depth: 0
21    - name: Set up Python
22      uses: actions/setup-python@v5
23      with:
24        python-version: 3.11
25        cache: pip
26        cache-dependency-path: pyproject.toml
27    - name: Install dependencies
28      run: python -m pip install ".[dev]"
29    - name: Cache pre-commit tools
30      uses: actions/cache@v4
31      with:
32        path: |
33          ${{ env.MYPY_CACHE_DIR }}
34          ${{ env.RUFF_CACHE_DIR }}
35          ${{ env.PRE_COMMIT_HOME }}
36        key: ${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}-linter-cache
37    - name: Run pre-commit checks
38      run: pre-commit run --all-files --verbose --show-diff-on-failure
39