Skip to content

Commit

Permalink
Fix OGC workflow (#43946)
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Jun 28, 2021
1 parent 8cb7fa0 commit 574a35e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
1 change: 1 addition & 0 deletions .ci/ogc/Dockerfile
Expand Up @@ -6,6 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
ccache \
cmake \
ninja-build \
clang \
Expand Down
14 changes: 14 additions & 0 deletions .ci/ogc/build.sh
@@ -1,9 +1,20 @@
#!/bin/bash

set -e

mkdir /usr/src/qgis/build
cd /usr/src/qgis/build || exit 1

export CCACHE_TEMPDIR=/tmp
# Github workflow cache max size is 2.0, but ccache data get compressed (roughly 1/5?)
ccache -M 2.0G

# Temporarily uncomment to debug ccache issues
# export CCACHE_LOGFILE=/tmp/cache.debug
ccache -z

cmake -GNinja \
-DUSE_CCACHE=ON \
-DWITH_QUICK=OFF \
-DWITH_3D=OFF \
-DWITH_STAGED_PLUGINS=OFF \
Expand Down Expand Up @@ -31,3 +42,6 @@ cmake -GNinja \
..

ninja

echo "ccache statistics"
ccache -s
2 changes: 1 addition & 1 deletion .ci/ogc/docker-compose.yml
Expand Up @@ -15,7 +15,7 @@ services:
- qgis-server

qgis-server:
image: qgis_server_deps
image: ${DOCKER_IMAGE}
container_name: qgis_server_deps
volumes:
- ./../../:/usr/src/qgis/
Expand Down
47 changes: 42 additions & 5 deletions .github/workflows/ogc.yml
Expand Up @@ -19,17 +19,52 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Setup build dependencies
run: |
docker build -t qgis_server_deps -f .ci/ogc/Dockerfile .ci/ogc/
- name: Prepare build cache for pull request
uses: pat-s/always-upload-cache@v2.1.5
if: github.event_name == 'pull_request'
with:
path: /home/runner/QGIS/.ccache
key: build-ccache-ogc-${{ 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-ogc-${{ github.actor }}-${{ github.head_ref }}-
build-ccache-ogc-refs/heads/${{ github.base_ref }}-
build-ccache-ogc-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
uses: pat-s/always-upload-cache@v2.1.5
if: github.event_name != 'pull_request'
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-ogc-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-ccache-ogc-${{ github.ref }}-
build-ccache-ogc-refs/heads/master-
- 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: qgis-deps-ogc
context: .ci/ogc
dockerfile: Dockerfile
push_git_tag: true
push_image_and_stages: on:push
pull_image_and_stages: ${{ github.event_name != 'workflow_dispatch' }}

- name: Run build
run: |
docker run -v $(pwd):/usr/src/qgis qgis_server_deps /usr/src/qgis/.ci/ogc/build.sh
docker run -v $(pwd):/usr/src/qgis -v /home/runner/QGIS/.ccache:/root/.ccache ${DOCKER_IMAGE} /usr/src/qgis/.ci/ogc/build.sh
env:
DOCKER_IMAGE: ${{ steps.docker-build.outputs.FULL_IMAGE_NAME }}

- name: Install pyogctest
run: |
sudo apt-get install python3-virtualenv virtualenv git
sudo apt-get update && sudo apt-get install python3-virtualenv virtualenv git
git clone https://github.com/pblottiere/pyogctest
cd pyogctest && git checkout 1.0.4 && cd -
virtualenv -p /usr/bin/python3 venv && source venv/bin/activate && pip install -e pyogctest/
Expand All @@ -42,3 +77,5 @@ jobs:
run: |
docker-compose -f .ci/ogc/docker-compose.yml up -d
source venv/bin/activate && ./pyogctest/pyogctest.py -n ogc_qgis -s wms130 -v -u http://$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' qgis_server_nginx)/qgisserver
env:
DOCKER_IMAGE: ${{ steps.docker-build.outputs.FULL_IMAGE_NAME }}

0 comments on commit 574a35e

Please sign in to comment.