Skip to content
Permalink
Browse files

try to buiÃld

  • Loading branch information
3nids committed Aug 20, 2020
1 parent 6e347ad commit 9b2a8d078d6b404e6033831fb101fee9a5f49ddb
Showing with 67 additions and 7 deletions.
  1. +67 −7 .github/workflows/build-docker-image.yml
@@ -13,24 +13,84 @@ on:
jobs:
build-docker:
# only run this workflow on the master branch !
# if: ${{ github.ref == 'refs/heads/build-docker' }}
if: ${{ github.ref == 'refs/heads/build-docker' }}

runs-on: ubuntu-latest

env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.$DOCKER_PASSWORD }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_CONTEXT: ${{ toJson(github) }}
github_ref: ${{ github.ref }}

strategy:
matrix:
branch: [master, release-3_10, release-3_14]
# branch: [master, release-3_10, release-3_14]
branch: build-docker

steps:
# - uses: actions/checkout@v2
- name: checkout ${branch}
uses: actions/checkout@v2
with:
ref: ${branch}

- name: Build QGIS Docker image for ${branch}
run: |
DOCKER_TAG=${branch//master/latest/}
DOCKER_BUILD_DEPS_FILE=qgis3-build-deps-focal.dockerfile
CC=/usr/lib/ccache/gcc
CXX=/usr/lib/ccache/g++ # Building SIP binding freezes with Clang in Docker, maybe a SIP issue, maybe not
echo "branch: ${branch}"
echo "GITHUB_CONTEXT: ${GITHUB_CONTEXT}"
echo "github_ref: ${github_ref}"
echo "docker tag: ${DOCKER_TAG}"
echo "##[group] QGIS deps Docker pull/rebuild"
docker --version
docker pull "qgis/qgis3-build-deps:${DOCKER_TAG}" || true
docker build --cache-from "qgis/qgis3-build-deps:${DOCKER_TAG}" -t "qgis/qgis3-build-deps:${DOCKER_TAG}" -f ${DOCKER_BUILD_DEPS_FILE} .
echo "push to qgis/qgis3-build-deps:${DOCKER_TAG}"
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push "qgis/qgis3-build-deps:${DOCKER_TAG}"
echo "##[endgroup]"
echo "##[group] Docker QGIS build"
DOCKER_BUILD_ARGS="--build-arg DOCKER_TAG --build-arg CC --build-arg CXX"
docker build ${DOCKER_BUILD_ARGS} \
--cache-from "qgis/qgis:${DOCKER_TAG}" \
-t "qgis/qgis:BUILDER" \
-f qgis.dockerfile ..
docker run --name qgis_container qgis/qgis:BUILDER /bin/true
# we could copy cache
# docker cp qgis_container:/QGIS/.ccache_image_build/. ${CCACHE_DIR}
echo "##[endgroup]"
echo "##[group] Finalize image"
# enable experimental features in Docker to squash
echo '{ "experimental": true}' | sudo tee /etc/docker/daemon.json
service docker restart
docker build ${DOCKER_BUILD_ARGS} \
--cache-from "qgis/qgis:BUILDER" \
--squash \
-t "qgis/qgis:${DOCKER_TAG}" \
-f qgis.dockerfile ..
echo "##[endgroup]"
echo "##[group] Pushing image to docker hub"
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push "qgis/qgis:${DOCKER_TAG}"
echo "##[endgroup]"
echo "##[group] Trigger build of PyQGIS Documentation"
body='{
"ref": "master",
"inputs": {"qgis_branch": "__QGIS_VERSION_BRANCH__"}
}'
body=$(sed "s/__QGIS_VERSION_BRANCH__/${TRAVIS_BRANCH}/;" <<< $body)
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
https://api.github.com/repos/qgis/pyqgis/actions/workflows/2246440/dispatches \
-d "${body}"
echo "##[endgroup]"

0 comments on commit 9b2a8d0

Please sign in to comment.
You can’t perform that action at this time.