From bcbf99243d126533ca17a04e7bc40028aed756ec Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 11 Oct 2022 13:54:55 +0200 Subject: [PATCH] Use setup-python check-latest option [ci] (#80078) --- .github/workflows/ci.yaml | 60 +++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7fd4b284191..bb50142c9e0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,10 +23,8 @@ env: CACHE_VERSION: 1 PIP_CACHE_VERSION: 1 HA_SHORT_VERSION: 2022.11 - # 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']" + DEFAULT_PYTHON: 3.9 + ALL_PYTHON_VERSIONS: "['3.9', '3.10']" PRE_COMMIT_CACHE: ~/.cache/pre-commit PIP_CACHE: /tmp/pip-cache SQLALCHEMY_WARN_20: 1 @@ -69,7 +67,7 @@ jobs: - name: Generate partial pre-commit restore key id: generate_pre-commit_cache_key run: >- - echo "::set-output name=key::${{ env.CACHE_VERSION }}-${{ env.DEFAULT_PYTHON }}-${{ + echo "::set-output name=key::pre-commit-${{ env.CACHE_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}" - name: Filter for core changes uses: dorny/paths-filter@v2.10.2 @@ -175,12 +173,15 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore base Python virtual environment id: cache-venv uses: actions/cache@v3.0.10 with: path: venv - key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -193,7 +194,9 @@ jobs: uses: actions/cache@v3.0.10 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Install pre-commit dependencies if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -214,12 +217,15 @@ jobs: id: python with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore base Python virtual environment id: cache-venv uses: actions/cache@v3.0.10 with: path: venv - key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -230,7 +236,9 @@ jobs: uses: actions/cache@v3.0.10 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if pre-commit cache restore failed if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -263,12 +271,15 @@ jobs: id: python with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore base Python virtual environment id: cache-venv uses: actions/cache@v3.0.10 with: path: venv - key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -279,7 +290,9 @@ jobs: uses: actions/cache@v3.0.10 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if pre-commit cache restore failed if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -315,12 +328,15 @@ jobs: id: python with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore base Python virtual environment id: cache-venv uses: actions/cache@v3.0.10 with: path: venv - key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -331,7 +347,9 @@ jobs: uses: actions/cache@v3.0.10 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if pre-commit cache restore failed if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -356,12 +374,15 @@ jobs: id: python with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore base Python virtual environment id: cache-venv uses: actions/cache@v3.0.10 with: path: venv - key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -372,7 +393,9 @@ jobs: uses: actions/cache@v3.0.10 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }} + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.info.outputs.pre-commit_cache_key }} - name: Fail job if pre-commit cache restore failed if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -478,6 +501,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial pip restore key id: generate-pip-key run: >- @@ -541,6 +565,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment id: cache-venv uses: actions/cache@v3.0.10 @@ -573,6 +598,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore base Python virtual environment id: cache-venv uses: actions/cache@v3.0.10 @@ -606,6 +632,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment id: cache-venv uses: actions/cache@v3.0.10 @@ -650,6 +677,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment id: cache-venv uses: actions/cache@v3.0.10 @@ -698,6 +726,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore full Python ${{ matrix.python-version }} virtual environment id: cache-venv uses: actions/cache@v3.0.10 @@ -752,6 +781,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore full Python ${{ matrix.python-version }} virtual environment id: cache-venv uses: actions/cache@v3.0.10