Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving the caching in the pre-commit job #90

Merged
merged 4 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
env:
CACHE_DIR: /opt/.cache
PRE_COMMIT_HOME: /opt/.cache/pre-commit
BLACK_CACHE_DIR: /opt/.cache/black
RUFF_CACHE_DIR: /opt/.cache/ruff
MYPY_CACHE_DIR: /opt/.cache/mypy
steps:
- uses: actions/checkout@v3
- name: Install Poetry
Expand All @@ -37,8 +41,8 @@ jobs:
run: echo "PY=$(python -VV | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: pre-commit-${{ runner.os }}-python-${{ steps.set-py.outputs.PY }}-config-${{ hashFiles('.pre-commit-config.yaml') }}
path: ${{ env.CACHE_DIR }}
key: pre-commit-${{ runner.os }}-python-${{ steps.set-py.outputs.PY }}-config-and-deps-${{ hashFiles('.pre-commit-config.yaml', 'poetry.lock') }}
- name: Run pre-commit
env:
PRE_COMMIT_COLOR: always
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.256
rev: v0.0.265
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand Down
Loading