forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use mypy caching [ci] (home-assistant#86715)
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ on: | |
env: | ||
CACHE_VERSION: 3 | ||
PIP_CACHE_VERSION: 3 | ||
MYPY_CACHE_VERSION: 3 | ||
HA_SHORT_VERSION: 2023.3 | ||
DEFAULT_PYTHON: "3.10" | ||
ALL_PYTHON_VERSIONS: "['3.10']" | ||
|
@@ -756,6 +757,13 @@ jobs: | |
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
check-latest: true | ||
- name: Generate partial mypy restore key | ||
id: generate-mypy-key | ||
run: | | ||
mypy_version=$(cat requirements_test.txt | grep mypy | cut -d '=' -f 3) | ||
echo "version=$mypy_version" >> $GITHUB_OUTPUT | ||
echo "key=mypy-${{ env.MYPY_CACHE_VERSION }}-$mypy_version-${{ | ||
env.HA_SHORT_VERSION }}-$(date -u '+%Y-%m-%dT%H:%M:%s')" >> $GITHUB_OUTPUT | ||
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment | ||
id: cache-venv | ||
uses: actions/cache/[email protected] | ||
|
@@ -769,6 +777,17 @@ jobs: | |
run: | | ||
echo "Failed to restore Python virtual environment from cache" | ||
exit 1 | ||
- name: Restore mypy cache | ||
uses: actions/[email protected] | ||
with: | ||
path: .mypy_cache | ||
key: >- | ||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | ||
steps.generate-mypy-key.outputs.key }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-mypy-${{ | ||
env.MYPY_CACHE_VERSION }}-${{ steps.generate-mypy-key.outputs.version }}-${{ | ||
env.HA_SHORT_VERSION }}- | ||
- name: Register mypy problem matcher | ||
run: | | ||
echo "::add-matcher::.github/workflows/matchers/mypy.json" | ||
|