Skip to content

Commit

Permalink
ci: improve mypy cache accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
neersighted committed Mar 25, 2024
1 parent e42ebb6 commit f3d4274
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/actions/bootstrap-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ inputs:
description: Enable transparent caching of the Poetry artifact cache
default: 'true'

outputs:
python-path:
description: Path to the installed Python interpreter
value: ${{ steps.setup-python.outputs.python-path }}
python-version:
description: Version of the installed Python interpreter
value: ${{ steps.setup-python.outputs.python-version }}
cache-hit:
description: Whether an exact Poetry cache hit occured
value: ${{ steps.cache.outputs.cache-hit }}

runs:
using: composite
steps:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/.tests-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- uses: actions/checkout@v4

- uses: ./.github/actions/bootstrap-poetry
id: bootstrap-poetry
with:
python-version: ${{ inputs.python-version }}

Expand All @@ -43,9 +44,9 @@ jobs:
- uses: actions/cache@v4
with:
path: .mypy_cache
key: mypy-${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
key: mypy-${{ runner.os }}-py${{ steps.bootstrap-poetry.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
restore-keys: |
mypy-${{ runner.os }}-py${{ inputs.python-version }}-
mypy-${{ runner.os }}-py${{ steps.bootstrap-poetry.outputs.python-version }}-
mypy-${{ runner.os }}-
- run: poetry run mypy
Expand Down

0 comments on commit f3d4274

Please sign in to comment.