From 96bccfbd18a87a61d8a9641318701e35f3cc25e6 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 5 Nov 2022 15:11:14 +0100 Subject: [PATCH] Renamed artifacts. --- .github/workflows/Parameters.yml | 62 +++++----- .github/workflows/_Checking_Parameters.yml | 129 ++++++++++++++------- doc/JobTemplate/index.rst | 101 +++++++++++++--- doc/RepositoryStructure.rst | 50 ++++++++ doc/index.rst | 46 +++++--- 5 files changed, 277 insertions(+), 111 deletions(-) diff --git a/.github/workflows/Parameters.yml b/.github/workflows/Parameters.yml index 57e5bce..408d260 100644 --- a/.github/workflows/Parameters.yml +++ b/.github/workflows/Parameters.yml @@ -100,32 +100,6 @@ jobs: currentAlphaVersion = "3.12" currentAlphaRelease = "3.12.0-alpha.1" - artifact_names = { - "unittesting": f"{name}-TestReport", - "codecoverage": f"{name}-Coverage", - "statictyping": f"{name}-Typing", - "package": f"{name}-Package", - "documentation": f"{name}-Documentation", - } - - # Deprecated structure - params = { - "python_version": python_version, - "artifacts": { - "unittesting": f"{artifact_names['unittesting']}", - "coverage": f"{artifact_names['codecoverage']}", - "typing": f"{artifact_names['statictyping']}", - "package": f"{artifact_names['package']}", - "doc": f"{artifact_names['documentation']}", - } - } - - print("Parameters:") - print(f" python_version: {python_version}") - print(f" artifact_names ({len(artifact_names)}):") - for id, name in artifact_names.items(): - print(f" {id:>14}: {name}") - if systems == "": print("::error title=Parameter::system_list is empty.") else: @@ -238,16 +212,38 @@ jobs: for runtime, version in combinations if runtime not in data["sys"] ] - # Format jobs as list of dictionaries - buffer = "" - for job in jobs: - buffer += f" {{ " + ", ".join([f"\"{key}\": \"{value}\"" for key, value in job.items()]) + f" }},\n" + artifact_names = { + "unittesting_xml": f"{name}-TestReportSummary-XML", + "codecoverage_xml": f"{name}-CodeCoverage-XML", + "codecoverage_html": f"{name}-CodeCoverage-HTML", + "statictyping_html": f"{name}-StaticTyping-HTML", + "package_all": f"{name}-Packages", + "documentation_pdf": f"{name}-Documentation-PDF", + "documentation_html": f"{name}-Documentation-HTML", + } + # 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" artifact_names ({len(artifact_names)}):") + for id, name in artifact_names.items(): + print(f" {id:>14}: {name}") + + buffer = "".join([f" {{ " + ", ".join([f"\"{key}\": \"{value}\"" for key, value in job.items()]) + f" }},\n" for job in jobs]) print(dedent(f"""\ Python jobs ({len(jobs)}): - [ - {buffer} ] - """)) + {buffer}""")) # Write jobs to special file github_output = Path(getenv("GITHUB_OUTPUT")) diff --git a/.github/workflows/_Checking_Parameters.yml b/.github/workflows/_Checking_Parameters.yml index 538a212..bffdaf1 100644 --- a/.github/workflows/_Checking_Parameters.yml +++ b/.github/workflows/_Checking_Parameters.yml @@ -60,23 +60,30 @@ jobs: run: shell: python steps: + - name: Install dependencies + shell: bash + run: pip install pyTooling # Params_Default - name: Checking results from 'Params_Default' run: | from json import loads as json_loads from sys import exit + from pyTooling.Common import zipdicts + expectedPythonVersion = "3.11" expectedPythons = ["3.7", "3.8", "3.9", "3.10", "3.11"] expectedSystems = ["ubuntu", "windows", "macos"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["mingw64:3.10"] expectedName = "Example" expectedArtifacts = { - "unittesting": f"{expectedName}-TestReport", - "codecoverage": f"{expectedName}-Coverage", - "statictyping": f"{expectedName}-Typing", - "package": f"{expectedName}-Package", - "documentation": f"{expectedName}-Documentation" + "unittesting_xml": f"{expectedName}-TestReportSummary-XML", + "codecoverage_xml": f"{expectedName}-CodeCoverage-XML", + "codecoverage_html": f"{expectedName}-CodeCoverage-HTML", + "statictyping_html": f"{expectedName}-StaticTyping-HTML", + "package_all": f"{expectedName}-Packages", + "documentation_pdf": f"{expectedName}-Documentation-PDF", + "documentation_html": f"{expectedName}-Documentation-HTML", } actualPythonVersion = """${{ needs.Params_Default.outputs.python_version }}""" @@ -94,9 +101,12 @@ jobs: errors += 1 if len(actualArtifactNames) != len(expectedArtifacts): print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") - for name in actualArtifactNames: - print(f" {name}") errors += 1 + else: + for key, actual, expected in zipdicts(actualArtifactNames, expectedArtifacts): + if actual != expected: + print(f"Artifact name '{key}' does not match: {actual} != {expected}.") + errors += 1 if errors == 0: print(f"All checks PASSED.") @@ -108,17 +118,21 @@ jobs: from json import loads as json_loads from sys import exit + from pyTooling.Common import zipdicts + expectedPythonVersion = "3.11" expectedPythons = ["3.9", "3.10", "pypy-3.8", "pypy-3.9"] expectedSystems = ["ubuntu", "windows", "macos"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["mingw64:3.10"] expectedName = "Example" expectedArtifacts = { - "unittesting": f"{expectedName}-TestReport", - "codecoverage": f"{expectedName}-Coverage", - "statictyping": f"{expectedName}-Typing", - "package": f"{expectedName}-Package", - "documentation": f"{expectedName}-Documentation" + "unittesting_xml": f"{expectedName}-TestReportSummary-XML", + "codecoverage_xml": f"{expectedName}-CodeCoverage-XML", + "codecoverage_html": f"{expectedName}-CodeCoverage-HTML", + "statictyping_html": f"{expectedName}-StaticTyping-HTML", + "package_all": f"{expectedName}-Packages", + "documentation_pdf": f"{expectedName}-Documentation-PDF", + "documentation_html": f"{expectedName}-Documentation-HTML", } actualPythonVersion = """${{ needs.Params_PythonVersions.outputs.python_version }}""" @@ -136,9 +150,12 @@ jobs: errors += 1 if len(actualArtifactNames) != len(expectedArtifacts): print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") - for name in actualArtifactNames: - print(f" {name}") errors += 1 + else: + for key, actual, expected in zipdicts(actualArtifactNames, expectedArtifacts): + if actual != expected: + print(f"Artifact name '{key}' does not match: {actual} != {expected}.") + errors += 1 if errors == 0: print(f"All checks PASSED.") @@ -150,17 +167,21 @@ jobs: from json import loads as json_loads from sys import exit + from pyTooling.Common import zipdicts + expectedPythonVersion = "3.11" expectedPythons = ["3.7", "3.8", "3.9", "3.10", "3.11"] expectedSystems = ["windows"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["mingw32:3.10", "mingw64:3.10"] expectedName = "Example" expectedArtifacts = { - "unittesting": f"{expectedName}-TestReport", - "codecoverage": f"{expectedName}-Coverage", - "statictyping": f"{expectedName}-Typing", - "package": f"{expectedName}-Package", - "documentation": f"{expectedName}-Documentation" + "unittesting_xml": f"{expectedName}-TestReportSummary-XML", + "codecoverage_xml": f"{expectedName}-CodeCoverage-XML", + "codecoverage_html": f"{expectedName}-CodeCoverage-HTML", + "statictyping_html": f"{expectedName}-StaticTyping-HTML", + "package_all": f"{expectedName}-Packages", + "documentation_pdf": f"{expectedName}-Documentation-PDF", + "documentation_html": f"{expectedName}-Documentation-HTML", } actualPythonVersion = """${{ needs.Params_Systems.outputs.python_version }}""" @@ -178,9 +199,12 @@ jobs: errors += 1 if len(actualArtifactNames) != len(expectedArtifacts): print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") - for name in actualArtifactNames: - print(f" {name}") errors += 1 + else: + for key, actual, expected in zipdicts(actualArtifactNames, expectedArtifacts): + if actual != expected: + print(f"Artifact name '{key}' does not match: {actual} != {expected}.") + errors += 1 if errors == 0: print(f"All checks PASSED.") @@ -192,17 +216,21 @@ jobs: from json import loads as json_loads from sys import exit + from pyTooling.Common import zipdicts + expectedPythonVersion = "3.11" expectedPythons = ["3.10"] expectedSystems = ["ubuntu", "windows", "macos"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["ubuntu:3.11", "ubuntu:3.12"] expectedName = "Example" expectedArtifacts = { - "unittesting": f"{expectedName}-TestReport", - "codecoverage": f"{expectedName}-Coverage", - "statictyping": f"{expectedName}-Typing", - "package": f"{expectedName}-Package", - "documentation": f"{expectedName}-Documentation" + "unittesting_xml": f"{expectedName}-TestReportSummary-XML", + "codecoverage_xml": f"{expectedName}-CodeCoverage-XML", + "codecoverage_html": f"{expectedName}-CodeCoverage-HTML", + "statictyping_html": f"{expectedName}-StaticTyping-HTML", + "package_all": f"{expectedName}-Packages", + "documentation_pdf": f"{expectedName}-Documentation-PDF", + "documentation_html": f"{expectedName}-Documentation-HTML", } actualPythonVersion = """${{ needs.Params_Include.outputs.python_version }}""" @@ -220,9 +248,12 @@ jobs: errors += 1 if len(actualArtifactNames) != len(expectedArtifacts): print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") - for name in actualArtifactNames: - print(f" {name}") errors += 1 + else: + for key, actual, expected in zipdicts(actualArtifactNames, expectedArtifacts): + if actual != expected: + print(f"Artifact name '{key}' does not match: {actual} != {expected}.") + errors += 1 if errors == 0: print(f"All checks PASSED.") @@ -234,17 +265,21 @@ jobs: from json import loads as json_loads from sys import exit + from pyTooling.Common import zipdicts + expectedPythonVersion = "3.11" expectedPythons = ["3.10"] expectedSystems = ["ubuntu", "macos"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] expectedName = "Example" expectedArtifacts = { - "unittesting": f"{expectedName}-TestReport", - "codecoverage": f"{expectedName}-Coverage", - "statictyping": f"{expectedName}-Typing", - "package": f"{expectedName}-Package", - "documentation": f"{expectedName}-Documentation" + "unittesting_xml": f"{expectedName}-TestReportSummary-XML", + "codecoverage_xml": f"{expectedName}-CodeCoverage-XML", + "codecoverage_html": f"{expectedName}-CodeCoverage-HTML", + "statictyping_html": f"{expectedName}-StaticTyping-HTML", + "package_all": f"{expectedName}-Packages", + "documentation_pdf": f"{expectedName}-Documentation-PDF", + "documentation_html": f"{expectedName}-Documentation-HTML", } actualPythonVersion = """${{ needs.Params_Exclude.outputs.python_version }}""" @@ -262,9 +297,12 @@ jobs: errors += 1 if len(actualArtifactNames) != len(expectedArtifacts): print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") - for name in actualArtifactNames: - print(f" {name}") errors += 1 + else: + for key, actual, expected in zipdicts(actualArtifactNames, expectedArtifacts): + if actual != expected: + print(f"Artifact name '{key}' does not match: {actual} != {expected}.") + errors += 1 if errors == 0: print(f"All checks PASSED.") @@ -276,17 +314,21 @@ jobs: from json import loads as json_loads from sys import exit + from pyTooling.Common import zipdicts + expectedPythonVersion = "3.11" expectedPythons = ["3.10", "3.11"] expectedSystems = ["ubuntu", "windows"] expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["windows:3.8", "windows:3.9", "windows:3.12"] expectedName = "Example" expectedArtifacts = { - "unittesting": f"{expectedName}-TestReport", - "codecoverage": f"{expectedName}-Coverage", - "statictyping": f"{expectedName}-Typing", - "package": f"{expectedName}-Package", - "documentation": f"{expectedName}-Documentation" + "unittesting_xml": f"{expectedName}-TestReportSummary-XML", + "codecoverage_xml": f"{expectedName}-CodeCoverage-XML", + "codecoverage_html": f"{expectedName}-CodeCoverage-HTML", + "statictyping_html": f"{expectedName}-StaticTyping-HTML", + "package_all": f"{expectedName}-Packages", + "documentation_pdf": f"{expectedName}-Documentation-PDF", + "documentation_html": f"{expectedName}-Documentation-HTML", } actualPythonVersion = """${{ needs.Params_All.outputs.python_version }}""" @@ -304,9 +346,12 @@ jobs: errors += 1 if len(actualArtifactNames) != len(expectedArtifacts): print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") - for name in actualArtifactNames: - print(f" {name}") errors += 1 + else: + for key, actual, expected in zipdicts(actualArtifactNames, expectedArtifacts): + if actual != expected: + print(f"Artifact name '{key}' does not match: {actual} != {expected}.") + errors += 1 if errors == 0: print(f"All checks PASSED.") diff --git a/doc/JobTemplate/index.rst b/doc/JobTemplate/index.rst index 18503d5..0010dc3 100644 --- a/doc/JobTemplate/index.rst +++ b/doc/JobTemplate/index.rst @@ -1,32 +1,97 @@ +.. _JOBTMPL: + Overview ######## -**Global Templates** +The following list categorizes all pre-defined job templates, which can be instantiated in a pipeline (GitHub Action +Workflow). They can also serve as an example for creating or driving own job templates. -* :ref:`JOBTMPL/Parameters` +**Table of Contents:** -**Unit Tests, Code Coverage, ...** +.. hlist:: + :columns: 2 -* :ref:`JOBTMPL/UnitTesting` -* :ref:`JOBTMPL/CodeCoverage` -* :ref:`JOBTMPL/StaticTypeChecking` + * **Global Templates** -**Build and Packaging** + * :ref:`JOBTMPL/Parameters` -* :ref:`JOBTMPL/Package` + * **Unit Tests, Code Coverage, Code Quality, ...** -**Documentation** + * :ref:`JOBTMPL/UnitTesting` + * :ref:`JOBTMPL/CodeCoverage` + * :ref:`JOBTMPL/StaticTypeChecking` + * *code formatting (planned)* + * *coding style (planned)* + * *code linting (planned)* -* :ref:`JOBTMPL/VerifyDocumentation` -* :ref:`JOBTMPL/BuildTheDocs` + * **Build and Packaging** -**Publishing** + * :ref:`JOBTMPL/Package` -* :ref:`JOBTMPL/GitHubReleasePage` -* :ref:`JOBTMPL/PyPI` -* :ref:`JOBTMPL/PublishTestResults` -* :ref:`JOBTMPL/PublishToGitHubPages` + * **Documentation** -**Cleanups** + * :ref:`JOBTMPL/VerifyDocumentation` + * :ref:`JOBTMPL/BuildTheDocs` -* :ref:`JOBTMPL/ArtifactCleanup` + * **Releasing, Publishing** + + * :ref:`JOBTMPL/GitHubReleasePage` + * :ref:`JOBTMPL/PyPI` + * :ref:`JOBTMPL/PublishTestResults` + * :ref:`JOBTMPL/PublishToGitHubPages` + + * **Cleanups** + + * :ref:`JOBTMPL/ArtifactCleanup` + + +Instantiation +************* + +The job templates (GitHub Action *Reusable Workflows*) need to be stored in the same directory where normal pipelines +(GitHub Action *Workflows*) are located: ``.github/workflows/