Skip to content

Commit 3a681e1

Browse files
[ci] Cache pip cache for cross-arch tests
Signed-off-by: Tiyash Basu <[email protected]>
1 parent bfebadb commit 3a681e1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,38 @@ jobs:
140140
rm -rf /tmp/.buildx-cache
141141
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
142142
143+
# Cache pip downloads
144+
- name: Cache pip downloads
145+
uses: actions/cache@v3
146+
with:
147+
path: /tmp/pip-cache
148+
key: nox-${{ matrix.nox-session }}-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('**/pyproject.toml') }}
149+
150+
# This ensures that the docker container has access to the pip cache.
151+
# Changing the user in the docker-run step causes it to fail due to
152+
# incorrect permissions. Setting the ownership of the pip cache to root
153+
# before running is a workaround to this issue.
154+
- name: Set pip cache owners to root for docker
155+
run: if [[ -e /tmp/pip-cache ]]; then sudo chown -R root:root /tmp/pip-cache; fi
156+
143157
- name: Run nox
144158
run: |
145159
docker run \
146160
--rm \
147161
-v $(pwd):/${{ github.workspace }} \
162+
-v /tmp/pip-cache:/root/.cache/pip \
148163
-w ${{ github.workspace }} \
149164
--net=host \
150165
--platform linux/${{ matrix.arch }} \
151166
localhost/nox-cross-arch:latest \
152167
nox -e ${{ matrix.nox-session }}
153168
timeout-minutes: 30
154169

170+
# This ensures that the runner has access to the pip cache.
171+
- name: Reset pip cache ownership
172+
if: always()
173+
run: sudo chown -R $USER:$USER /tmp/pip-cache
174+
155175
build:
156176
name: Build distribution packages
157177
runs-on: ubuntu-20.04

0 commit comments

Comments
 (0)