Repository navigation
141 lines (116 loc) · 3.92 KB
/
Copy pathtester.yml
File metadata and controls
141 lines (116 loc) · 3.92 KB
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
138
139
140
141
name: "🎳 Tester"
on:
push:
branches:
- main
- dev*
paths:
- '**.py'
- .github/workflows/tester.yml
- requirements/testing.txt
pull_request:
branches:
- main
paths:
- '**.py'
- .github/workflows/tester.yml
- requirements/testing.txt
env:
PROJECT_FOLDER: "loopstructural"
jobs:
tests-unit:
runs-on: ubuntu-latest
# 3.10 is the oldest Python of a supported QGIS build (3.44 LTR on Ubuntu 22.04).
# 3.12 is the Python of the QGIS Windows (OSGeo4W) installers.
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]
steps:
- name: Get source code
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
cache: "pip"
cache-dependency-path: "requirements/testing.txt"
python-version: ${{ matrix.python-version }}
- name: Install Python requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/testing.txt
- name: Run Unit tests
run: pytest -p no:qgis tests/unit/
- name: Coverage summary
if: always()
run: python -m coverage report --format=markdown >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-unit-py${{ matrix.python-version }}
path: |
coverage.xml
htmlcov/
junit/test-results.xml
if-no-files-found: warn
test-qgis:
runs-on: ubuntu-latest
# 3.44-jammy: the current LTR, with Python 3.10. 4.2: the latest release, with Qt6.
strategy:
fail-fast: false
matrix:
qgis-image: ["3.44-jammy", "4.2"]
container:
image: qgis/qgis:${{ matrix.qgis-image }}
env:
CI: true
DISPLAY: ":1"
MUTE_LOGS: true
NO_MODALS: "1"
PYTHONPATH: "/usr/share/qgis/python/plugins:/usr/share/qgis/python:."
QT_QPA_PLATFORM: "offscreen"
WITH_PYTHON_PEP: "false"
options: -v /tmp/.X11-unix:/tmp/.X11-unix -v ${{ github.workspace }}:/tests_directory
steps:
- name: Get source code
uses: actions/checkout@v7
- name: Print QGIS version
run: qgis --version
- name: Install system packages (GDAL/PROJ/GEOS build deps)
run: |
set -e
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential gdal-bin libgdal-dev proj-bin libproj-dev libgeos-dev python3-dev python3-venv xvfb
rm -rf /var/lib/apt/lists/*
- name: Setup plugin
run: bash /tests_directory/scripts/qgis_setup.sh loopstructural
# Install into a venv that can see the system packages (QGIS). Then pip and setuptools
# can be upgraded without changes to the Debian packages (PEP 668, no RECORD files).
- name: Create virtual environment
run: |
python3 -m venv --system-site-packages /opt/venv
echo "/opt/venv/bin" >> "$GITHUB_PATH"
- name: Install Python requirements
run: |
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U -r requirements/testing.txt
python3 -m pip install -U -r /tests_directory/loopstructural/requirements.txt
- name: Run Unit tests
run: |
Xvfb :1 &
python3 -m pytest tests/qgis/
- name: Coverage summary
if: always()
run: python3 -m coverage report --format=markdown >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-qgis-${{ matrix.qgis-image }}
path: |
coverage.xml
htmlcov/
junit/test-results.xml
if-no-files-found: warn