ci: ensure pip cache is reliable and robust
Previously we had cache keys that could cause issues if the python
version changed etc, and if we re-run something weekly we couldn't say
if we used a new or old version because the cache.
@@ -49,14 +49,14 @@ jobs:
with:
python-version: "3.8"
- # Action Repo: https://github.com/actions/cache
- - name: "Cache pip dependencies"
+ # There will almost never be a cache hit on the cache key when this job is
+ # run, as it is the first of all jobs in this workflow. The subsequent
+ # jobs in this workflow can rely on this cache though.
+ - name: Save pip's install cache on job completion
uses: actions/cache@v3
with:
path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-
+ key: "${{ github.run_id }}"
- name: "Install dependencies"
run: |
@@ -100,14 +100,11 @@ jobs:
with:
python-version: "${{ matrix.python_version }}"
- # Action Repo: https://github.com/actions/cache
- - name: "Cache pip dependencies"
+ - name: Restore pip's install cache from previous job
uses: actions/cache@v3
with:
path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-
+ key: "${{ github.run_id }}"
- name: "Install"
run: |
