3131 uses : actions/setup-python@v5
3232 with :
3333 python-version : ${{ env.DEFAULT_PYTHON }}
34+ - name : Fetch HA pyproject
35+ id : core-version
36+ run : wget -O ha_pyproject.toml "https://raw.githubusercontent.com/home-assistant/core/refs/heads/dev/pyproject.toml"
3437 - name : Compute cache key
3538 id : set-key
3639 run : echo "cache-key=${{ runner.os }}-venv-cache-${{ env.CACHE_VERSION }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> "$GITHUB_OUTPUT"
@@ -41,20 +44,13 @@ jobs:
4144 needs : cache
4245 name : Prepare
4346 steps :
44- - name : Check out committed code
45- uses : actions/checkout@v4
46- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
47- id : python
48- uses : actions/setup-python@v5
49- with :
50- python-version : ${{ env.DEFAULT_PYTHON }}
51- - name : Create or reuse cache
47+ - name : Prepare code checkout and python/pre-commit setup
5248 id : cache-reuse
53- uses : ./.github/ actions/restore-venv
49+ uses : plugwise/gh- actions/prepare-python-and-code@v1
5450 with :
5551 cache-key : ${{ needs.cache.outputs.cache-key }}
56- fail-on-miss : false # First time create cache (if not already exists)
57- python-version : ${{ steps.python.outputs.python-version }}
52+ fail-on-miss : false # First time create cache (if not already exists)
53+ python-version : ${{ env.DEFAULT_PYTHON }}
5854 venv-dir : ${{ env.VENV }}
5955 precommit-home : ${{ env.PRE_COMMIT_HOME }}
6056
@@ -69,17 +65,12 @@ jobs:
6965 uses : actions/checkout@v4
7066 with :
7167 persist-credentials : false
72- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
73- id : python
74- uses : actions/setup-python@v5
75- with :
76- python-version : ${{ env.DEFAULT_PYTHON }}
77- - name : Create or reuse cache
68+ - name : Restore cached environment
7869 id : cache-reuse
79- uses : ./.github/ actions/restore-venv
70+ uses : plugwise/gh- actions/restore-venv@v1
8071 with :
8172 cache-key : ${{ needs.cache.outputs.cache-key }}
82- python-version : ${{ steps.python.outputs.python-version }}
73+ python-version : ${{ env.DEFAULT_PYTHON }}
8374 venv-dir : ${{ env.VENV }}
8475 precommit-home : ${{ env.PRE_COMMIT_HOME }}
8576 - name : Ruff (with fix)
@@ -110,17 +101,12 @@ jobs:
110101 steps :
111102 - name : Check out committed code
112103 uses : actions/checkout@v4
113- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
114- id : python
115- uses : actions/setup-python@v5
116- with :
117- python-version : ${{ env.DEFAULT_PYTHON }}
118- - name : Create or reuse cache
104+ - name : Restore cached environment
119105 id : cache-reuse
120- uses : ./.github/ actions/restore-venv
106+ uses : plugwise/gh- actions/restore-venv@v1
121107 with :
122108 cache-key : ${{ needs.cache.outputs.cache-key }}
123- python-version : ${{ steps.python.outputs.python-version }}
109+ python-version : ${{ env.DEFAULT_PYTHON }}
124110 venv-dir : ${{ env.VENV }}
125111 precommit-home : ${{ env.PRE_COMMIT_HOME }}
126112 - name : Verify commit
@@ -150,18 +136,12 @@ jobs:
150136 steps :
151137 - name : Check out committed code
152138 uses : actions/checkout@v4
153- - name : Set up Python ${{ matrix.python-version }}
154- id : python
155- uses : actions/setup-python@v5
156- with :
157- python-version : ${{ matrix.python-version }}
158- - name : Create or reuse cache
139+ - name : Restore cached environment
159140 id : cache-reuse
160- uses : ./.github/ actions/restore-venv
141+ uses : plugwise/gh- actions/restore-venv@v1
161142 with :
162- cache-key : ${{ needs.cache.outputs.cache-key }}-pytest-matrix-${{ matrix.python-version }}
163- fail-on-miss : false # First time create cache (if not already exists)
164- python-version : ${{ matrix.python-version }}
143+ cache-key : ${{ needs.cache.outputs.cache-key }}
144+ python-version : ${{ env.DEFAULT_PYTHON }}
165145 venv-dir : ${{ env.VENV }}
166146 precommit-home : ${{ env.PRE_COMMIT_HOME }}
167147 - name : Run all tests
@@ -188,17 +168,12 @@ jobs:
188168 uses : actions/checkout@v4
189169 with :
190170 persist-credentials : false
191- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
192- id : python
193- uses : actions/setup-python@v5
194- with :
195- python-version : ${{ env.DEFAULT_PYTHON }}
196- - name : Create or reuse cache
171+ - name : Restore cached environment
197172 id : cache-reuse
198- uses : ./.github/ actions/restore-venv
173+ uses : plugwise/gh- actions/restore-venv@v1
199174 with :
200175 cache-key : ${{ needs.cache.outputs.cache-key }}
201- python-version : ${{ steps.python.outputs.python-version }}
176+ python-version : ${{ env.DEFAULT_PYTHON }}
202177 venv-dir : ${{ env.VENV }}
203178 precommit-home : ${{ env.PRE_COMMIT_HOME }}
204179 - name : Run mypy
@@ -238,17 +213,12 @@ jobs:
238213 steps :
239214 - name : Check out committed code
240215 uses : actions/checkout@v4
241- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
242- id : python
243- uses : actions/setup-python@v5
244- with :
245- python-version : ${{ env.DEFAULT_PYTHON }}
246- - name : Create or reuse cache
216+ - name : Restore cached environment
247217 id : cache-reuse
248- uses : ./.github/ actions/restore-venv
218+ uses : plugwise/gh- actions/restore-venv@v1
249219 with :
250220 cache-key : ${{ needs.cache.outputs.cache-key }}
251- python-version : ${{ steps.python.outputs.python-version }}
221+ python-version : ${{ env.DEFAULT_PYTHON }}
252222 venv-dir : ${{ env.VENV }}
253223 precommit-home : ${{ env.PRE_COMMIT_HOME }}
254224 - name : Download all coverage artifacts
@@ -275,17 +245,12 @@ jobs:
275245 steps :
276246 - name : Check out committed code
277247 uses : actions/checkout@v4
278- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
279- id : python
280- uses : actions/setup-python@v5
281- with :
282- python-version : ${{ env.DEFAULT_PYTHON }}
283- - name : Create or reuse cache
248+ - name : Restore cached environment
284249 id : cache-reuse
285- uses : ./.github/ actions/restore-venv
250+ uses : plugwise/gh- actions/restore-venv@v1
286251 with :
287252 cache-key : ${{ needs.cache.outputs.cache-key }}
288- python-version : ${{ steps.python.outputs.python-version }}
253+ python-version : ${{ env.DEFAULT_PYTHON }}
289254 venv-dir : ${{ env.VENV }}
290255 precommit-home : ${{ env.PRE_COMMIT_HOME }}
291256 - name : Install pypa/build
@@ -314,17 +279,12 @@ jobs:
314279 steps :
315280 - name : Check out committed code
316281 uses : actions/checkout@v4
317- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
318- id : python
319- uses : actions/setup-python@v5
320- with :
321- python-version : ${{ env.DEFAULT_PYTHON }}
322- - name : Create or reuse cache
282+ - name : Restore cached environment
323283 id : cache-reuse
324- uses : ./.github/ actions/restore-venv
284+ uses : plugwise/gh- actions/restore-venv@v1
325285 with :
326286 cache-key : ${{ needs.cache.outputs.cache-key }}
327- python-version : ${{ steps.python.outputs.python-version }}
287+ python-version : ${{ env.DEFAULT_PYTHON }}
328288 venv-dir : ${{ env.VENV }}
329289 precommit-home : ${{ env.PRE_COMMIT_HOME }}
330290 - name : Run complexity report (click to view details)
0 commit comments