-
-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (136 loc) · 6.43 KB
/
qgis_ltr_engine_releases.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: QGIS LTR integration tests IRMT vs Engine (LTR and latest)
on:
# NOTE: enables only scheduled or triggered manually, NOT on pull requests
workflow_dispatch:
inputs:
git-ref:
description: Git Ref
default: master
required: true
# push:
# branches:
# - '**'
schedule:
- cron: "0 3 * * *"
jobs:
Tests_and_docs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# NOTE: it would be better to point to lts and latest if possible
# NOTE: checking also master to make sure risk workshop demos keep working also on master
ENGINE_BR: ['engine-3.16', 'engine-3.21', 'master']
# NOTE: we might test also for qgis/qgis:3.22 that is the version of qgis-server that we are currently using in the Geoviewer, but it currently causes a segfault
# NOTE: qgis:stable points to the latest release, wheread qgis:latest points to qgis master
QGIS_DOCKER_VERSION: ['qgis/qgis:ltr', 'qgis/qgis:stable']
DEMOS: ['oqdata', 'risk-oqdata']
steps:
- uses: actions/checkout@v2
- name: 🐍 Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
ref: ${{ matrix.ENGINE_BR }}
- name: Prepare Start file for docker
run: |
set -x
$(cat << EOF > ./startX.sh
apt update --allow-releaseinfo-change
DEBIAN_FRONTEND=noninteractive apt install -y python3-scipy python3-matplotlib python3-pyqt5.qtwebkit python3-pytest python3-pexpect xvfb git expect
chmod +x /tests_directory/qgis_startup.py
cp /tests_directory/qgis_startup.py /usr/bin/
cp /tests_directory/qgis_testrunner.py /usr/bin/
export DISPLAY=:1.0
Xvfb :1 -screen 0 1024x768x16
EOF
)
curl -O https://raw.githubusercontent.com/qgis/QGIS/master/.docker/qgis_resources/test_runner/qgis_setup.sh
curl -O https://raw.githubusercontent.com/qgis/QGIS/master/.docker/qgis_resources/test_runner/qgis_testrunner.sh
curl -O https://raw.githubusercontent.com/qgis/QGIS/master/.docker/qgis_resources/test_runner/qgis_testrunner.py
curl -O https://raw.githubusercontent.com/qgis/QGIS/master/.docker/qgis_resources/test_runner/qgis_startup.py
chmod +x ./qgis_setup.sh
chmod +x ./qgis_testrunner.sh
chmod +x ./qgis_testrunner.py
chmod +x ./startX.sh
- name: ⏳ Clone engine and restore oqdata and docker container
run: |
set -x
ENGINE_BR=${{ matrix.ENGINE_BR }}
IRMT_BR=$ENGINE_BR
git fetch
git checkout $IRMT_BR
curl -O https://raw.githubusercontent.com/gem/oq-engine/master/install.py
ls -lrt install.py
echo "Using branch ${ENGINE_BR}"
if [ "$(git ls-remote --heads https://github.com/gem/oq-engine.git ${ENGINE_BR})" = "" ]; then
echo "Branch ${ENGINE_BR} not found in gem/oq-engine repository"
exit 1
fi
# get release version from branch name (e.g. 'engine-3.16' -> '3.16')
prefix="engine-"
if [[ $ENGINE_BR == ${prefix}* ]]; then
RELEASE_VERSION="${ENGINE_BR#${prefix}}"
else
RELEASE_VERSION=$ENGINE_BR
fi
python3 install.py user --version=${RELEASE_VERSION}
export PIP_DEFAULT_TIMEOUT=100
echo "Restore ${{matrix.DEMOS}} demos for $ENGINE_BR branch "
source $HOME/openquake/bin/activate
oq reset -y
oq restore https://artifacts.openquake.org/travis/${{matrix.DEMOS}}-${ENGINE_BR}.zip ~/oqdata
oq webui start 172.17.0.1:8800 --skip-browser &> webui.log &
echo "Waiting WEBUI up on port 8800...."
while ! nc -z 172.17.0.1 8800; do
sleep 5
done
curl http://172.17.0.1:8800/v1/engine_version
#
DOCKER_HOST=`ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+'`
ENGINE_HOST=`echo http://$DOCKER_HOST:8800`
docker run -d -t --name qgis -v /tmp/.X11-unix:/tmp/.X11-unix -v ${PWD}:/tests_directory -e OQ_ENGINE_HOST='http://172.17.0.1:8800' \
-e BRANCH="$IRMT_BR" -e ONLY_CALC_ID="$ONLY_CALC_ID" -e ONLY_OUTPUT_TYPE="$ONLY_OUTPUT_TYPE" -e GEM_QGIS_TEST=y ${{ matrix.QGIS_DOCKER_VERSION }} \
bash -c "/tests_directory/startX.sh"
sleep 10
- name: ℧ Run unit test
run: |
set -x
ENGINE_BR=${{ matrix.ENGINE_BR }}
IRMT_BR=$ENGINE_BR
git fetch
git checkout $IRMT_BR
# OGR_SQLITE_JOURNAL=delete prevents QGIS from using WAL, which modifies geopackages even if they are just read
docker exec -t qgis bash -c "export DISPLAY=:1.0; export PYTHONPATH=/usr/share/qgis/python/plugins/:$PYTHONPATH; OGR_SQLITE_JOURNAL=delete python3 -m pytest -v /tests_directory/svir/test/unit/"
- name: ⨕ Run Integration test
run: |
set -x
ENGINE_BR=${{ matrix.ENGINE_BR }}
IRMT_BR=$ENGINE_BR
git fetch
git checkout $IRMT_BR
# get release version from branch name (e.g. 'engine-3.16' -> '3.16')
prefix="engine-"
if [[ $ENGINE_BR == ${prefix}* ]]; then
RELEASE_VERSION="${ENGINE_BR#${prefix}}"
else
RELEASE_VERSION=$ENGINE_BR
fi
# NOTE: if we want to enable it, we need to use the proper folder after engine user installation
OQ_TEST_RUN_CALC=0
if [ "${{ matrix.DEMOS }}" != "risk-oqdata" -a "${RELEASE_VERSION}" != "3.16" ]; then
OQ_CHECK_MISSING_OUTPUTS=1
else
OQ_CHECK_MISSING_OUTPUTS=0
fi
echo "OQ_CHECK_MISSING_OUTPUTS: ${OQ_CHECK_MISSING_OUTPUTS}"
echo "OQ_TEST_RUN_CALC: ${OQ_TEST_RUN_CALC}"
# NOTE: the check on the existence of the engine branch is already done in the previous step
docker exec qgis sh -c "export DISPLAY=:1.0; echo 'Running against oq-engine on branch ${ENGINE_BR}'"
docker exec qgis sh -c "export DISPLAY=:1.0; /tests_directory/qgis_setup.sh svir"
docker exec -e OQ_CHECK_MISSING_OUTPUTS=${OQ_CHECK_MISSING_OUTPUTS} -e OQ_TEST_RUN_CALC=${OQ_TEST_RUN_CALC} \
-t qgis sh -c "export DISPLAY=:1.0; cd /tests_directory && ./qgis_testrunner.sh svir.test.integration.test_drive_oq_engine"
- name: ㏒ Display web logs
run: |
set -x
cat webui.log