Skip to content

Commit

Permalink
add a second cache directory for Docker image building
Browse files Browse the repository at this point in the history
because they just take too much time
  • Loading branch information
3nids committed Mar 5, 2019
1 parent c21baa9 commit 241c642
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
24 changes: 14 additions & 10 deletions .ci/travis/linux/script.sh
Expand Up @@ -20,7 +20,7 @@ mkdir -p "$CCACHE_DIR"

if [[ ${DOCKER_BUILD_QGIS_IMAGE} =~ true ]]; then
# copy ccache dir within QGIS source so it can be accessed from docker
cp -r ${CCACHE_DIR} ${TRAVIS_BUILD_DIR}/.ccache
cp -r ${CCACHE_DIR_IMAGE_BUILD} ${TRAVIS_BUILD_DIR}/.ccache_image_build
# building docker images
DIR=$(git rev-parse --show-toplevel)/.docker
pushd "${DIR}"
Expand All @@ -32,20 +32,24 @@ if [[ ${DOCKER_BUILD_QGIS_IMAGE} =~ true ]]; then
echo "${bold}Pushing image to docker hub...${endbold}"
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push "qgis/qgis:${DOCKER_TAG}"
echo "Copy build cache from Docker container to Travis cache directory"
rm -rf ${CCACHE_DIR_IMAGE_BUILD}/*
container_id=$(docker images -q "qgis/qgis:${DOCKER_TAG}")
docker cp ${container_id}:/usr/src/QGIS/.ccache_image_build ${CCACHE_DIR_IMAGE_BUILD}
popd
echo "Trigger build of PyQGIS Documentation"
body='{
"request": {
"branch":"master",
"message": "Trigger PyQGIS doc build after release of new Docker image",
"config": {
"merge_mode": "deep_merge",
"env": {
"global": ["QGIS_VERSION_BRANCH=release-3_4"]
body="{
'request': {
'branch':'master',
'message': 'Trigger PyQGIS doc build after release of new Docker image as ${DOCKER_TAG}',
'config': {
'merge_mode': 'deep_merge',
'env': {
'global': ['QGIS_VERSION_BRANCH=${TRAVIS_BRANCH}']
}
}
}
}'
}"
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" \
-H "Travis-API-Version: 3" -H "Authorization: token $TRAVIS_TOKEN" -d "$body" \
https://api.travis-ci.org/repo/qgis%2Fpyqgis/requests
Expand Down
2 changes: 1 addition & 1 deletion .docker/docker-compose.travis.yml
Expand Up @@ -16,7 +16,7 @@ services:
image: qgis/qgis3-build-deps:${DOCKER_TAG}
volumes:
- ${TRAVIS_BUILD_DIR}:/root/QGIS
- ${CCACHE_DIR}:/root/.ccache # if changed, also change env var
- ${CCACHE_DIR_TESTING}:/root/.ccache # if changed, also change env var
links:
- postgres
- mssql
Expand Down
3 changes: 2 additions & 1 deletion .docker/qgis.dockerfile
Expand Up @@ -16,7 +16,8 @@ ENV LANG=C.UTF-8

COPY . /usr/src/QGIS

ENV CCACHE_DIR=/usr/src/QGIS/.ccache
# If this directory is changed, also adapt script.sh which copies the directory
ENV CCACHE_DIR=/usr/src/QGIS/.ccache_image_build
RUN ccache -M 1G
RUN ccache -s

Expand Down
6 changes: 4 additions & 2 deletions .travis.yml
Expand Up @@ -7,14 +7,16 @@ cache:
apt: true
pip: true
directories:
- ${HOME}/.ccache
- ${HOME}/.ccache_testing
- ${HOME}/.ccache_docker_build
timeout: 1000
if: NOT branch =~ /^(cherry-pick-)?backport-\d+-on-/

env:
global:
- TRAVIS_TIMESTAMP=$(date +%s)
- CCACHE_DIR=${HOME}/.ccache
- CCACHE_DIR_TESTING=${HOME}/.ccache_testing
- CCACHE_DIR_IMAGE_BUILD=${HOME}/.ccache_docker_build
# Docker hub username and passowrd
- secure: "b7eMDIolaAnq1voGKC1ez7Kcf+/A0WZDJEHBvNwk2KubBfrGOE83GMDrFNF4NqjIprqIAvVKj+TrX1ckCvs24re3IqUJo71TaF1IgxzDDPwSsmNh5UMmvZkeiJys9bWjqDO9wYR5ietNmIE18qyMc8ToJk8oKm6AXuAG2n6znmM="
- secure: "PHCp7F3nApp38Mz6b4/OLxgfBiikRGzPQDHg3R5LX+SQOll24c/DMtwpPwizNuFEiCFcRmJ9uc1t0HWEerIZe5uqm7AtE/nMXBsvDZ+hj4Tz/fEBF98a1k4WLYheN1exFidVkJgdAeiwMOOUQXw5KuIX62bxBdzsdcd0QGwxiXo="
Expand Down

0 comments on commit 241c642

Please sign in to comment.