CI: Cache pip wheels (#62755)

This commit is contained in:
Marc Mueller 2021-12-30 11:49:05 +01:00 committed by GitHub
parent 7d1de80926
commit 77ffd7b066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,10 @@ on:
env:
CACHE_VERSION: 5
PIP_CACHE_VERSION: 1
DEFAULT_PYTHON: 3.8
PRE_COMMIT_CACHE: ~/.cache/pre-commit
PIP_CACHE: /tmp/pip-cache
SQLALCHEMY_WARN_20: 1
PYTHONASYNCIODEBUG: 1
@ -148,6 +150,11 @@ jobs:
hashFiles('requirements.txt') }}-${{
hashFiles('requirements_test.txt') }}-${{
hashFiles('homeassistant/package_constraints.txt') }}"
- name: Generate partial pip restore key
id: generate-pip-key
run: >-
echo "::set-output name=key::base-pip-${{ env.PIP_CACHE_VERSION }}-$(
date -u '+%Y-%m-%dT%H:%M:%s')"
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2.1.7
@ -165,13 +172,23 @@ jobs:
# ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements_test.txt') }}-
# ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }}-
# ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-
- name: Restore pip wheel cache
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: actions/cache@v2.1.7
with:
path: ${{ env.PIP_CACHE }}
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-pip-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-pip-${{ env.PIP_CACHE_VERSION }}-
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
pip install -U "pip<20.3" setuptools wheel
pip install -r requirements.txt -r requirements_test.txt
pip install --cache-dir=$PIP_CACHE -U "pip<20.3" setuptools wheel
pip install --cache-dir=$PIP_CACHE -r requirements.txt -r requirements_test.txt
- name: Generate partial pre-commit restore key
id: generate-pre-commit-key
run: >-
@ -519,6 +536,11 @@ jobs:
hashFiles('requirements_test.txt') }}-${{
hashFiles('requirements_all.txt') }}-${{
hashFiles('homeassistant/package_constraints.txt') }}"
- name: Generate partial pip restore key
id: generate-pip-key
run: >-
echo "::set-output name=key::pip-${{ env.PIP_CACHE_VERSION }}-$(
date -u '+%Y-%m-%dT%H:%M:%s')"
- name: Restore full Python ${{ matrix.python-version }} virtual environment
id: cache-venv
uses: actions/cache@v2.1.7
@ -536,6 +558,16 @@ jobs:
# ${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements_test.txt') }}-${{ hashFiles('requirements_all.txt') }}-
# ${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements_test.txt') }}-
# ${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-
- name: Restore pip wheel cache
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: actions/cache@v2.1.7
with:
path: ${{ env.PIP_CACHE }}
key: >-
${{ runner.os }}-${{ matrix.python-version }}-pip-${{ env.PIP_CACHE_VERSION }}-${{
steps.generate-pip-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-${{ env.PIP_CACHE_VERSION }}-
- name: Create full Python ${{ matrix.python-version }} virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
@ -545,9 +577,9 @@ jobs:
python -m venv venv
. venv/bin/activate
pip install -U "pip<20.3" setuptools wheel
pip install -r requirements_all.txt
pip install -r requirements_test.txt
pip install --cache-dir=$PIP_CACHE -U "pip<20.3" setuptools wheel
pip install --cache-dir=$PIP_CACHE -r requirements_all.txt
pip install --cache-dir=$PIP_CACHE -r requirements_test.txt
pip install -e .
pylint: