Skip to content

Commit a9579f1

Browse files
committed
Caching of the ccache
1 parent 6d4d820 commit a9579f1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.ci/install.bash

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,17 @@ then
6969
DOCKER_MOUNT_KNOWN_HOSTS_ARGS="--mount type=bind,source=${HOME}/.ssh/known_hosts,target=/tmp/known_hosts_extra"
7070
fi
7171

72+
DOCKER_HOME=$(docker run --name tue-env --rm "$IMAGE_NAME:$BRANCH_TAG" bash -c 'echo "$HOME"' | tr -d '\r')
73+
74+
# Make sure the ~/.ccache folder exists
75+
mkdir -p "$HOME"/.ccache
76+
7277
# Run the docker image along with setting new environment variables
7378
# shellcheck disable=SC2086
74-
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env ${DOCKER_MOUNT_KNOWN_HOSTS_ARGS} "${IMAGE_NAME}:${BRANCH_TAG}"
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}"
80+
81+
# Own the ~/.ccache folder for permissions
82+
docker exec -t tue-env bash -c "sudo chown 1000:1000 -R ~/.ccache"
7583

7684
if [ "$MERGE_KNOWN_HOSTS" == "true" ]
7785
then

.github/workflows/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v3
20+
- name: Cache ccache
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
~/.ccache
25+
key: ${{ runner.os }}-ccache-${{ github.event.repository.name }}-${{ github.sha }}
26+
restore-keys: |
27+
${{ runner.os }}-ccache-${{ github.event.repository.name }}-
28+
${{ runner.os }}-ccache-
2029
- name: Install
2130
run: |
2231
GITHUB_REF=${GITHUB_REF#refs/heads/}

0 commit comments

Comments
 (0)