Skip to content

Commit 65b25bf

Browse files
authored
Merge pull request #9 from GispoCoding/ci-fix
Fix GH Actions
2 parents 979e0ca + c510058 commit 65b25bf

16 files changed

+197
-176
lines changed

.github/workflows/code-style.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: code-style
33
on:
44
pull_request:
55
push:
6-
branches: [master, main]
6+
branches: [main]
77

88
jobs:
99
code-style:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v2
14-
- uses: pre-commit/action@v2.0.2
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
- uses: pre-commit/action@v3.0.1

.github/workflows/release.yml

-31
This file was deleted.

.github/workflows/test-and-pre-release.yml

-118
This file was deleted.

.github/workflows/tests.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# workflow name
2+
name: Tests
3+
4+
# Controls when the action will run. Triggers the workflow on push or pull request
5+
# events but only for the wanted branches
6+
on:
7+
pull_request:
8+
push:
9+
branches: [main]
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
linux_tests:
14+
# The type of runner that the job will run on
15+
runs-on: ubuntu-latest
16+
container:
17+
image: qgis/qgis:${{ matrix.qgis-image-tags }}
18+
strategy:
19+
matrix:
20+
# Remove unsupported versions and add more versions. Use LTR version in the cov_tests job
21+
qgis-image-tags: [release-3_28, release-3_34, latest]
22+
fail-fast: false
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
31+
- name: Install dependencies
32+
run: |
33+
apt update && apt install python3-venv -y
34+
python3 -m venv --system-site-packages .venv
35+
.venv/bin/python -m pip install -U setuptools pip
36+
.venv/bin/pip install -r requirements-test.txt
37+
.venv/bin/pip install .
38+
39+
- name: Run tests
40+
env:
41+
QGIS_PLUGIN_IN_CI: 1
42+
QT_QPA_PLATFORM: offscreen
43+
run: |
44+
.venv/bin/pytest
45+
46+
windows_tests:
47+
runs-on: windows-latest
48+
49+
steps:
50+
- uses: actions/checkout@v2
51+
with:
52+
submodules: true
53+
54+
- name: Choco install qgis
55+
uses: crazy-max/ghaction-chocolatey@v1
56+
with:
57+
args: install qgis-ltr -y
58+
59+
- name: Run tests
60+
shell: pwsh
61+
run: |
62+
$env:QGIS_PATH = (Get-ChildItem "C:\Program Files\QGIS *\bin" | Select-Object -First 1 -ExpandProperty FullName)
63+
$env:PATH="$env:QGIS_PATH;$env:PATH"
64+
$env:QGIS_PLUGIN_IN_CI=1
65+
python-qgis-ltr.bat -m pip install -qr requirements-test.txt
66+
python-qgis-ltr.bat -m pip install .
67+
python-qgis-ltr.bat -m pytest -v

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
5+
rev: v4.6.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
1111
- repo: https://github.com/pre-commit/mirrors-mypy
12-
rev: v1.8.0
12+
rev: v1.11.2
1313
hooks:
1414
- id: mypy
1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.1.11
16+
rev: v0.6.5
1717
hooks:
1818
# Run the linter.
1919
- id: ruff

arho_feature_template/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from typing import TYPE_CHECKING
33

44
from arho_feature_template.qgis_plugin_tools.infrastructure.debugging import (
5-
setup_debugpy, # noqa F401
6-
setup_ptvsd, # noqa F401
7-
setup_pydevd, # noqa F401
5+
setup_debugpy, # noqa: F401
6+
setup_ptvsd, # noqa: F401
7+
setup_pydevd, # noqa: F401
88
)
99

1010
if TYPE_CHECKING:

arho_feature_template/core/feature_template_library.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FeatureTemplateLibrary:
1313
"""Class for storing FeatureTemplates and loading them from a JSON (or other conf. file)."""
1414

1515
def __init__(self, json_path: str | PathLike):
16-
self.templates = []
16+
self.templates: list[FeatureTemplate] = []
1717
library_dict = self.read_json(json_path)
1818
self.build_templates(library_dict)
1919

