Skip to content

Commit ece367c

Browse files
committed
🧪Replace cache w/ re-actors/cache-python-deps
1 parent 6d984cb commit ece367c

File tree

1 file changed

+6
-74
lines changed

1 file changed

+6
-74
lines changed

.github/workflows/ci-cd.yml

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -205,56 +205,20 @@ jobs:
205205
with:
206206
fetch-depth: 0
207207
ref: ${{ github.event.inputs.release-committish }}
208-
- name: >-
209-
Calculate Python interpreter version hash value
210-
for use in the cache key
211-
if: >-
212-
steps.request-check.outputs.release-requested != 'true'
213-
id: calc-cache-key-py
214-
run: |
215-
from hashlib import sha512
216-
from os import environ
217-
from pathlib import Path
218-
from sys import version
219-
220-
FILE_APPEND_MODE = 'a'
221-
222-
hash = sha512(version.encode()).hexdigest()
223-
224-
with Path(environ['GITHUB_OUTPUT']).open(
225-
mode=FILE_APPEND_MODE,
226-
) as outputs_file:
227-
print(f'py-hash-key={hash}', file=outputs_file)
228208
- name: >-
229209
Calculate dependency files' combined hash value
230210
for use in the cache key
231211
if: >-
232212
steps.request-check.outputs.release-requested != 'true'
233213
id: calc-cache-key-files
234214
uses: ./.github/actions/cache-keys
235-
- name: Get pip cache dir
236-
id: pip-cache-dir
237-
if: >-
238-
steps.request-check.outputs.release-requested != 'true'
239-
run: >-
240-
echo "dir=$(python -m pip cache dir)" >> "${GITHUB_OUTPUT}"
241-
shell: bash
242215
- name: Set up pip cache
243216
if: >-
244217
steps.request-check.outputs.release-requested != 'true'
245-
uses: actions/cache@v4
218+
uses: re-actors/cache-python-deps@release/v1
246219
with:
247-
path: ${{ steps.pip-cache-dir.outputs.dir }}
248-
key: >-
249-
${{ runner.os }}-pip-${{
250-
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
251-
steps.calc-cache-key-files.outputs.cache-key-for-dep-files }}
252-
restore-keys: |
253-
${{ runner.os }}-pip-${{
254-
steps.calc-cache-key-py.outputs.py-hash-key
255-
}}-
256-
${{ runner.os }}-pip-
257-
${{ runner.os }}-
220+
cache-key-for-dependency-files: >-
221+
${{ steps.calc-cache-key-files.outputs.cache-key-for-dep-files }}
258222
- name: Drop Git tags from HEAD for non-release requests
259223
if: >-
260224
steps.request-check.outputs.release-requested != 'true'
@@ -391,43 +355,11 @@ jobs:
391355
}}
392356
ref: ${{ github.event.inputs.release-committish }}
393357

394-
- name: >-
395-
Calculate Python interpreter version hash value
396-
for use in the cache key
397-
id: calc-cache-key-py
398-
run: |
399-
from hashlib import sha512
400-
from os import environ
401-
from pathlib import Path
402-
from sys import version
403-
404-
FILE_APPEND_MODE = 'a'
405-
406-
hash = sha512(version.encode()).hexdigest()
407-
408-
with Path(environ['GITHUB_OUTPUT']).open(
409-
mode=FILE_APPEND_MODE,
410-
) as outputs_file:
411-
print(f'py-hash-key={hash}', file=outputs_file)
412-
shell: python
413-
- name: Get pip cache dir
414-
id: pip-cache-dir
415-
run: >-
416-
echo "dir=$(python -m pip cache dir)" >> "${GITHUB_OUTPUT}"
417358
- name: Set up pip cache
418-
uses: actions/cache@v4
359+
uses: re-actors/cache-python-deps@release/v1
419360
with:
420-
path: ${{ steps.pip-cache-dir.outputs.dir }}
421-
key: >-
422-
${{ runner.os }}-pip-${{
423-
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
424-
needs.pre-setup.outputs.cache-key-for-dep-files }}
425-
restore-keys: |
426-
${{ runner.os }}-pip-${{
427-
steps.calc-cache-key-py.outputs.py-hash-key
428-
}}-
429-
${{ runner.os }}-pip-
430-
361+
cache-key-for-dependency-files: >-
362+
${{ needs.pre-setup.outputs.cache-key-for-dep-files }}
431363
- name: Install tox
432364
run: >-
433365
python -Im pip install tox

0 commit comments

Comments
 (0)