Skip to content

Commit a179940

Browse files
authored
ci: test on Python 3.10/3.12 and QGIS 3.44 LTR/4.2, use one line length, guard the pin bump (#147)
* ci: test on Python 3.12, use one line length, guard the pin bump - Set PYTHON_VERSION to 3.12 in tester.yml. LoopStructural uses 'str | None' annotations (loop_common/base.py), which fail on 3.9. - Use a line length of 100 in setup.cfg (isort), pylintrc and blackdoc, to agree with black, ruff and the pyproject isort config. - In bump-loopstructural-pin.yml, stop the workflow when the release manifest does not give a valid version. Before, the workflow wrote 'LoopStructural~=null'. * ci: test on Python 3.10 and 3.12, and on QGIS 3.44 LTR and 4.2 - Run the unit tests on Python 3.10 (QGIS 3.44 LTR on Ubuntu 22.04) and on 3.12 (QGIS on Windows). - Run the QGIS tests on qgis/qgis:3.44-jammy and qgis/qgis:4.2, not on release-3_28. - Set PIP_BREAK_SYSTEM_PACKAGES, because newer images mark the system Python as externally managed. Do not upgrade the system pip. - Give each matrix job its own coverage artifact name. * ci: install the QGIS test requirements in a venv Use a venv with --system-site-packages, so that QGIS stays importable and pip can upgrade packages without uninstalling Debian packages. This fixes two failures: - 4.2: pip could not uninstall the Debian 'packaging' (no RECORD file). - 3.44-jammy: the old system pip and setuptools read the loopprojectfile sdist metadata as 'unknown'. The venv upgrades pip and setuptools.
1 parent fd778b1 commit a179940

5 files changed

Lines changed: 34 additions & 14 deletions

File tree

‎.github/workflows/bump-loopstructural-pin.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ jobs:
2323
# can return whichever component's release was published last, not
2424
# necessarily the LoopStructural package. Read the manifest instead —
2525
# it maps package name to version unambiguously.
26-
latest=$(curl -s https://raw.githubusercontent.com/Loop3D/LoopStructural/master/.release-please-manifest.json | jq -r '.["LoopStructural"]')
26+
latest=$(curl -fsS https://raw.githubusercontent.com/Loop3D/LoopStructural/master/.release-please-manifest.json | jq -r '.["LoopStructural"] // empty')
27+
if ! [[ "$latest" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
28+
echo "::error::Could not read a valid LoopStructural version from the release manifest (got '${latest}')."
29+
exit 1
30+
fi
2731
echo "version=$latest" >> "$GITHUB_OUTPUT"
2832
2933
- name: Bump pins if minor version changed

‎.github/workflows/tester.yml‎

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ on:
2020

2121
env:
2222
PROJECT_FOLDER: "loopstructural"
23-
PYTHON_VERSION: 3.9
2423

2524

2625
jobs:
2726
tests-unit:
2827
runs-on: ubuntu-latest
2928

29+
# 3.10 is the oldest Python of a supported QGIS build (3.44 LTR on Ubuntu 22.04).
30+
# 3.12 is the Python of the QGIS Windows (OSGeo4W) installers.
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
python-version: ["3.10", "3.12"]
35+
3036
steps:
3137
- name: Get source code
3238
uses: actions/checkout@v7
@@ -36,7 +42,7 @@ jobs:
3642
with:
3743
cache: "pip"
3844
cache-dependency-path: "requirements/testing.txt"
39-
python-version: ${{ env.PYTHON_VERSION }}
45+
python-version: ${{ matrix.python-version }}
4046

4147
- name: Install Python requirements
4248
run: |
@@ -54,7 +60,7 @@ jobs:
5460
if: always()
5561
uses: actions/upload-artifact@v7
5662
with:
57-
name: coverage-unit
63+
name: coverage-unit-py${{ matrix.python-version }}
5864
path: |
5965
coverage.xml
6066
htmlcov/
@@ -64,8 +70,14 @@ jobs:
6470
test-qgis:
6571
runs-on: ubuntu-latest
6672

73+
# 3.44-jammy: the current LTR, with Python 3.10. 4.2: the latest release, with Qt6.
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
qgis-image: ["3.44-jammy", "4.2"]
78+
6779
container:
68-
image: qgis/qgis:release-3_28
80+
image: qgis/qgis:${{ matrix.qgis-image }}
6981
env:
7082
CI: true
7183
DISPLAY: ":1"
@@ -88,13 +100,20 @@ jobs:
88100
set -e
89101
apt-get update
90102
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
91-
build-essential gdal-bin libgdal-dev proj-bin libproj-dev libgeos-dev python3-dev xvfb
103+
build-essential gdal-bin libgdal-dev proj-bin libproj-dev libgeos-dev python3-dev python3-venv xvfb
92104
rm -rf /var/lib/apt/lists/*
93105
94106
- name: Setup plugin
95107
run: bash /tests_directory/scripts/qgis_setup.sh loopstructural
96108

97109

110+
# Install into a venv that can see the system packages (QGIS). Then pip and setuptools
111+
# can be upgraded without changes to the Debian packages (PEP 668, no RECORD files).
112+
- name: Create virtual environment
113+
run: |
114+
python3 -m venv --system-site-packages /opt/venv
115+
echo "/opt/venv/bin" >> "$GITHUB_PATH"
116+
98117
- name: Install Python requirements
99118
run: |
100119
python3 -m pip install -U pip setuptools wheel
@@ -114,7 +133,7 @@ jobs:
114133
if: always()
115134
uses: actions/upload-artifact@v7
116135
with:
117-
name: coverage-qgis
136+
name: coverage-qgis-${{ matrix.qgis-image }}
118137
path: |
119138
coverage.xml
120139
htmlcov/

‎linters/pylintrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ additional-builtins=
128128
[FORMAT]
129129

130130
# Maximum number of characters on a single line.
131-
max-line-length=88
131+
max-line-length=100
132132

133133
# Regexp for a line that is allowed to be longer than the limit.
134134
ignore-long-lines=^\s*(# )?<?https?://\S+>?$

‎pyproject.toml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ target-version = ['py39']
1313
exclude = '\.eggs|\.git|\.mypy_cache|\.tox|\.venv|_build|buck-out|build|dist|node_modules'
1414

1515
[tool.blackdoc]
16-
# From https://numpydoc.readthedocs.io/en/latest/format.html
17-
# Extended discussion: https://github.com/pyvista/pyvista/pull/4129
18-
# The length of docstring lines should be kept to 75 characters to facilitate
19-
# reading the docstrings in text terminals.
20-
line-length = 75
16+
line-length = 100
17+
2118
[tool.ruff]
2219
exclude = ['.git', 'pycache__', 'build', 'dist', 'doc/examples', 'doc/_build']
2320
line-length = 100

‎setup.cfg‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github_organization_slug = Loop3D
1616
ensure_newline_before_comments = True
1717
force_grid_wrap = 0
1818
include_trailing_comma = True
19-
line_length = 88
19+
line_length = 100
2020
multi_line_output = 3
2121
profile = black
2222
use_parentheses = True

0 commit comments

Comments
 (0)