mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Improve CI workflow (#46696)
This commit is contained in:
parent
0592309b65
commit
e1d24c69b8
277
.github/workflows/ci.yaml
vendored
277
.github/workflows/ci.yaml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
CACHE_VERSION: 1
|
CACHE_VERSION: 1
|
||||||
DEFAULT_PYTHON: 3.8
|
DEFAULT_PYTHON: 3.8
|
||||||
PRE_COMMIT_HOME: ~/.cache/pre-commit
|
PRE_COMMIT_CACHE: ~/.cache/pre-commit
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Separate job to pre-populate the base dependency cache
|
# Separate job to pre-populate the base dependency cache
|
||||||
@ -20,6 +20,9 @@ jobs:
|
|||||||
prepare-base:
|
prepare-base:
|
||||||
name: Prepare base dependencies
|
name: Prepare base dependencies
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
python-key: ${{ steps.generate-python-key.outputs.key }}
|
||||||
|
pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code from GitHub
|
- name: Check out code from GitHub
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@ -28,21 +31,25 @@ jobs:
|
|||||||
uses: actions/setup-python@v2.2.1
|
uses: actions/setup-python@v2.2.1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||||
|
- name: Generate partial Python venv restore key
|
||||||
|
id: generate-python-key
|
||||||
|
run: >-
|
||||||
|
echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{
|
||||||
|
hashFiles('requirements.txt') }}-${{
|
||||||
|
hashFiles('requirements_test.txt') }}-${{
|
||||||
|
hashFiles('homeassistant/package_constraints.txt') }}"
|
||||||
- name: Restore base Python virtual environment
|
- name: Restore base Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: >-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
steps.python.outputs.python-version }}-${{
|
steps.generate-python-key.outputs.key }}
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements_test.txt') }}-
|
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements_test.txt') }}-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
|
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }}-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-
|
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-
|
||||||
- name: Create Python virtual environment
|
- name: Create Python virtual environment
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -50,15 +57,20 @@ jobs:
|
|||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -U "pip<20.3" setuptools
|
pip install -U "pip<20.3" setuptools
|
||||||
pip install -r requirements.txt -r requirements_test.txt
|
pip install -r requirements.txt -r requirements_test.txt
|
||||||
|
- name: Generate partial pre-commit restore key
|
||||||
|
id: generate-pre-commit-key
|
||||||
|
run: >-
|
||||||
|
echo "::set-output name=key::pre-commit-${{ env.CACHE_VERSION }}-${{
|
||||||
|
hashFiles('.pre-commit-config.yaml') }}"
|
||||||
- name: Restore pre-commit environment from cache
|
- name: Restore pre-commit environment from cache
|
||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: >-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-
|
${{ runner.os }}-pre-commit-${{ env.CACHE_VERSION }}-
|
||||||
- name: Install pre-commit dependencies
|
- name: Install pre-commit dependencies
|
||||||
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -82,12 +94,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -97,13 +105,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Run bandit
|
- name: Run bandit
|
||||||
run: |
|
run: |
|
||||||
@ -127,12 +134,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -142,13 +145,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Run black
|
- name: Run black
|
||||||
run: |
|
run: |
|
||||||
@ -172,12 +174,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -187,13 +185,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Register codespell problem matcher
|
- name: Register codespell problem matcher
|
||||||
run: |
|
run: |
|
||||||
@ -239,12 +236,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -254,13 +247,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Register check executables problem matcher
|
- name: Register check executables problem matcher
|
||||||
run: |
|
run: |
|
||||||
@ -287,12 +279,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -302,13 +290,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Register flake8 problem matcher
|
- name: Register flake8 problem matcher
|
||||||
run: |
|
run: |
|
||||||
@ -335,12 +322,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -350,13 +333,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Run isort
|
- name: Run isort
|
||||||
run: |
|
run: |
|
||||||
@ -380,12 +362,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -395,13 +373,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Register check-json problem matcher
|
- name: Register check-json problem matcher
|
||||||
run: |
|
run: |
|
||||||
@ -428,12 +405,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -443,13 +416,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Run pyupgrade
|
- name: Run pyupgrade
|
||||||
run: |
|
run: |
|
||||||
@ -484,12 +456,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -499,13 +467,12 @@ jobs:
|
|||||||
id: cache-precommit
|
id: cache-precommit
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.PRE_COMMIT_HOME }}
|
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||||
key: |
|
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
- name: Fail job if pre-commit cache restore failed
|
||||||
- name: Fail job if cache restore failed
|
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Failed to restore Python virtual environment from cache"
|
echo "Failed to restore pre-commit environment from cache"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Register yamllint problem matcher
|
- name: Register yamllint problem matcher
|
||||||
run: |
|
run: |
|
||||||
@ -531,11 +498,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
needs.prepare-tests.outputs.python-key }}
|
||||||
matrix.python-version }}-${{ hashFiles('requirements_test.txt')
|
|
||||||
}}-${{ hashFiles('requirements_all.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -563,12 +527,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
|
needs.prepare-base.outputs.python-key }}
|
||||||
steps.python.outputs.python-version }}-${{
|
|
||||||
hashFiles('requirements.txt') }}-${{
|
|
||||||
hashFiles('requirements_test.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -585,24 +545,31 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.8, 3.9]
|
python-version: [3.8, 3.9]
|
||||||
|
outputs:
|
||||||
|
python-key: ${{ steps.generate-python-key.outputs.key }}
|
||||||
container: homeassistant/ci-azure:${{ matrix.python-version }}
|
container: homeassistant/ci-azure:${{ matrix.python-version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code from GitHub
|
- name: Check out code from GitHub
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Generate partial Python venv restore key
|
||||||
|
id: generate-python-key
|
||||||
|
run: >-
|
||||||
|
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
|
||||||
|
hashFiles('requirements_test.txt') }}-${{
|
||||||
|
hashFiles('requirements_all.txt') }}-${{
|
||||||
|
hashFiles('homeassistant/package_constraints.txt') }}"
|
||||||
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: >-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
matrix.python-version }}-${{ hashFiles('requirements_test.txt')
|
steps.generate-python-key.outputs.key }}
|
||||||
}}-${{ hashFiles('requirements_all.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('requirements_test.txt') }}-${{ hashFiles('requirements_all.txt') }}
|
${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements_test.txt') }}-${{ hashFiles('requirements_all.txt') }}-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('requirements_test.txt') }}
|
${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('requirements_test.txt') }}-
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ matrix.python-version }}-
|
${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}-
|
||||||
- name: Create full Python ${{ matrix.python-version }} virtual environment
|
- name: Create full Python ${{ matrix.python-version }} virtual environment
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -633,11 +600,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
needs.prepare-tests.outputs.python-key }}
|
||||||
matrix.python-version }}-${{ hashFiles('requirements_test.txt')
|
|
||||||
}}-${{ hashFiles('requirements_all.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -667,11 +631,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
needs.prepare-tests.outputs.python-key }}
|
||||||
matrix.python-version }}-${{ hashFiles('requirements_test.txt')
|
|
||||||
}}-${{ hashFiles('requirements_all.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -689,6 +650,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: prepare-tests
|
needs: prepare-tests
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
group: [1, 2, 3, 4]
|
group: [1, 2, 3, 4]
|
||||||
python-version: [3.8, 3.9]
|
python-version: [3.8, 3.9]
|
||||||
@ -703,11 +665,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
needs.prepare-tests.outputs.python-key }}
|
||||||
matrix.python-version }}-${{ hashFiles('requirements_test.txt')
|
|
||||||
}}-${{ hashFiles('requirements_all.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
@ -735,6 +694,7 @@ jobs:
|
|||||||
--test-group-count 4 \
|
--test-group-count 4 \
|
||||||
--test-group=${{ matrix.group }} \
|
--test-group=${{ matrix.group }} \
|
||||||
--cov homeassistant \
|
--cov homeassistant \
|
||||||
|
--cov-report= \
|
||||||
-o console_output_style=count \
|
-o console_output_style=count \
|
||||||
-p no:sugar \
|
-p no:sugar \
|
||||||
tests
|
tests
|
||||||
@ -750,7 +710,7 @@ jobs:
|
|||||||
coverage:
|
coverage:
|
||||||
name: Process test coverage
|
name: Process test coverage
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: pytest
|
needs: ["prepare-tests", "pytest"]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.8]
|
python-version: [3.8]
|
||||||
@ -763,11 +723,8 @@ jobs:
|
|||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.4
|
||||||
with:
|
with:
|
||||||
path: venv
|
path: venv
|
||||||
key: >-
|
key: ${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
needs.prepare-tests.outputs.python-key }}
|
||||||
matrix.python-version }}-${{ hashFiles('requirements_test.txt')
|
|
||||||
}}-${{ hashFiles('requirements_all.txt') }}-${{
|
|
||||||
hashFiles('homeassistant/package_constraints.txt') }}
|
|
||||||
- name: Fail job if Python cache restore failed
|
- name: Fail job if Python cache restore failed
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user