This commit is contained in:
Patrick Lehmann
2024-11-10 19:07:31 +01:00
9 changed files with 229 additions and 40 deletions

View File

@@ -4,11 +4,12 @@ on:
workflow_call: workflow_call:
inputs: inputs:
package_namespace: package_namespace:
description: 'Name of the tool.' description: 'Name of the tool''s namespace.'
required: true required: false
default: ''
type: string type: string
package_name: package_name:
description: 'Name of the tool.' description: 'Name of the tool''s package.'
required: true required: true
type: string type: string
unittest_python_version: unittest_python_version:
@@ -73,10 +74,17 @@ on:
type: string type: string
jobs: jobs:
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r2
with:
package_namespace: ${{ inputs.package_namespace }}
package_name: ${{ inputs.package_name }}
UnitTestingParams: UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@r2 uses: pyTooling/Actions/.github/workflows/Parameters.yml@r2
with: with:
name: "${{ inputs.package_namespace }}.${{ inputs.package_name }}" package_namespace: ${{ inputs.package_namespace }}
package_name: ${{ inputs.package_name }}
python_version: ${{ inputs.unittest_python_version }} python_version: ${{ inputs.unittest_python_version }}
python_version_list: ${{ inputs.unittest_python_version_list }} python_version_list: ${{ inputs.unittest_python_version_list }}
system_list: ${{ inputs.unittest_system_list }} system_list: ${{ inputs.unittest_system_list }}
@@ -87,7 +95,8 @@ jobs:
AppTestingParams: AppTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@r2 uses: pyTooling/Actions/.github/workflows/Parameters.yml@r2
with: with:
name: "${{ inputs.package_namespace }}.${{ inputs.package_name }}" package_namespace: ${{ inputs.package_namespace }}
package_name: ${{ inputs.package_name }}
python_version: ${{ inputs.apptest_python_version }} python_version: ${{ inputs.apptest_python_version }}
python_version_list: ${{ inputs.apptest_python_version_list }} python_version_list: ${{ inputs.apptest_python_version_list }}
system_list: ${{ inputs.apptest_system_list }} system_list: ${{ inputs.apptest_system_list }}
@@ -109,13 +118,14 @@ jobs:
StaticTypeCheck: StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r2 uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r2
needs: needs:
- ConfigParams
- UnitTestingParams - UnitTestingParams
with: with:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }} python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
commands: | commands: |
touch ${{ inputs.package_namespace }}/__init__.py ${{ needs.ConfigParams.outputs.mypy_prepare_command }}
mypy --html-report htmlmypy -p ${{ inputs.package_namespace }}.${{ inputs.name }} mypy --html-report report/typing -p ${{ needs.ConfigParams.outputs.package_fullname }}
html_report: 'htmlmypy' html_report: 'report/typing'
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}
DocCoverage: DocCoverage:
@@ -127,11 +137,6 @@ jobs:
directory: ${{ inputs.package_namespace }}/${{ inputs.package_name }} directory: ${{ inputs.package_namespace }}/${{ inputs.package_name }}
# fail_below: 70 # fail_below: 70
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r2
needs:
- DocCoverage
Package: Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@r2 uses: pyTooling/Actions/.github/workflows/Package.yml@r2
needs: needs:

View File