@@ -23,13 +23,13 @@ def read_json(self, json_path: str | PathLike) -> dict:
2323
return json.load(f)
2424

2525
def build_templates(self, library_dict: dict):
26-
templates = []
26+
templates: list[FeatureTemplate] = []
2727

2828
_templates_raw = library_dict["templates"]
2929
# for template_raw in templates_raw:
30-
## ... build FeatureTemplate from dict here, in FeatureTemplate class or elsewhere?
31-
# template = FeatureTemplate()
32-
# templates.append(template)
30+
## ... build FeatureTemplate from dict here, in FeatureTemplate class or elsewhere?
31+
# template = FeatureTemplate()
32+
# templates.append(template)
3333
self.templates = templates
3434

3535
def get_templates(self) -> Sequence[FeatureTemplate]:

arho_feature_template/core/forms/add_feature_form.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self, feature_template: FeatureTemplate):
1010

1111
def _init_feature_attributes(self):
1212
# for feature_attribute in self.feature_template.feature_attributes:
13-
# # Create the form here, add rows with labels and input fields
13+
# # Create the form here, add rows with labels and input fields
1414
pass
1515

1616
def save(self):

arho_feature_template/core/forms/feature_attribute_form.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
ui_path = resources.files(__package__) / "feature_attribute_form.ui"
99
FormClass, _ = uic.loadUiType(ui_path)
1010

11-
class FeatureAttributeForm(QDialog, FormClass):
11+
12+
class FeatureAttributeForm(QDialog, FormClass): # type: ignore
1213
"""Parent class for feature forms for adding and modifying feature attribute data."""
1314

1415
def __init__(self, feature_template: FeatureTemplate):

arho_feature_template/core/panels/template_library_panel.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
ui_path = resources.files(__package__) / "template_library_panel.ui"
99
FormClass, _ = uic.loadUiType(ui_path)
1010

11-
class TemplateLibraryPanel(QWidget, FormClass):
11+
12+
class TemplateLibraryPanel(QWidget, FormClass): # type: ignore
1213
"""Dock widget for selecting a feature template."""
1314

1415
def __init__(self, feature_template_library: FeatureTemplateLibrary):

arho_feature_template/plugin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
LIBRARY_JSON = resources_path("asemakaava-template-library-test.json")
1818

19+
1920
class Plugin:
2021
"""QGIS Plugin Implementation."""
2122

@@ -128,7 +129,7 @@ def unload(self) -> None:
128129
teardown_logger(Plugin.name)
129130

130131
def run(self) -> None:
131-
self.feature_template_dock= QgsDockWidget()
132+
self.feature_template_dock = QgsDockWidget()
132133
self.add_feature_panel = TemplateLibraryPanel(self.active_library)
133134
self.feature_template_dock.setWidget(self.add_feature_panel)
134135
self.feature_template_dock.setWindowTitle("ARHO") # NOTE: Placeholder name

pyproject.toml

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
[build-system]
2+
requires = ["setuptools >= 61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "arho-feature-template"
7+
version = "0.1.0"
8+
requires-python = ">= 3.8"
9+
10+
[tool.setuptools]
11+
packages = ["arho_feature_template"]
12+
113
[tool.pytest.ini_options]
214
addopts = "-v"
15+
testpaths = "tests"
316

417
[tool.coverage.report]
518
omit = ["arho_feature_template/qgis_plugin_tools/*"]

requirements-dev.in

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
# Debugging
2-
debugpy
31

4-
# Dependency maintenance
5-
pip-tools
2+
-c requirements-test.txt
63

7-
# Testing
8-
pytest
9-
pytest-cov
10-
pytest-qgis
4+
# Debugging
5+
debugpy
116

127
# Linting and formatting
138
pre-commit
@@ -18,3 +13,6 @@ flake8-qgis
1813

1914
# Stubs
2015
PyQt5-stubs
16+
17+
# repo itself
18+
-e file:.

0 commit comments

Comments
 (0)