-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (77 loc) · 3.33 KB
/
test_plugin.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
name: Test plugin
on:
push:
branches:
- main
- dev
paths:
- "geovita_processing_plugin/**"
- ".github/workflows/test_plugin.yml"
pull_request:
branches:
- main
- dev
paths:
- "geovita_processing_plugin/**"
- ".github/workflows/test_plugin.yml"
workflow_dispatch:
env:
# plugin name/directory where the code for the plugin is stored
PLUGIN_NAME: geovita_processing_plugin
# python notation to test running inside plugin
TESTS_RUN_FUNCTION: geovita_processing_plugin.test_suite.test_package
# Docker settings
DOCKER_IMAGE: qgis/qgis
jobs:
Test-geovita_processing_plugin:
runs-on: ubuntu-latest
strategy:
matrix:
docker_tags: [release-3_28, latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Docker pull and create qgis-testing-environment
run: |
docker pull "$DOCKER_IMAGE":${{ matrix.docker_tags }}
docker run -d -e XDG_RUNTIME_DIR=/tmp/runtime-root --name qgis-testing-environment -v ${{ github.workspace }}:/tests_directory -e DISPLAY=:99 "$DOCKER_IMAGE":${{ matrix.docker_tags }}
- name: List mounted directory contents
run: |
docker exec qgis-testing-environment ls -la /tests_directory
docker exec qgis-testing-environment ls -la /tests_directory/$PLUGIN_NAME
- name: Docker set up QGIS
run: |
docker exec qgis-testing-environment sh -c "qgis_setup.sh $PLUGIN_NAME"
docker exec qgis-testing-environment sh -c "cat /root/.local/share/QGIS/QGIS3/profiles/default/QGIS/QGIS3.ini"
docker exec qgis-testing-environment sh -c "rm -f /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
docker exec qgis-testing-environment sh -c "ln -s /tests_directory/$PLUGIN_NAME /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
docker exec qgis-testing-environment sh -c "pip3 install -r /tests_directory/REQUIREMENTS_TESTING.txt"
docker exec qgis-testing-environment sh -c "ls -l /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/"
docker exec qgis-testing-environment sh -c "ls -l /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
- name: Prepare REMEDY_GIS_RiskTool submodule
run: |
docker exec qgis-testing-environment sh -c "touch /tests_directory/$PLUGIN_NAME/REMEDY_GIS_RiskTool/__init__.py"
docker exec qgis-testing-environment ls -la /tests_directory/$PLUGIN_NAME/REMEDY_GIS_RiskTool
- name: Docker run plugin tests
run: |
docker exec qgis-testing-environment sh -c "export PYTHONPATH=/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins:$PYTHONPATH && qgis_testrunner.sh $TESTS_RUN_FUNCTION"
Check-code-quality:
runs-on: ubuntu-latest
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Checkout
uses: actions/checkout@v4
- name: Install packages
run: |
pip install -r REQUIREMENTS_TESTING.txt
pip install pylint pycodestyle
- name: Pylint
run: make pylint
- name: Pycodestyle
run: make pycodestyle