From 6f782628b92cb312e34b63dbd402110a279878ec Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 20 Sep 2022 20:24:39 +0200 Subject: [PATCH] Pin Python patch versions [ci] (#78830) --- .github/workflows/ci.yaml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3e40bdff4cb..7209a0fbf6f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,7 +23,10 @@ env: CACHE_VERSION: 1 PIP_CACHE_VERSION: 1 HA_SHORT_VERSION: 2022.10 - DEFAULT_PYTHON: 3.9 + # Pin latest Python patch versions to avoid issues + # with runners using different versions. + DEFAULT_PYTHON: 3.9.14 + ALL_PYTHON_VERSIONS: "['3.9.14', '3.10.7']" PRE_COMMIT_CACHE: ~/.cache/pre-commit PIP_CACHE: /tmp/pip-cache SQLALCHEMY_WARN_20: 1 @@ -46,6 +49,7 @@ jobs: pre-commit_cache_key: ${{ steps.generate_pre-commit_cache_key.outputs.key }} python_cache_key: ${{ steps.generate_python_cache_key.outputs.key }} requirements: ${{ steps.core.outputs.requirements }} + python_versions: ${{ steps.info.outputs.python_versions }} test_full_suite: ${{ steps.info.outputs.test_full_suite }} test_group_count: ${{ steps.info.outputs.test_group_count }} test_groups: ${{ steps.info.outputs.test_groups }} @@ -143,6 +147,8 @@ jobs: fi # Output & sent to GitHub Actions + echo "python_versions: ${ALL_PYTHON_VERSIONS}" + echo "::set-output name=python_versions::${ALL_PYTHON_VERSIONS}" echo "test_full_suite: ${test_full_suite}" echo "::set-output name=test_full_suite::${test_full_suite}" echo "integrations_glob: ${integrations_glob}" @@ -463,7 +469,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - python-version: ["3.9", "3.10"] + python-version: ${{ fromJSON(needs.info.outputs.python_versions) }} steps: - name: Check out code from GitHub uses: actions/checkout@v3.0.2 @@ -483,7 +489,7 @@ jobs: with: path: venv key: >- - ${{ runner.os }}-${{ matrix.python-version }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Restore pip wheel cache if: steps.cache-venv.outputs.cache-hit != 'true' @@ -491,10 +497,10 @@ jobs: with: path: ${{ env.PIP_CACHE }} key: >- - ${{ runner.os }}-${{ matrix.python-version }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-pip-key.outputs.key }} restore-keys: | - ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ env.PIP_CACHE_VERSION }}-${{ env.HA_SHORT_VERSION }}- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-pip-${{ env.PIP_CACHE_VERSION }}-${{ env.HA_SHORT_VERSION }}- - name: Install additional OS dependencies if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -541,7 +547,7 @@ jobs: with: path: venv key: >- - ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' @@ -573,7 +579,7 @@ jobs: with: path: venv key: >- - ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' @@ -606,7 +612,7 @@ jobs: with: path: venv key: >- - ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' @@ -650,7 +656,7 @@ jobs: with: path: venv key: >- - ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' @@ -682,7 +688,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10"] + python-version: ${{ fromJson(needs.info.outputs.python_versions) }} name: Run pip check ${{ matrix.python-version }} steps: - name: Check out code from GitHub @@ -698,7 +704,7 @@ jobs: with: path: venv key: >- - ${{ runner.os }}-${{ matrix.python-version }}-${{ + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' @@ -729,7 +735,7 @@ jobs: fail-fast: false matrix: group: ${{ fromJson(needs.info.outputs.test_groups) }} - python-version: ["3.9", "3.10"] + python-version: ${{ fromJson(needs.info.outputs.python_versions) }} name: >- Run tests Python ${{ matrix.python-version }} (${{ matrix.group }}) steps: @@ -751,7 +757,7 @@ jobs: uses: actions/cache@v3.0.8 with: path: venv - key: ${{ runner.os }}-${{ matrix.python-version }}-${{ + key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.info.outputs.python_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true'