From 63d2b4516c4fd644cb285ad68f375859448425f4 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Fri, 15 Aug 2025 10:05:39 +0200 Subject: [PATCH 1/3] Ensure venv working after restore --- .github/actions/restore-venv/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/restore-venv/action.yml b/.github/actions/restore-venv/action.yml index 0c920a75f..7d7dd6458 100644 --- a/.github/actions/restore-venv/action.yml +++ b/.github/actions/restore-venv/action.yml @@ -26,6 +26,11 @@ runs: ${{ inputs.venv-dir }} ${{ inputs.precommit-home }} key: ${{ inputs.cache-key }} + - name: Ensure virtual environment after restore + if: ${{ steps.cache-create.outputs.cache-hit == 'true' }} + shell: bash + run: | + python -m venv --upgrade ${{ inputs.venv-dir }} - name: Create Python virtual environment if: ${{ steps.cache-create.outputs.cache-hit != 'true' }} shell: bash From 59dee571c6698ef08587e63f806c4a4bd4b3d2ca Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Fri, 15 Aug 2025 10:26:40 +0200 Subject: [PATCH 2/3] Rework --- .github/actions/restore-venv/action.yml | 5 ----- .github/workflows/verify.yml | 29 +++++++++++++------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/actions/restore-venv/action.yml b/.github/actions/restore-venv/action.yml index 7d7dd6458..0c920a75f 100644 --- a/.github/actions/restore-venv/action.yml +++ b/.github/actions/restore-venv/action.yml @@ -26,11 +26,6 @@ runs: ${{ inputs.venv-dir }} ${{ inputs.precommit-home }} key: ${{ inputs.cache-key }} - - name: Ensure virtual environment after restore - if: ${{ steps.cache-create.outputs.cache-hit == 'true' }} - shell: bash - run: | - python -m venv --upgrade ${{ inputs.venv-dir }} - name: Create Python virtual environment if: ${{ steps.cache-create.outputs.cache-hit != 'true' }} shell: bash diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 468e90f5e..af3ae4e81 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -23,10 +23,11 @@ jobs: name: Cache identify outputs: cache-key: ${{ steps.set-key.outputs.cache-key }} + python-version: ${{ steps.python.outputs.python-version }} # Ensure all runners use THIS minor version steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python and determine minor version for ${{ env.DEFAULT_PYTHON }} id: python uses: actions/setup-python@v5 with: @@ -43,11 +44,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ needs.cache.outputs.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ need.cache.outputs.python-versionN }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -69,11 +70,11 @@ jobs: uses: actions/checkout@v5 with: persist-credentials: false - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ need.cache.outputs.python-versionN }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ need.cache.outputs.python-versionN }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -110,11 +111,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ need.cache.outputs.python-versionN }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ need.cache.outputs.python-versionN }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -161,7 +162,7 @@ jobs: with: cache-key: ${{ needs.cache.outputs.cache-key }}-pytest-matrix-${{ matrix.python-version }} fail-on-miss: false # First time create cache (if not already exists) - python-version: ${{ matrix.python-version }} + python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Run all tests @@ -189,11 +190,11 @@ jobs: uses: actions/checkout@v5 with: persist-credentials: false - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ need.cache.outputs.python-versionN }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ need.cache.outputs.python-versionN }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -239,11 +240,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ need.cache.outputs.python-versionN }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ need.cache.outputs.python-versionN }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -332,11 +333,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ need.cache.outputs.python-versionN }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ need.cache.outputs.python-versionN }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv From a48b432911c36dee82698c6b052dbf3d749f39fa Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Fri, 15 Aug 2025 10:28:30 +0200 Subject: [PATCH 3/3] Rework --- .github/workflows/verify.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index af3ae4e81..7d24a3213 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -48,7 +48,7 @@ jobs: id: python uses: actions/setup-python@v5 with: - python-version: ${{ need.cache.outputs.python-versionN }} + python-version: ${{ needs.cache.outputs.python-version }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -70,11 +70,11 @@ jobs: uses: actions/checkout@v5 with: persist-credentials: false - - name: Set up Python ${{ need.cache.outputs.python-versionN }} + - name: Set up Python ${{ needs.cache.outputs.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ need.cache.outputs.python-versionN }} + python-version: ${{ needs.cache.outputs.python-version }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -111,11 +111,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ need.cache.outputs.python-versionN }} + - name: Set up Python ${{ needs.cache.outputs.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ need.cache.outputs.python-versionN }} + python-version: ${{ needs.cache.outputs.python-version }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -190,11 +190,11 @@ jobs: uses: actions/checkout@v5 with: persist-credentials: false - - name: Set up Python ${{ need.cache.outputs.python-versionN }} + - name: Set up Python ${{ needs.cache.outputs.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ need.cache.outputs.python-versionN }} + python-version: ${{ needs.cache.outputs.python-version }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -240,11 +240,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ need.cache.outputs.python-versionN }} + - name: Set up Python ${{ needs.cache.outputs.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ need.cache.outputs.python-versionN }} + python-version: ${{ needs.cache.outputs.python-version }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv @@ -333,11 +333,11 @@ jobs: steps: - name: Check out committed code uses: actions/checkout@v5 - - name: Set up Python ${{ need.cache.outputs.python-versionN }} + - name: Set up Python ${{ needs.cache.outputs.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ need.cache.outputs.python-versionN }} + python-version: ${{ needs.cache.outputs.python-version }} - name: Create or reuse cache id: cache-reuse uses: ./.github/actions/restore-venv