@@ -34,6 +34,15 @@ on:
required: false required: false
default: '3.12' default: '3.12'
type: string type: string
package_namespace:
description: 'Name of the tool''s namespace.'
required: false
default: ''
type: string
package_name:
description: 'Name of the tool''s package.'
required: true
type: string
coverage_config: coverage_config:
description: 'Path to the .coveragerc file. Use pyproject.toml by default.' description: 'Path to the .coveragerc file. Use pyproject.toml by default.'
required: false required: false
@@ -41,6 +50,15 @@ on:
type: string type: string
outputs: outputs:
package_fullname:
description: ""
value: ${{ jobs.Extract.outputs.package_fullname }}
package_directory:
description: ""
value: ${{ jobs.Extract.outputs.package_directory }}
mypy_prepare_command:
description: ""
value: ${{ jobs.Extract.outputs.mypy_prepare_command }}
coverage_report_html_directory: coverage_report_html_directory:
description: "" description: ""
value: ${{ jobs.Extract.outputs.coverage_report_html_directory }} value: ${{ jobs.Extract.outputs.coverage_report_html_directory }}
@@ -62,6 +80,9 @@ jobs:
name: 📓 Extract configurations from pyproject.toml name: 📓 Extract configurations from pyproject.toml
runs-on: "ubuntu-${{ inputs.ubuntu_image_version }}" runs-on: "ubuntu-${{ inputs.ubuntu_image_version }}"
outputs: outputs:
package_fullname: ${{ steps.getPackageName.outputs.package_fullname }}
package_directory: ${{ steps.getPackageName.outputs.package_directory }}
mypy_prepare_command: ${{ steps.getPackageName.outputs.mypy_prepare_command }}
coverage_report_html_directory: ${{ steps.getVariables.outputs.coverage_report_html_directory }} coverage_report_html_directory: ${{ steps.getVariables.outputs.coverage_report_html_directory }}
coverage_report_xml_directory: ${{ steps.getVariables.outputs.coverage_report_xml_directory }} coverage_report_xml_directory: ${{ steps.getVariables.outputs.coverage_report_xml_directory }}
coverage_report_xml: ${{ steps.getVariables.outputs.coverage_report_xml }} coverage_report_xml: ${{ steps.getVariables.outputs.coverage_report_xml }}
@@ -81,6 +102,35 @@ jobs:
run: | run: |
python -m pip install --disable-pip-version-check -U wheel tomli python -m pip install --disable-pip-version-check -U wheel tomli
- name: 🔁 Full package name and directory
id: getPackageName
shell: python
run: |
from os import getenv
from pathlib import Path
from textwrap import dedent
namespace = "${{ inputs.package_namespace }}".strip()
name = "${{ inputs.package_name }}".strip()
if namespace == "" or namespace == ".":
fullname = f"{name}"
directory = f"{name}"
mypy_prepare_command = ""
else:
fullname = f"{namespace}.{name}"
directory = f"{namespace}/{name}"
mypy_prepare_command = f"touch {namespace}/__init__.py"
github_output = Path(getenv("GITHUB_OUTPUT"))
print(f"GITHUB_OUTPUT: {github_output}")
with github_output.open("a+", encoding="utf-8") as f:
f.write(dedent(f"""\
package_fullname={fullname}
package_directory={directory}
mypy_prepare_command={mypy_prepare_command}
"""))
- name: 🔁 Extract configurations from pyproject.toml - name: 🔁 Extract configurations from pyproject.toml
id: getVariables id: getVariables
shell: python shell: python

View File

@@ -32,7 +32,18 @@ on:
type: string type: string
name: name:
description: 'Name of the tool.' description: 'Name of the tool.'
required: true required: false
default: ''
type: string
package_namespace:
description: 'Name of the tool''s namespace.'
required: false
default: ''
type: string
package_name:
description: 'Name of the tool''s package.'
required: false
default: ''
type: string type: string
python_version: python_version:
description: 'Python version.' description: 'Python version.'
@@ -120,6 +131,8 @@ jobs:
from textwrap import dedent from textwrap import dedent
from typing import Iterable from typing import Iterable
package_namespace = "${{ inputs.package_namespace }}".strip()
package_name = "${{ inputs.package_name }}".strip()
name = "${{ inputs.name }}".strip() name = "${{ inputs.name }}".strip()
python_version = "${{ inputs.python_version }}".strip() python_version = "${{ inputs.python_version }}".strip()
systems = "${{ inputs.system_list }}".strip() systems = "${{ inputs.system_list }}".strip()
@@ -128,6 +141,12 @@ jobs:
exclude_list = "${{ inputs.exclude_list }}".strip() exclude_list = "${{ inputs.exclude_list }}".strip()
disable_list = "${{ inputs.disable_list }}".strip() disable_list = "${{ inputs.disable_list }}".strip()
if name == "":
if package_namespace == "" or package_namespace == ".":
name = f"{package_name}"
else:
name = f"{package_namespace}.{package_name}"
currentMSYS2Version = "3.11" currentMSYS2Version = "3.11"
currentAlphaVersion = "3.14" currentAlphaVersion = "3.14"
currentAlphaRelease = "3.14.0-alpha.1" currentAlphaRelease = "3.14.0-alpha.1"
@@ -296,18 +315,6 @@ jobs:
"documentation_pdf": f"{name}-Documentation-PDF", "documentation_pdf": f"{name}-Documentation-PDF",
} }
# Deprecated structure
params = {
"python_version": python_version,
"artifacts": {
"unittesting": f"{artifact_names['unittesting_xml']}",
"coverage": f"{artifact_names['codecoverage_html']}",
"typing": f"{artifact_names['statictyping_html']}",
"package": f"{artifact_names['package_all']}",
"doc": f"{artifact_names['documentation_html']}",
}
}
print("Parameters:") print("Parameters:")
print(f" python_version: {python_version}") print(f" python_version: {python_version}")
print(f" python_jobs ({len(jobs)}):\n" + print(f" python_jobs ({len(jobs)}):\n" +
@@ -325,7 +332,6 @@ jobs:
python_version={python_version} python_version={python_version}
python_jobs={json_dumps(jobs)} python_jobs={json_dumps(jobs)}
artifact_names={json_dumps(artifact_names)} artifact_names={json_dumps(artifact_names)}
params={json_dumps(params)}
""")) """))
- name: Verify out parameters - name: Verify out parameters

