-
Notifications
You must be signed in to change notification settings - Fork 20
89 lines (76 loc) · 2.96 KB
/
Copy pathrun-test.yml
File metadata and controls
89 lines (76 loc) · 2.96 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
name: Run Mergin Plugin Tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
workflow_dispatch:
inputs:
PYTHON_API_CLIENT_VER:
description: "python-api-client version: either a tag, release, or a branch"
required: true
default: "master"
type: string
env:
CONDA_PKGS_DIRS: ~/conda_pkgs_dir
DEBIAN_FRONTEND: noninteractive
QT_QPA_PLATFORM: offscreen
XDG_RUNTIME_DIR: /tmp
QT_SCALE_FACTOR: 1
QT_AUTO_SCREEN_SCALE_FACTOR: 0
QT_FONT_DPI: 96
# Assign the version provided by 'workflow_dispatch' if available; otherwise, use the default.
PYTHON_API_CLIENT_VER: ${{ inputs.PYTHON_API_CLIENT_VER != '' && inputs.PYTHON_API_CLIENT_VER || 'master' }}
PLUGIN_NAME: Mergin
jobs:
run-tests:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
qgis-version: [ "3.22", "3.28", "3.34", "3.40", "3.44" ]
steps:
- name: Checkout plugin code
uses: actions/checkout@v6
with:
path: plugin
- name: Checkout python-client
uses: actions/checkout@v6
with:
repository: MerginMaps/python-api-client
ref: ${{ env.PYTHON_API_CLIENT_VER }}
path: client
- name: Cache conda packages
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: conda-pkgs-${{ runner.os }}-${{ matrix.qgis-version }}
- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
use-mamba: true
channels: conda-forge,defaults
- name: Create environment and install QGIS
run: |
conda create -n qgis_env --no-default-packages --yes
conda install -n qgis_env qgis=${{ matrix.qgis-version }} pytest pytest-qt pytest-cov pip setuptools --yes
conda run -n qgis_env pip install --no-cache-dir pytest-qgis
# mergin cilent dependencies
conda run -n qgis_env pip install python-dateutil pytz wheel
- name: Install python-api-client dependencies
run: |
cd client
mkdir -p mergin/deps
conda run -n qgis_env pip install pygeodiff --target=mergin/deps
conda run -n qgis_env python setup.py sdist bdist_wheel
# without __init__.py the deps dir may get recognized as "namespace package" in python
# and it can break qgis plugin unloading mechanism - see #126
touch mergin/deps/__init__.py
conda run -n qgis_env pip wheel -r mergin_client.egg-info/requires.txt -w mergin/deps
unzip -o mergin/deps/pygeodiff-*.whl -d mergin/deps
- name: Copy client files to plugin directory
run: cp -r client/mergin plugin/${{ env.PLUGIN_NAME }}
- name: Run tests
run: conda run -n qgis_env pytest ${{ github.workspace }}/plugin/tests --cov=Mergin --cov-report=term-missing:skip-covered --no-cov-on-fail -rP -vv -s
env:
PYTHONPATH: ${{ github.workspace }}/plugin