Skip to content

Commit af55592

Browse files
committed
Merge branch 'master' into prototype/layer-filtering
2 parents 6434c59 + d2633fc commit af55592

31 files changed

Lines changed: 721 additions & 697 deletions

.github/workflows/code_style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
- uses: actions/checkout@v2
1010
- uses: psf/black@stable
1111
with:
12-
options: "--check --diff --verbose -l 120"
12+
options: "--check --diff --verbose"
1313
version: 25.1.0
1414
src: "./Mergin"

.github/workflows/run-test.yml

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,89 @@
11
name: Run Mergin Plugin Tests
22

3-
on:
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
48
push:
59
workflow_dispatch:
610
inputs:
711
PYTHON_API_CLIENT_VER:
8-
description: 'python-api-client version: either a tag, release, or a branch'
12+
description: "python-api-client version: either a tag, release, or a branch"
913
required: true
10-
default: 'master'
14+
default: "master"
1115
type: string
1216

1317
env:
18+
CONDA_PKGS_DIRS: ~/conda_pkgs_dir
19+
DEBIAN_FRONTEND: noninteractive
20+
QT_QPA_PLATFORM: offscreen
21+
XDG_RUNTIME_DIR: /tmp
22+
QT_SCALE_FACTOR: 1
23+
QT_AUTO_SCREEN_SCALE_FACTOR: 0
24+
QT_FONT_DPI: 96
1425
# Assign the version provided by 'workflow_dispatch' if available; otherwise, use the default.
1526
PYTHON_API_CLIENT_VER: ${{ inputs.PYTHON_API_CLIENT_VER != '' && inputs.PYTHON_API_CLIENT_VER || 'master' }}
1627
PLUGIN_NAME: Mergin
17-
TEST_FUNCTION: suite.test_all
18-
DOCKER_IMAGE: qgis/qgis
1928

20-
concurrency:
21-
group: ci-${{github.ref}}-autotests
22-
cancel-in-progress: true
23-
2429
jobs:
2530
run-tests:
26-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-24.04
2732

2833
strategy:
34+
fail-fast: false
2935
matrix:
30-
docker_tags: [release-3_22, release-3_34]
36+
qgis-version: ["3.22", "3.28", "3.34", "3.40", "3.44"]
3137

3238
steps:
39+
- name: Checkout plugin code
40+
uses: actions/checkout@v6
41+
with:
42+
path: plugin
3343

34-
- name: Checkout client code
35-
uses: actions/checkout@v3
44+
- name: Checkout python-client
45+
uses: actions/checkout@v6
3646
with:
3747
repository: MerginMaps/python-api-client
3848
ref: ${{ env.PYTHON_API_CLIENT_VER }}
3949
path: client
4050

51+
- name: Cache conda packages
52+
uses: actions/cache@v4
53+
with:
54+
path: ~/conda_pkgs_dir
55+
key: conda-pkgs-${{ runner.os }}-${{ matrix.qgis-version }}
56+
57+
- name: Setup conda
58+
uses: conda-incubator/setup-miniconda@v3
59+
with:
60+
use-mamba: true
61+
channels: conda-forge,defaults
62+
63+
- name: Create environment and install QGIS
64+
run: |
65+
conda create -n qgis_env --no-default-packages --yes
66+
conda install -n qgis_env qgis=${{ matrix.qgis-version }} pytest pytest-qt pytest-cov --yes
67+
conda run -n qgis_env pip install --no-cache-dir pytest-qgis
68+
# mergin cilent dependencies
69+
conda run -n qgis_env pip install python-dateutil pytz wheel
70+
4171
- name: Install python-api-client dependencies
4272
run: |
43-
pip3 install python-dateutil pytz wheel
4473
cd client
4574
mkdir -p mergin/deps
46-
pip3 install pygeodiff --target=mergin/deps
47-
python3 setup.py sdist bdist_wheel
75+
conda run -n qgis_env pip install pygeodiff --target=mergin/deps
76+
conda run -n qgis_env python setup.py sdist bdist_wheel
4877
# without __init__.py the deps dir may get recognized as "namespace package" in python
4978
# and it can break qgis plugin unloading mechanism - see #126
5079
touch mergin/deps/__init__.py
51-
pip3 wheel -r mergin_client.egg-info/requires.txt -w mergin/deps
80+
conda run -n qgis_env pip wheel -r mergin_client.egg-info/requires.txt -w mergin/deps
5281
unzip -o mergin/deps/pygeodiff-*.whl -d mergin/deps
5382
54-
- name: Checkout plugin code
55-
uses: actions/checkout@v3
56-
with:
57-
path: plugin
58-
59-
- name: Copy client files to the plugin directory
60-
run: |
61-
cp -r client/mergin plugin/Mergin
62-
63-
- name: Docker pull and create qgis-testing-environment
64-
run: |
65-
docker pull "$DOCKER_IMAGE":${{ matrix.docker_tags }}
66-
docker run -d --name qgis-testing-environment -v "$GITHUB_WORKSPACE"/plugin:/tests_directory -e DISPLAY=:99 "$DOCKER_IMAGE":${{ matrix.docker_tags }}
67-
# Wait for xvfb to finish starting
68-
printf "Waiting for the docker...🐳..."
69-
sleep 10
70-
echo " done 🥩"
83+
- name: Copy client files to plugin directory
84+
run: cp -r client/mergin plugin/${{ env.PLUGIN_NAME }}
7185

72-
- name: Docker set up QGIS
73-
run: |
74-
docker exec qgis-testing-environment sh -c "qgis_setup.sh $PLUGIN_NAME"
75-
docker exec qgis-testing-environment sh -c "rm -f /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
76-
docker exec qgis-testing-environment sh -c "ln -s /tests_directory/$PLUGIN_NAME /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
77-
78-
- name: Docker run plugin tests
79-
run: |
80-
docker exec qgis-testing-environment sh -c "cd /tests_directory/$PLUGIN_NAME/test && qgis_testrunner.sh $TEST_FUNCTION"
86+
- name: Run tests
87+
run: conda run -n qgis_env pytest ${{ github.workspace }}/plugin/tests --cov=Mergin --cov-report=term-missing:skip-covered -rP -vv -s
88+
env:
89+
PYTHONPATH: ${{ github.workspace }}/plugin

.github/workflows/security_check.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: |
2020
# Upgrade pip and install security/linting tools
2121
python -m pip install --upgrade pip
22-
pip install bandit detect-secrets flake8 flake8-json
22+
pip install bandit detect-secrets flake8 flake8-json flake8-pyproject
2323
2424
- name: Run Bandit (Security Scan)
2525
# Scan the Mergin folder for vulnerabilities, excluding the test directory
@@ -30,7 +30,4 @@ jobs:
3030
run: detect-secrets scan ./Mergin/ --all-files
3131

3232
- name: Run Flake8 (Style Check)
33-
# Style enforcement using MerginMaps standards
34-
# Ignoring E501 (line length) and W503 (operator line breaks)
35-
run: |
36-
flake8 ./Mergin/ --max-line-length=120 --ignore=E501,W503 --exclude=test
33+
run: flake8 ./Mergin/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ Mergin/mergin
2121
.idea/
2222
.DS_Store
2323
mergin-py-client
24+
.qgis-settings

Mergin/test/__init__.py

Whitespace-only changes.

Mergin/test/suite.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

Mergin/test/test_help.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

Mergin/test/test_packaging.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)