Skip to content

Commit aed710d

Browse files
committed
Improve cache usage
1 parent b1cb78f commit aed710d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/actions/restore-venv/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ runs:
2626
${{ inputs.precommit-home }}
2727
key: ${{ inputs.cache-key }}
2828
- name: Create Python virtual environment
29+
if: ${{ steps.cache-create.outputs.cache-hit != 'true' }}
2930
shell: bash
3031
run: |
3132
pip install virtualenv --upgrade
@@ -36,6 +37,12 @@ runs:
3637
# 20220124 Mimic setup_test.sh
3738
uv pip install --upgrade -r requirements_commit.txt -r requirements_test.txt -c https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test_pre_commit.txt
3839
uv pip install --upgrade pytest-asyncio
40+
- name: Install pre-commit dependencies
41+
if: ${{ steps.cache-create.outputs.cache-hit != 'true' }}
42+
shell: bash
43+
run: |
44+
. venv/bin/activate
45+
pre-commit install-hooks
3946
- name: Save cache if (purposely) created
4047
if: ${{ inputs.fail-on-miss == 'false' && steps.cache-create.outputs.cache-hit != 'true' }}
4148
uses: actions/cache/save@v4
@@ -44,7 +51,6 @@ runs:
4451
path: |
4552
${{ inputs.venv-directory }}
4653
${{ inputs.precommit-home }}
47-
4854
- name: Fail job if Python cache restore failed
4955
if: ${{ inputs.fail-on-miss == 'true' && steps.cache-create.outputs.cache-hit != 'true' }}
5056
shell: bash

.github/workflows/verify.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ jobs:
3838
venv-directory: ${{ env.VENV }}
3939
precommit-home: ${{ env.PRE_COMMIT_HOME }}
4040
fail-on-miss: false # First time create cache (if not already exists)
41-
- name: Install pre-commit dependencies
42-
run: |
43-
. venv/bin/activate
44-
pre-commit install-hooks
4541

4642
ruff:
4743
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)