Skip to content

Commit

Permalink
use single workflows for all Qt versions
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jul 20, 2021
1 parent 8798653 commit 24d7c79
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 80 deletions.
File renamed without changes.
@@ -1,9 +1,9 @@

ARG UBUNTU_BASE=20.04
ARG DISTRO_VERSION=20.04

# Oracle Docker image is too large, so we add as less dependencies as possible
# so there is enough space on GitHub runner
FROM ubuntu:${UBUNTU_BASE} as binary-for-oracle
FROM ubuntu:${DISTRO_VERSION} as binary-for-oracle
MAINTAINER Denis Rouzaud <denis@opengis.ch>

LABEL Description="Docker container with QGIS dependencies" Vendor="QGIS.org" Version="1.0"
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/qt6.yml

This file was deleted.

69 changes: 43 additions & 26 deletions .github/workflows/run-tests.yml
Expand Up @@ -37,9 +37,14 @@ jobs:
matrix:
# tests run on 20.04 (Qt 5.12), compile test on 20.10 (Qt 5.14) and 21.04 (Qt 5.15)
include:
- ubuntu-base: '20.04'
- distro-version: '20.04'
qt-version: 5
run-tests: true
- ubuntu-base: '21.04'
- distro-version: '21.04'
qt-version: 5
run-tests: false
- distro-version: 'rawhide'
qt-version: 6
run-tests: false
fail-fast: false

Expand All @@ -58,7 +63,7 @@ jobs:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
GITHUB_PR_NUMBER: ${{github.event.number}}
UBUNTU_BASE: ${{ matrix.ubuntu-base }}
UBUNTU_BASE: ${{ matrix.distro-version }}
run: |
# Be aware that these instructions are duplicated in run-tests job
DOCKER_TAG=$(echo $( [[ ${GITHUB_EVENT_NAME} =~ ^pull_request$ ]] && echo ${GITHUB_BASE_REF} || echo ${GITHUB_REF##*/} ) | sed 's/^master$/latest/')$( [[ ${UBUNTU_BASE} != ${DEFAULT_UBUNTU_BASE} ]] && echo "_${UBUNTU_BASE}" || echo "" )
Expand All @@ -78,18 +83,30 @@ jobs:
echo PATCH_QT_3D: ${PATCH_QT_3D}
echo WITH_3D: ${WITH_3D}
- name: Build deps
env:
UBUNTU_BASE: ${{ matrix.ubuntu-base }}
- name: Build Docker Container with Build Environment
id: docker-build
uses: whoan/docker-build-with-cache-action@v5
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
image_name: qgis3-qt6-build-deps
dockerfile: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile
build_extra_args: "--build-arg=DISTRO_VERSION=${{ matrix.distro-version }}"
push_git_tag: true
push_image_and_stages: on:push
pull_image_and_stages: ${{ github.event_name != 'workflow_dispatch' }}

- name: Tag image
run: |
pushd .docker
docker pull qgis/qgis3-build-deps:${DOCKER_TAG} || true
docker build --build-arg UBUNTU_BASE=${UBUNTU_BASE} --cache-from qgis/qgis3-build-deps:${DOCKER_TAG} -t qgis/qgis3-build-deps:${DOCKER_TAG} -f qgis3-build-deps.dockerfile .
popd
docker tag ${DOCKER_IMAGE} qgis3-build-deps
env:
DOCKER_IMAGE: ${{ steps.docker-build.outputs.FULL_IMAGE_NAME }}

- name: Push deps image
if: ${{ github.repository_owner == 'qgis' && github.event_name != 'pull_request' }}
- name: Push Qt5 deps image to Docker hub
if: ${{ github.repository_owner == 'qgis' && github.event_name != 'pull_request' && matrix.qt-version == '5' }}
run: |
docker tag qgis3-build-deps qgis/qgis3-build-deps:${DOCKER_TAG}
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
docker push "qgis/qgis3-build-deps:${DOCKER_TAG}"
Expand All @@ -98,13 +115,13 @@ jobs:
if: github.event_name == 'pull_request'
with:
path: /home/runner/QGIS/.ccache
key: build-ccache-${{ matrix.ubuntu-base }}-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
key: build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
# The head_ref or source branch of the pull request in a workflow run.
# The base_ref or target branch of the pull request in a workflow run.
restore-keys: |
build-ccache-${{ matrix.ubuntu-base }}-${{ github.actor }}-${{ github.head_ref }}-
build-ccache-${{ matrix.ubuntu-base }}-refs/heads/${{ github.base_ref }}-
build-ccache-${{ matrix.ubuntu-base }}-refs/heads/master-
build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-${{ github.actor }}-${{ github.head_ref }}-
build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-refs/heads/${{ github.base_ref }}-
build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-refs/heads/master-
- name: Prepare build cache for branch/tag
# use a fork of actions/cache@v2 to upload cache even when the build or test failed
Expand All @@ -113,10 +130,10 @@ jobs:
with:
path: /home/runner/QGIS/.ccache
# The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>
key: build-ccache-${{ matrix.ubuntu-base }}-${{ github.ref }}-${{ github.sha }}
key: build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-ccache-${{ matrix.ubuntu-base }}-${{ github.ref }}-
build-ccache-${{ matrix.ubuntu-base }}-refs/heads/master-
build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-${{ github.ref }}-
build-ccache-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}-refs/heads/master-
- name: Compile QGIS
id: compile
Expand All @@ -127,8 +144,8 @@ jobs:
--env-file .docker/docker-variables.env \
--env PUSH_TO_CDASH=true \
--env WITH_3D=${WITH_3D} \
qgis/qgis3-build-deps:${DOCKER_TAG} \
/root/QGIS/.docker/docker-qgis-build.sh
qgis3-build-deps \
/root/QGIS/.docker/docker-qgis-build-${{ matrix.qt-version }}.sh
- name: Push artifact
id: push_artifact
Expand All @@ -144,7 +161,7 @@ jobs:

# - name: Test QGIS runners
# id: runners
# if: ${{ matrix.ubuntu-base == env.DEFAULT_UBUNTU_BASE }}
# if: ${{ matrix.distro-version == env.DEFAULT_UBUNTU_BASE }}
# run: |
# docker run -d --name qgis-testing-environment \
# -v $(pwd):/root/QGIS \
Expand Down Expand Up @@ -248,10 +265,10 @@ jobs:
strategy:
matrix:
# tests run on 20.04 (Qt 5.12), compile test on 20.10 (Qt 5.14)
ubuntu-base: [20.04]
distro-version: [20.04]
test-batch: [ALL_BUT_PROVIDERS, POSTGRES, ORACLE, HANA]
fail-fast: false

services:
# Run httpbin container for QgsNetwor* tests
httpbin:
Expand All @@ -276,7 +293,7 @@ jobs:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
GITHUB_PR_NUMBER: ${{github.event.number}}
UBUNTU_BASE: ${{ matrix.ubuntu-base }}
UBUNTU_BASE: ${{ matrix.distro-version }}
TEST_BATCH: ${{ matrix.test-batch }}
run: |
# Be aware that these instructions are duplicated in build job
Expand All @@ -297,7 +314,7 @@ jobs:
- name: Build deps
env:
UBUNTU_BASE: ${{ matrix.ubuntu-base }}
UBUNTU_BASE: ${{ matrix.distro-version }}
run: |
pushd .docker
TARGET=$( ( [[ ${TEST_BATCH} == "ORACLE" ]] && echo "binary-for-oracle" ) \
Expand Down

0 comments on commit 24d7c79

Please sign in to comment.