Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run OGC tests for QGIS Server in continuous integration #38644

Merged
merged 10 commits into from
Sep 10, 2020
42 changes: 42 additions & 0 deletions .ci/ogc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM ubuntu:latest
MAINTAINER Paul Blottiere <blottiere.paul@gmail.com>
RUN export DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
cmake \
ninja-build \
ccache \
clang \
flex \
bison \
libgeos-dev \
libgdal-dev \
libzip-dev \
libprotobuf-dev \
qtbase5-dev \
libqt5svg5-dev \
libqt5serialport5-dev \
qttools5-dev \
protobuf-compiler \
qt5-default \
qtpositioning5-dev \
libqt5webkit5-dev \
libqca-qt5-2-dev \
libgsl-dev \
libspatialindex-dev \
qt5keychain-dev \
libexiv2-dev \
libfcgi-dev \
libqt5scintilla2-dev \
libqwt-qt5-dev \
pyqt5-dev \
python3-pyqt5 \
python3-pyqt5.qsci \
pyqt5-dev-tools \
spawn-fcgi

ADD qgis_mapserv.sh /root/qgis_mapserv.sh
CMD ["sh", "/root/qgis_mapserv.sh"]
36 changes: 36 additions & 0 deletions .ci/ogc/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

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

ccache -s

cmake -GNinja \
-DWITH_QUICK=OFF \
-DWITH_3D=OFF \
-DWITH_STAGED_PLUGINS=OFF \
-DWITH_GRASS=OFF \
-DSUPPRESS_QT_WARNINGS=ON \
-DENABLE_MODELTEST=OFF \
-DENABLE_PGTEST=OFF \
-DENABLE_SAGA_TESTS=OFF \
-DENABLE_MSSQLTEST=OFF \
-DWITH_QSPATIALITE=OFF \
-DWITH_QWTPOLAR=OFF \
-DWITH_APIDOC=OFF \
-DWITH_ASTYLE=OFF \
-DWITH_DESKTOP=OFF \
-DWITH_BINDINGS=ON \
-DWITH_SERVER=ON \
-DWITH_SERVER_PLUGINS=ON \
-DWITH_ORACLE=OFF \
-DDISABLE_DEPRECATED=ON \
-DCXX_EXTRA_FLAGS="${CLANG_WARNINGS}" \
-DCMAKE_C_COMPILER=/usr/lib/ccache/clang \
-DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ \
-DADD_CLAZY_CHECKS=OFF \
..

ninja

ccache -s
29 changes: 29 additions & 0 deletions .ci/ogc/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3'
services:

nginx:
image: nginx:1.13
container_name: qgis_server_nginx
ports:
- 8089:80
networks:
- qgis
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./../../data/metadata:/var/www/html/wms13/metadata
depends_on:
- qgis-server

qgis-server:
image: qgis_server_deps
container_name: qgis_server_deps
volumes:
- ./../../:/usr/src/qgis/
- ./../../data:/data
networks:
- qgis
privileged: true

networks:
qgis:
driver: bridge
32 changes: 32 additions & 0 deletions .ci/ogc/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
try_files $uri $uri/ =404;
}

location /qgisserver {
fastcgi_pass qgis-server:5555;
add_header Access-Control-Allow-Origin *;
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,X-Requested-With';
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param SERVER_PORT 80;
fastcgi_param SERVER_NAME $server_addr;
fastcgi_param QGIS_PROJECT_FILE /data/teamengine_wms_130.qgs;
}
}
7 changes: 7 additions & 0 deletions .ci/ogc/qgis_mapserv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

export QGIS_SERVER_LOG_FILE=/var/log/qgisserver.log
export QGIS_SERVER_LOG_LEVEL=0
export QGIS_PREFIX_PATH=/usr/src/qgis/build/output

exec /usr/bin/spawn-fcgi -n -p 5555 /usr/src/qgis/build/output/bin/qgis_mapserv.fcgi
48 changes: 48 additions & 0 deletions .github/workflows/ogc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: OGC tests for QGIS Server

on:
push:
branches:
- master
- release-**
pull_request:
branches:
- master
- release-**

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup build dependencies
run: |
docker build -t qgis_server_deps -f .ci/ogc/Dockerfile .ci/ogc/

- name: Cache
id: cache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ogc

- name: Run build
run: |
docker run -v ~/.ccache:/root/ccache -v $(pwd):/usr/src/qgis qgis_server_deps /usr/src/qgis/.ci/ogc/build.sh

- name: Install pyogctest
run: |
sudo apt-get install python3-virtualenv virtualenv git
git clone https://github.com/pblottiere/pyogctest
virtualenv -p /usr/bin/python3 venv && source venv/bin/activate && pip install -e pyogctest/

- name: Download WMS 1.3.0 dataset
run: |
source venv/bin/activate && ./pyogctest/pyogctest.py -s wms130 -w

- name: Run WMS 1.3.0 OGC tests
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