Skip to content

Commit

Permalink
chore(dev): Add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
R2ZER0 committed Jun 17, 2024
1 parent c6c65b3 commit d25cb5f
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 22 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Semantic Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-24.04
concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Python Semantic Release
uses: python-semantic-release/[email protected]
with:
# Note: This token expires July 2025
# See: https://python-semantic-release.readthedocs.io/en/latest/index.html#index-creating-vcs-releases
github_token: ${{ secrets.GH_TOKEN_FOR_SEMANTIC_CI_RELEASE }}
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Need to use system python to access QGIS libraries
python system
2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__version__ = "0.1.0"

import logging

from .plugin import OFDSDedupPlugin
Expand Down
1 change: 1 addition & 0 deletions dev_requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ mypy>=1.8,<2
PyQt5-stubs
qgis-stubs
pip-tools
python-semantic-release
69 changes: 57 additions & 12 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile dev_requirements.in
#
annotated-types==0.7.0
# via pydantic
astor==0.8.1
# via flake8-qgis
attrs==23.2.0
Expand All @@ -12,14 +14,22 @@ black==24.3.0
# via -r dev_requirements.in
build==1.2.1
# via pip-tools
certifi==2024.6.2
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# black
# click-option-group
# pip-tools
# python-semantic-release
click-option-group==0.5.6
# via python-semantic-release
coverage[toml]==7.4.4
# via pytest-cov
exceptiongroup==1.2.0
# via pytest
dotty-dict==1.3.1
# via python-semantic-release
flake8==7.0.0
# via
# -r dev_requirements.in
Expand All @@ -29,12 +39,28 @@ flake8-bugbear==24.2.6
# via -r dev_requirements.in
flake8-qgis==1.0.0
# via -r dev_requirements.in
gitdb==4.0.11
# via gitpython
gitpython==3.1.43
# via python-semantic-release
idna==3.7
# via requests
importlib-resources==6.4.0
# via python-semantic-release
iniconfig==2.0.0
# via pytest
isort==5.13.2
# via -r dev_requirements.in
jinja2==3.1.4
# via python-semantic-release
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.5
# via jinja2
mccabe==0.7.0
# via flake8
mdurl==0.1.2
# via markdown-it-py
mypy==1.9.0
# via -r dev_requirements.in
mypy-extensions==1.0.0
Expand All @@ -56,8 +82,14 @@ pluggy==1.4.0
# via pytest
pycodestyle==2.11.1
# via flake8
pydantic==2.7.4
# via python-semantic-release
pydantic-core==2.18.4
# via pydantic
pyflakes==3.2.0
# via flake8
pygments==2.18.0
# via rich
pyproject-hooks==1.0.0
# via
# build
Expand All @@ -75,21 +107,34 @@ pytest-cov==5.0.0
# via -r dev_requirements.in
pytest-qgis==2.0.0
# via -r dev_requirements.in
python-gitlab==4.6.0
# via python-semantic-release
python-semantic-release==9.8.2
# via -r dev_requirements.in
qgis-stubs==0.2.0.post1
# via -r dev_requirements.in
tomli==2.0.1
requests==2.32.3
# via
# black
# build
# coverage
# mypy
# pip-tools
# pyproject-hooks
# pytest
# python-gitlab
# python-semantic-release
# requests-toolbelt
requests-toolbelt==1.0.0
# via python-gitlab
rich==13.7.1
# via python-semantic-release
shellingham==1.5.4
# via python-semantic-release
smmap==5.0.1
# via gitdb
tomlkit==0.12.5
# via python-semantic-release
typing-extensions==4.11.0
# via
# black
# mypy
# pydantic
# pydantic-core
urllib3==2.2.1
# via requests
wheel==0.43.0
# via pip-tools

Expand Down
2 changes: 1 addition & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name=OFDS Consolidation Tool
description=A tool to consolidate multiple data sets formatted using the Open Fibre Data Standard
about=A tool to consolidate multiple data sets formatted using the Open Fibre Data Standard
version=0.1
version=0.1.0
qgisMinimumVersion=3.28
author=ODSC
[email protected]
Expand Down
3 changes: 3 additions & 0 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from .tool.tool import OFDSDedupToolDialog
from .tool.style import OFDSStyleToolDialog
from . import __version__

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -50,6 +51,7 @@ def unload(self):

def run_consolidate(self):
logger.debug("Opening OFDS Consolidate Tool Dialog")
logger.debug(f"OFDS Consolidation Tool Plugin v{__version__}")
logger.debug(
f"Qt: v{QT_VERSION_STR} PyQt: v{PYQT_VERSION_STR} Python: {sys.version}"
)
Expand All @@ -63,6 +65,7 @@ def run_consolidate(self):

def run_style(self):
logger.debug("Opening OFDS Style Tool Dialog")
logger.debug(f"OFDS Consolidation Tool Plugin v{__version__}")
project = QgsProject.instance()
if not project:
raise Exception
Expand Down
73 changes: 64 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,25 @@ version = "0.1.0"
requires-python = ">=3.8"

authors = [
{name = "ODSC", email = "[email protected]"}
{ name = "ODSC", email = "[email protected]" }
]
description = "A tool to consolidate multiple fibre network datasets formatted using the Open Fibre Data Standard"
readme = "README.md"
license = {file = "LICENSE"}
license = { file = "LICENSE" }
keywords = ["open", "fibre", "data", "standard", "ofds", "consolidation", "tool", "gis", "qgis"]

# See: https://pypi.org/classifiers/
classifiers = [
# Development Status
"Development Status :: 2 - Pre-Alpha",

"Development Status :: 3 - Alpha",
# Environment
"Environment :: Plugins",

# Indicate who your project is intended for
"Intended Audience :: Telecommunications Industry",
"Topic :: Desktop Environment",
"Topic :: Scientific/Engineering :: GIS",

# License
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",

# Specify the Python versions you support here.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
Expand All @@ -46,7 +42,7 @@ testpaths = [

[tool.black]
line-length = 88
force-exclude = "gui.py" # gui.py is generated by pyuic5, so don't format it
force-exclude = "gui(_style)?.py" # gui.py is generated by pyuic5, so don't format it

[tool.isort]
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#isort
Expand All @@ -60,5 +56,64 @@ warn_unused_configs = true
check_untyped_defs = true
exclude = [
"gui.py",
"gui_style.py",
"_lib/jellyfish/_jellyfish.py",
]
]

[tool.semantic_release]
assets = []
build_command_env = []
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
commit_parser = "angular"
logging_use_named_masks = false
major_on_zero = true
allow_zero_version = true
no_git_verify = false
tag_format = "v{version}"
version_variables = ["__init__.py:__version__"]
toml_variables = ["metadata.txt:general.version"]

[tool.semantic_release.branches.main]
match = '(main|master)'
prerelease_token = "rc"
prerelease = false

[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = []

[tool.semantic_release.changelog.environment]
block_start_string = "{%"
block_end_string = "%}"
variable_start_string = "{{"
variable_end_string = "}}"
comment_start_string = "{#"
comment_end_string = "#}"
trim_blocks = false
lstrip_blocks = false
newline_sequence = "\n"
keep_trailing_newline = false
extensions = []
autoescape = true

[tool.semantic_release.commit_author]
env = "GIT_COMMIT_AUTHOR"
default = "semantic-release <semantic-release>"

[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0

[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = false
insecure = false

[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
upload_to_vcs_release = false # TODO: create release zip

0 comments on commit d25cb5f

Please sign in to comment.