Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github workflow to build Docker images
- Loading branch information
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Build QGIS Docker images for current branches | ||
|
||
on: | ||
schedule: | ||
# runs every day | ||
# - cron: '0 0 * * *' | ||
# every hour | ||
- cron: '* */1 * * *' | ||
|
||
jobs: | ||
build-docker: | ||
# only run this workflow on the master branch ! | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
strategy: | ||
matrix: | ||
# branch: [master, release-3_10, release-3_14] | ||
branch: [build-docker] | ||
|
||
steps: | ||
- name: checkout ${branch} | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.branch }} | ||
|
||
- name: Build QGIS Docker image for branch ${{ matrix.branch }} | ||
env: | ||
branch: ${{ matrix.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 "docker tag: ${DOCKER_TAG}" | ||
echo "##[group] QGIS deps Docker pull/rebuild" | ||
cd .docker | ||
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]" | ||
2 comments
on commit 5adcc9f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@3nids did this change the published docker images? Several tests have been failing since ~20 hours (qgis libraries not found, import qgis python errors)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-kuhn I will try to fix this
This will always be true, GitHub runs the cron only on master branch...