File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments