Skip to content

Commit

Permalink
Handle simple packages and namespace packages by pipeline template.
Browse files Browse the repository at this point in the history
Added pipeline to check pipeline templates.
  • Loading branch information
Paebbels committed Nov 10, 2024
1 parent df0889b commit 9808b6c
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ on:
workflow_call:
inputs:
package_namespace:
description: 'Name of the tool.'
required: true
description: 'Name of the tool''s namespace.'
required: false
default: ''
type: string
package_name:
description: 'Name of the tool.'
description: 'Name of the tool''s package.'
required: true
type: string
unittest_python_version:
Expand Down Expand Up @@ -73,24 +74,32 @@ on:
type: string

jobs:
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@dev
with:
package_namespace: ${{ inputs.package_namespace }}
package_name: ${{ inputs.package_name }}

UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
with:
name: "${{ inputs.package_namespace }}.${{ inputs.package_name }}"
python_version: ${{ inputs.unittest_python_version }}
package_namespace: ${{ inputs.package_namespace }}
package_name: ${{ inputs.package_name }}
python_version: ${{ inputs.unittest_python_version }}
python_version_list: ${{ inputs.unittest_python_version_list }}
system_list: ${{ inputs.unittest_system_list }}
system_list: ${{ inputs.unittest_system_list }}
include_list: ${{ inputs.unittest_include_list }}
exclude_list: ${{ inputs.unittest_exclude_list }}
disable_list: ${{ inputs.unittest_disable_list }}

AppTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
with:
name: "${{ inputs.package_namespace }}.${{ inputs.package_name }}"
python_version: ${{ inputs.apptest_python_version }}
package_namespace: ${{ inputs.package_namespace }}
package_name: ${{ inputs.package_name }}
python_version: ${{ inputs.apptest_python_version }}
python_version_list: ${{ inputs.apptest_python_version_list }}
system_list: ${{ inputs.apptest_system_list }}
system_list: ${{ inputs.apptest_system_list }}
include_list: ${{ inputs.apptest_include_list }}
exclude_list: ${{ inputs.apptest_exclude_list }}
disable_list: ${{ inputs.apptest_disable_list }}
Expand All @@ -109,13 +118,14 @@ jobs:
StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev
needs:
- ConfigParams
- UnitTestingParams
with:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
commands: |
touch ${{ inputs.package_namespace }}/__init__.py
mypy --html-report htmlmypy -p ${{ inputs.package_namespace }}.${{ inputs.name }}
html_report: 'htmlmypy'
${{ needs.ConfigParams.outputs.mypy_prepare_command }}
mypy --html-report report/typing -p ${{ needs.ConfigParams.outputs.package_fullname }}
html_report: 'report/typing'
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}

DocCoverage:
Expand All @@ -127,11 +137,6 @@ jobs:
directory: ${{ inputs.package_namespace }}/${{ inputs.package_name }}
# fail_below: 70

ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@dev
needs:
- DocCoverage

Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
needs:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/ExtractConfiguration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,31 @@ on:
required: false
default: '3.12'
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:
description: 'Path to the .coveragerc file. Use pyproject.toml by default.'
required: false
default: 'pyproject.toml'
type: string

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:
description: ""
value: ${{ jobs.Extract.outputs.coverage_report_html_directory }}
Expand All @@ -62,6 +80,9 @@ jobs:
name: 📓 Extract configurations from pyproject.toml
runs-on: "ubuntu-${{ inputs.ubuntu_image_version }}"
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_xml_directory: ${{ steps.getVariables.outputs.coverage_report_xml_directory }}
coverage_report_xml: ${{ steps.getVariables.outputs.coverage_report_xml }}
Expand All @@ -81,6 +102,35 @@ jobs:
run: |
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
id: getVariables
shell: python
Expand Down
36 changes: 21 additions & 15 deletions .github/workflows/Parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ on:
type: string
name:
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
python_version:
description: 'Python version.'
Expand Down Expand Up @@ -120,14 +131,22 @@ jobs:
from textwrap import dedent
from typing import Iterable
name = "${{ inputs.name }}".strip()
package_namespace = "${{ inputs.package_namespace }}".strip()
package_name = "${{ inputs.package_name }}".strip()
name = "${{ inputs.name }}".strip()
python_version = "${{ inputs.python_version }}".strip()
systems = "${{ inputs.system_list }}".strip()
versions = "${{ inputs.python_version_list }}".strip()
include_list = "${{ inputs.include_list }}".strip()
exclude_list = "${{ inputs.exclude_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"
currentAlphaVersion = "3.14"
currentAlphaRelease = "3.14.0-alpha.1"
Expand Down Expand Up @@ -296,18 +315,6 @@ jobs:
"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(f" python_version: {python_version}")
print(f" python_jobs ({len(jobs)}):\n" +
Expand All @@ -325,7 +332,6 @@ jobs:
python_version={python_version}
python_jobs={json_dumps(jobs)}
artifact_names={json_dumps(artifact_names)}
params={json_dumps(params)}
"""))
- name: Verify out parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Verification of Complete Pipeline
name: Verification of Job Templates

on:
push:
workflow_dispatch:

jobs:
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@dev
needs:
- DocCoverage
with:
package_name: pyDummy

UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
with:
Expand Down Expand Up @@ -60,11 +67,13 @@ jobs:
StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev
needs:
- ConfigParams
- UnitTestingParams
with:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
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_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}

Expand All @@ -77,11 +86,6 @@ jobs:
directory: sphinx_reports
# fail_below: 70

ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@dev
needs:
- DocCoverage

Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
needs:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/_Checking_NamespacePackage_Pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Verification of Pipeline Templates

on:
push:
workflow_dispatch:

jobs:
NamespacePackage:
uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@dev
with:
package_namespace: pyExamples
package_name: Extensions
2 changes: 1 addition & 1 deletion .github/workflows/_Checking_Parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ jobs:
expectedPythonVersion = "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"]
expectedName = "Example"
expectedArtifacts = {
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/_Checking_SimplePackage_Pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Verification of Pipeline Templates

on:
push:
workflow_dispatch:

jobs:
SimplePackage:
uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@dev
with:
package_name: pyDummy
Loading

0 comments on commit 9808b6c

Please sign in to comment.