Compare commits

...

17 Commits
1.2.0 ... 1.3.1

Author SHA1 Message Date
8049477a5c Merge pull request 'chore: dummy change' (#36) from dev into master
Reviewed-on: https://chacha.ddns.net/gitea/chacha/pygitversionhelper/pulls/36
new-tag:1.3.1
2023-09-24 20:31:09 +02:00
cclecle
d430907f12 chore: dummy change 2023-09-24 19:27:16 +01:00
a87a717b9e Merge pull request 'feat: add py.typed for mypy' (#35) from dev into master
Reviewed-on: https://chacha.ddns.net/gitea/chacha/pygitversionhelper/pulls/35
2023-09-24 20:24:51 +02:00
cclecle
0be71a4c3c feat: add py.typed for mypy 2023-09-24 19:21:29 +01:00
ca7a69ae76 Merge pull request 'dev' (#34) from dev into master
Reviewed-on: https://chacha.ddns.net/gitea/chacha/pygitversionhelper/pulls/34
new-tag:1.3.0
2023-09-24 20:18:10 +02:00
cclecle
114aa31115 cicd: add "--enable-incomplete-feature=Unpack" 2023-09-24 19:13:34 +01:00
cclecle
facd431c59 update docgen & cicd tools 2023-09-24 18:56:29 +01:00
d4b90b1f91 Merge pull request 'Fix title' (#33) from dev into master
Reviewed-on: https://chacha.ddns.net/gitea/chacha/pygitversionhelper/pulls/33
new-tag: 1.2.2
2023-03-28 02:39:04 +02:00
cclecle
a07bcc37c4 Fix title 2023-03-28 01:09:46 +01:00
ac70d4dde4 Merge pull request 'beautify jenkins file' (#32) from dev into master
Reviewed-on: https://chacha.ddns.net/gitea/chacha/pygitversionhelper/pulls/32
new-tag: 1.2.1
2023-03-28 02:05:30 +02:00
cclecle
0d1e981b6b beautify jenkins file 2023-03-28 01:01:10 +01:00
6e1c60ee53 Merge pull request 'dev' (#31) from dev into master
Reviewed-on: https://chacha.ddns.net/gitea/chacha/pygitversionhelper/pulls/31
newt-tag: 1.2.1
2023-03-28 01:55:24 +02:00
cclecle
b01779dd06 add missing parentheses 2023-03-28 00:50:43 +01:00
cclecle
f7ec5d98a7 fix changelog multiline 2023-03-28 00:45:48 +01:00
cclecle
82d4b1bd70 fix: remove useless printf in getMessagesSinceTag() 2023-03-28 00:45:00 +01:00
cclecle
880fa29bbd try to get changelog before tag creation 2023-03-28 00:35:00 +01:00
cclecle
7347106694 test printing changelog parts 2023-03-28 00:21:37 +01:00
12 changed files with 57 additions and 56 deletions

37
Jenkinsfile vendored
View File

@@ -26,7 +26,7 @@ def _bPreRelease = false
def _bDraft = false
// release content / changelog management
def _bAutoChangelog = true //Not supported yet
def _ReleaseContent_Title = "_CI/CD Automatic Release_"
def _ReleaseContent_Title = "# _CI/CD Automatic Release_"
def bPushMasterOnPypi = true
// full rebuild toogle
def _bFullRebuilt = true
@@ -148,6 +148,7 @@ pipeline {
PY_PROJECT_NAME = "__NOTSET__"
PY_PROJECT_VERSION = "__NOTSET__"
PY_PROJECT_VERSION_STRIPPED = "__NOTSET__"
CHANGELOG = "__NOTSET__"
}
stages {
@@ -215,6 +216,32 @@ pipeline {
withCredentials([usernamePassword(credentialsId: _SCMCredentials, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh("git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@chacha.ddns.net/gitea/${_PROJECT_USER_NAME}/${_PROJECT_NAME}.git")
}
CHANGELOG = sh(script: """#!/bin/sh -
|. ~/TOOLS_ENV/bin/activate
|exec python - << '__EOWRAPPER__'
|
|import re
|
|try:
| from pychangelogfactory import ChangelogFactory
|except ImportError:
| from src.pychangelogfactory import ChangelogFactory
|
|try:
| from pygitversionhelper import gitversionhelper
|except ImportError:
| from src.pygitversionhelper import gitversionhelper
|
|
|LastTag=gitversionhelper.tag.getLastTag(same_branch=True)
|CommitHistory=gitversionhelper.commit.getMessagesSinceTag(LastTag, merged_output=True, ignore_merged=True)
|Changelog = ChangelogFactory(CommitHistory).RenderFullChangelog(include_unknown=True)
|print(Changelog.replace("\\n","\\n\\n"))
|
|__EOWRAPPER__
""".stripMargin(),
returnStdout: true).trim()
if(_GIT_BRANCH=="master") {
if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty()) {
@@ -571,10 +598,6 @@ pipeline {
|from simple_rest_client.api import API
|from simple_rest_client.resource import Resource
|
|try:
| from pychangelogfactory import ChangelogFactory
|except ImportError:
| from src.pychangelogfactory import ChangelogFactory
|
|try:
| from pygitversionhelper import gitversionhelper
@@ -623,9 +646,7 @@ pipeline {
| + "\\n" \\
| + "Reference documentation: [mkdocs page](https://chacha.ddns.net/mkdocs-web/${_PROJECT_USER_NAME}/${PY_PROJECT_NAME}/${_GIT_BRANCH}/${PY_PROJECT_VERSION_STRIPPED}/) "
|
|LastTag=gitversionhelper.tag.getLastTag(same_branch=True)
|CommitHistory=gitversionhelper.commit.getMessagesSinceTag(LastTag, merged_output=True, ignore_merged=True)
|Changelog = ChangelogFactory(CommitHistory).RenderFullChangelog(include_unknown=True)
|Changelog='''${CHANGELOG}'''
|
|ReleaseContent = ReleaseContent + "\\n"+ "\\n"+ "## Changelog:\\n" + Changelog
|

View File

@@ -135,6 +135,6 @@ kwargs available to this function:
There is unfortunately some technical limitation :
* MultiThreading and async behavior is not tested.
* MultiThreading and async behavior is not tested / supported.
* Multiple tag on the same commit is not supported.
* Branch filter when searching for a version is only tested with -no-ff strategy

View File

@@ -22,7 +22,6 @@ if __package__ == "helpers":
from .quality_check import quality_check
from .unit_test import unit_test
from .doc_gen import doc_gen
from .changelog_gen import changelog_gen
from .complexity_check import complexity_check
else:
# when calling the __main__.py file (from IDE)
@@ -30,7 +29,6 @@ else:
from helpers.quality_check import quality_check
from helpers.unit_test import unit_test
from helpers.doc_gen import doc_gen
from helpers.changelog_gen import changelog_gen
from helpers.complexity_check import complexity_check
logging.getLogger().setLevel(logging.INFO)
@@ -59,8 +57,6 @@ if __name__ == "__main__":
"-pdf", "--doc-gen-pdf", dest="docgenpdf", action="store_true", help="enable pdf documentation export (requires doc-gen)"
)
parser.add_argument("-clg", "--changelog-gen", dest="changeloggen", action="store_true", help="enable changelog generation")
parser.add_argument("-cpc", "--complexity-check", dest="complexitycheck", action="store_true", help="enable complexity check")
args = parser.parse_args()
@@ -76,7 +72,6 @@ if __name__ == "__main__":
# args.coveragecheck = True
# args.docgen = True
# args.docgenpdf = True
# args.changeloggen = True
# args.complexitycheck = True
helpers = []
@@ -104,9 +99,6 @@ if __name__ == "__main__":
else:
raise RuntimeError("doc-gen is required to enable doc-gen-pdf")
if args.changeloggen == True:
helpers.append(changelog_gen)
if args.complexitycheck == True:
helpers.append(complexity_check)

View File

@@ -1,23 +0,0 @@
# pyChaChaDummyProject (c) by chacha
#
# pyChaChaDummyProject is licensed under a
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Unported License.
#
# You should have received a copy of the license along with this
# work. If not, see <https://creativecommons.org/licenses/by-nc-sa/4.0/>.
from __future__ import annotations
from typing import TYPE_CHECKING
# from pathlib import Path
# import os
# import datetime
from .helper_base import helper_base
class changelog_gen(helper_base):
@classmethod
def do_job(cls):
pass

View File

@@ -19,6 +19,7 @@ from radon.cli import Config
from radon.cli.harvest import CCHarvester, HCHarvester, MIHarvester
from .helper_base import helper_withresults_base
from pprint import pprint
class complexity_check(helper_withresults_base):

View File

@@ -50,6 +50,7 @@ class doc_gen(helper_withresults_base):
reference_path = doc_path / "reference"
cls._reset_dir(reference_path)
# create one .md per python module
for path in sorted((cls.project_rootdir_path / "src").rglob("*.py")):
module_path = path.relative_to(cls.project_rootdir_path / "src").with_suffix("")
doc_path = path.relative_to(cls.project_rootdir_path / "src").with_suffix(".md")
@@ -57,14 +58,12 @@ class doc_gen(helper_withresults_base):
parts = list(module_path.parts)
if parts[-1] == "__init__":
parts = parts[:-1]
elif parts[-1] == "__main__":
if parts[-1] in ("__init__", "__main__"):
continue
cls._reset_dir(os.path.dirname(full_doc_path))
cls._create_dir(full_doc_path.parent.resolve())
with open(full_doc_path, "w+") as fd:
identifier = "src." + ".".join(parts)
identifier = ".".join(parts)
print("::: " + identifier, file=fd)
cmdopts = [f"{sys.executable}", "-m", "mkdocs", "-v", "build", "--site-dir", str(site_path), "--clean"]
@@ -93,6 +92,7 @@ class doc_gen(helper_withresults_base):
with open(cls.project_rootdir_path / "mkdocs.yml", "w") as mkdocsCfgFile:
mkdocsCfgFile.write(yaml.dump(mkdocsCfg, Dumper=Dumper, default_flow_style=False, sort_keys=False))
print(" !! start doc generation")
res = cls.run_cmd(cmdopts)
print(res.decode())
print(" !! done")

View File

@@ -11,6 +11,7 @@ from typing import TYPE_CHECKING
from abc import ABC, abstractmethod
import os
import shutil
from pathlib import Path
import subprocess
@@ -34,11 +35,17 @@ class helper_base(ABC):
return None
@staticmethod
def _reset_dir(dirpath: Path):
def _create_dir(dirpath: Path):
dirpath = Path(dirpath)
if not os.path.exists(dirpath):
os.makedirs(dirpath)
[f.unlink() for f in Path(dirpath).glob("*") if f.is_file()]
@staticmethod
def _reset_dir(dirpath: Path):
dirpath = Path(dirpath)
if os.path.exists(dirpath):
shutil.rmtree(dirpath)
os.makedirs(dirpath)
@classmethod
def reset_result_dir(cls):

View File

@@ -63,7 +63,7 @@ class quality_check(helper_withresults_base):
[
"--load-plugins=pylint.extensions.mccabe",
"--output-format=json,parseable",
"--disable=invalid-name",
"--disable=invalid-name,too-few-public-methods,too-many-arguments", # ignore
"--ignore=_version.py",
"--reports=y",
"--score=yes",

View File

@@ -14,11 +14,11 @@ theme:
- navigation.tabs
- navigation.tabs.sticky
- navigation.footer
- toc.integrate
- navigation.path
- navigation.top
- navigation.section
- content.code.annotate
- navigation.prune
- navigation.expand
- toc.follow
palette:
- media: '(prefers-color-scheme: dark)'
@@ -44,19 +44,23 @@ plugins:
default_handler: python
handlers:
python:
path:
- src
options:
filters:
- '!^_[^_]'
inherited_members: true
inherited_members: false
show_if_no_docstring: true
show_signature_annotations: true
show_source: false
show_category_heading: true
group_by_category: true
docstring_section_style: spacy
show_root_full_path: false
merge_init_into_class: true
separate_signature: true
heading_level: 2
docstring_section_style: spacy
show_root_toc_entry: false
- with-pdf:
cover_subtitle: User Manual
cover_logo: C:\Users\chacha\git\pygitversionhelper\docs-static\Library.jpg

View File

@@ -61,6 +61,6 @@ quality-check = ["pylint>=2.15","pylint-json2html>=0.4","pandas>=1.5"]
type-check = ["mypy[reports]>=0.99" ]
doc-gen = ["mkdocs>=1.4.0", "mkdocs-material>=8.5","mkdocs-pymdownx-material-extras", "mkdocs-localsearch>=0.9.0", "mkdocstrings[python]>=0.19", "mkdocs-with-pdf>=0.9.3","pyyaml>=6.0","pymdown-extensions>=9","mkdocs-markdownextradata-plugin","mkdocs-mermaid2-plugin"]
#[project.scripts]
#my-script = "my_package.module:function"
# [project.scripts]
# my-script = "my_package.module:function"

View File

@@ -163,9 +163,7 @@ class gitversionhelper: # pylint: disable=too-few-public-methods
the commit message
"""
current_commit_id = cls.getLast(**kwargs)
print(f"current_commit_id = {current_commit_id}")
tag_commit_id = cls.getFromTag(tag)
print(f"tag_commit_id = {tag_commit_id}")
str_cmd: str
if ("same_branch" in kwargs) and (kwargs["same_branch"] is True):

View File

@@ -0,0 +1 @@
# PlaceHolder