View File

@@ -1,10 +1,17 @@
name: Verification of Complete Pipeline name: Verification of Job Templates
on: on:
push: push:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r2
needs:
- DocCoverage
with:
package_name: pyDummy
UnitTestingParams: UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@r2 uses: pyTooling/Actions/.github/workflows/Parameters.yml@r2
with: with:
@@ -60,11 +67,13 @@ jobs:
StaticTypeCheck: StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r2 uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r2
needs: needs:
- ConfigParams
- UnitTestingParams - UnitTestingParams
with: with:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }} python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
commands: | commands: |
mypy --html-report htmlmypy -p pyDummy ${{ needs.ConfigParams.outputs.mypy_prepare_command }}
mypy --html-report htmlmypy -p ${{ needs.ConfigParams.outputs.package_fullname }}
html_report: 'htmlmypy' html_report: 'htmlmypy'
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}
@@ -77,11 +86,6 @@ jobs:
directory: sphinx_reports directory: sphinx_reports
# fail_below: 70 # fail_below: 70
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r2
needs:
- DocCoverage
Package: Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@r2 uses: pyTooling/Actions/.github/workflows/Package.yml@r2
needs: needs:

View File

@@ -0,0 +1,12 @@
name: Verification of Pipeline Templates
on:
push:
workflow_dispatch:
jobs:
NamespacePackage:
uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@r2
with:
package_namespace: pyExamples
package_name: Extensions

View File

@@ -460,7 +460,7 @@ jobs:
expectedPythonVersion = "3.13" expectedPythonVersion = "3.13"
expectedPythons = ["3.12", "3.13"] expectedPythons = ["3.12", "3.13"]
expectedSystems = ["ubuntu", "windows"] expectedSystems = ["ubuntu", "macos-arm", "windows"]
expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["windows:3.10", "windows:3.11", "windows:3.13"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["windows:3.10", "windows:3.11", "windows:3.13"]
expectedName = "Example" expectedName = "Example"
expectedArtifacts = { expectedArtifacts = {

View File

@@ -0,0 +1,11 @@
name: Verification of Pipeline Templates
on:
push:
workflow_dispatch:
jobs:
SimplePackage:
uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@r2
with:
package_name: pyDummy

View File

@@ -0,0 +1,101 @@
# ==================================================================================================================== #
# _____ _ _ _ _ _ #
# _ __ _ |_ _|__ ___ | (_)_ __ __ _ / \ ___| |_(_) ___ _ __ ___ #
# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | / _ \ / __| __| |/ _ \| '_ \/ __| #
# | |_) | |_| || | (_) | (_) | | | | | | (_| |_ / ___ \ (__| |_| | (_) | | | \__ \ #
# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_/ \_\___|\__|_|\___/|_| |_|___/ #
# |_| |___/ |___/ #
# ==================================================================================================================== #
# Authors: #
# Patrick Lehmann #
# #
# License: #
# ==================================================================================================================== #
# Copyright 2017-2024 Patrick Lehmann - Bötzingen, Germany #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# #
# SPDX-License-Identifier: Apache-2.0 #
# ==================================================================================================================== #
#
"""
A module for a set of dummy classes.
"""
__author__ = "Patrick Lehmann"
__email__ = "Paebbels@gmail.com"
__copyright__ = "2017-2024, Patrick Lehmann"
__license__ = "Apache License, Version 2.0"
__version__ = "0.14.8"
__keywords__ = ["GitHub Actions"]
__issue_tracker__ = "https://GitHub.com/pyTooling/Actions/issues"
from pyTooling.Decorators import export, readonly
from pyTooling.Platform import Platform
@export
class Base:
"""
A base-class for dummy applications.
"""
_value: int #: An internal value.
def __init__(self) -> None:
"""
Initializes the base-class.
"""
self._value = 0
@readonly
def Value(self) -> int:
"""
Read-only property to return the internal value.
:return: Internal value.
"""
return self._value
@export
class Application(Base):
"""
A dummy application for demonstration purposes.
"""
def __init__(self) -> None:
"""
Initializes the dummy application.
"""
super().__init__()
platform = Platform()
if platform.IsNativeLinux:
self._value += 1
elif platform.IsNativeMacOS:
self._value += 2
elif platform.IsNativeWindows:
self._value += 3
elif platform.IsMSYSOnWindows:
self._value += 11
elif platform.IsMinGW32OnWindows:
self._value += 12
elif platform.IsMinGW64OnWindows:
self._value += 13
elif platform.IsUCRT64OnWindows:
self._value += 14
elif platform.IsClang32OnWindows:
self._value += 15
elif platform.IsClang64OnWindows:
self._value += 16

View File