Skip to content

Commit a518c94

Browse files
(CI) also cache pip (#34)
* (CI) also cache pip * (actions) cache pip
1 parent d0cc74d commit a518c94

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.ci/install.bash

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,19 @@ DOCKER_HOME=$(docker run --name tue-env --rm "${IMAGE_NAME}:${BRANCH_TAG}" bash
7474
# Make sure the ~/.ccache folder exists
7575
mkdir -p "$HOME"/.ccache
7676

77+
# Make sure the ~/.cache/pip folder exists
78+
mkdir -p "$HOME"/.cache/pip
79+
7780
# Run the docker image along with setting new environment variables
7881
# shellcheck disable=SC2086
79-
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env --mount type=bind,source=${HOME}/.ccache,target=${DOCKER_HOME}/.ccache ${DOCKER_MOUNT_KNOWN_HOSTS_ARGS} "${IMAGE_NAME}:${BRANCH_TAG}"
82+
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env --mount type=bind,source=${HOME}/.ccache,target=${DOCKER_HOME}/.ccache --mount type=bind,source=$HOME/.cache/pip,target=$DOCKER_HOME/.cache/pip ${DOCKER_MOUNT_KNOWN_HOSTS_ARGS} "${IMAGE_NAME}:${BRANCH_TAG}"
8083

8184
# Own the ~/.ccache folder for permissions
8285
docker exec -t tue-env bash -c "sudo chown 1000:1000 -R ~/.ccache"
8386

87+
# Own the ~/.cache/pip folder for permissions
88+
docker exec -t tue-env bash -c 'sudo chown "${USER}":"${USER}" -R ~/.cache/pip'
89+
8490
if [ "$MERGE_KNOWN_HOSTS" == "true" ]
8591
then
8692
docker exec -t tue-env bash -c "sudo chown 1000:1000 /tmp/known_hosts_extra && ~/.tue/ci/ssh-merge-known_hosts.py ~/.ssh/known_hosts /tmp/known_hosts_extra --output ~/.ssh/known_hosts"
@@ -125,3 +131,6 @@ then
125131
echo -e '\e[35m\e[1mcatkin config --workspace ${TUE_SYSTEM_DIR} --no-skiplist\e[0m'
126132
docker exec -t tue-env bash -c 'source ~/.bashrc; catkin config --workspace ${TUE_SYSTEM_DIR} --no-skiplist' # Clear skiplist
127133
fi
134+
135+
# Allow everyone to read ~/.cache/pip folder for caching inside CI pipelines
136+
docker exec -t tue-env bash -c 'sudo chmod -R a+r ~/.cache/pip'

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ jobs:
2929
key: ${{ runner.os }}-ccache-${{ steps.get-date.outputs.date }}
3030
restore-keys: |
3131
${{ runner.os }}-ccache-
32+
- name: Cache pip
33+
uses: actions/cache@v3
34+
with:
35+
path: |
36+
~/.cache/pip
37+
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}
38+
restore-keys: |
39+
${{ runner.os }}-pip-
3240
- name: Install
3341
run: |
3442
GITHUB_REF=${GITHUB_REF#refs/heads/}

0 commit comments

Comments
 (0)