From 70e8f323515456d24a38ef2802f4314ec1e936d5 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 12 Nov 2022 23:10:44 +0100 Subject: [PATCH] Added 'disable_list'. --- .github/workflows/Parameters.yml | 23 ++++++++- .github/workflows/_Checking_Parameters.yml | 58 ++++++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Parameters.yml b/.github/workflows/Parameters.yml index 5bcb4a2..ade9333 100644 --- a/.github/workflows/Parameters.yml +++ b/.github/workflows/Parameters.yml @@ -54,6 +54,11 @@ on: required: false default: '' type: string + disable_list: + description: 'Space separated list of system:python items to be disabled from the list of test.' + required: false + default: '' + type: string outputs: python_version: @@ -95,6 +100,7 @@ jobs: versions = "${{ inputs.python_version_list }}".strip() include_list = "${{ inputs.include_list }}".strip() exclude_list = "${{ inputs.exclude_list }}".strip() + disable_list = "${{ inputs.disable_list }}".strip() currentMSYS2Version = "3.10" currentAlphaVersion = "3.12" @@ -120,12 +126,19 @@ jobs: else: excludes = [exclude.strip() for exclude in exclude_list.split(" ")] + if disable_list == "": + disabled = [] + else: + disabled = [disable.strip() for disable in disable_list.split(" ")] + if "3.6" in versions: print("::warning title=Deprecated::Support for Python 3.6 ended in 2021.12.23.") if "msys2" in systems: print("::warning title=Deprecated::System 'msys2' will be replaced by 'mingw64'.") if currentAlphaVersion in versions: print(f"::notice title=Experimental::Python {currentAlphaVersion} ({currentAlphaRelease}) is a pre-release.") + for disable in disabled: + print(f"::warning title=Disabled Python Job::System '{disable}' temporary disabled.") data = { # Python and PyPy versions supported by "setup-python" action @@ -164,6 +177,9 @@ jobs: print(f"excludes ({len(excludes)}):") for exclude in excludes: print(f"- {exclude}") + print(f"disabled ({len(disabled)}):") + for disable in disabled: + print(f"- {disable}") combinations = [ (system, version) @@ -172,20 +188,23 @@ jobs: for version in versions if version in data["python"] and f"{system}:{version}" not in excludes + and f"{system}:{version}" not in disabled ] + [ (system, currentMSYS2Version) for system in systems if system in data["runtime"] and f"{system}:{currentMSYS2Version}" not in excludes + and f"{system}:{currentMSYS2Version}" not in disabled ] + [ (system, version) for system, version in includes if system in data["sys"] and version in data["python"] + and f"{system}:{version}" not in disabled ] print(f"Combinations ({len(combinations)}):") for system, version in combinations: - print(f" {system}:{version}") + print(f"- {system}:{version}") jobs = [ { @@ -241,7 +260,7 @@ jobs: ) print(f" artifact_names ({len(artifact_names)}):") for id, name in artifact_names.items(): - print(f" {id:>14}: {name}") + print(f" {id:>20}: {name}") # 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 bffdaf1..f9ede55 100644 --- a/.github/workflows/_Checking_Parameters.yml +++ b/.github/workflows/_Checking_Parameters.yml @@ -38,6 +38,14 @@ jobs: system_list: "ubuntu windows macos" exclude_list: "windows:3.10 windows:3.11" + Params_Disable: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + python_version_list: "3.10" + system_list: "ubuntu windows macos" + disable_list: "windows:3.10 windows:3.11" + Params_All: uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: @@ -54,6 +62,7 @@ jobs: - Params_Systems - Params_Include - Params_Exclude + - Params_Disable - Params_All runs-on: ubuntu-latest defaults: @@ -308,6 +317,55 @@ jobs: print(f"All checks PASSED.") exit(errors) + # Params_Disable + - name: Checking results from 'Params_Disable' + run: | + 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_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 }}""" + actualPythonJobs = json_loads("""${{ needs.Params_Exclude.outputs.python_jobs }}""".replace("'", '"')) + actualArtifactNames = json_loads("""${{ needs.Params_Exclude.outputs.artifact_names }}""".replace("'", '"')) + errors = 0 + + if actualPythonVersion != expectedPythonVersion: + print(f"'python_version' does not match: '{actualPythonVersion}' != '{expectedPythonVersion}'.") + errors += 1 + if len(actualPythonJobs) != len(expectedJobs): + print(f"Number of 'python_jobs' does not match: {len(actualPythonJobs)} != {len(expectedJobs)}.") + for job in actualPythonJobs: + print(f" {job['system']}:{job['python']}") + errors += 1 + if len(actualArtifactNames) != len(expectedArtifacts): + print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.") + 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.") + exit(errors) + # Params_All - name: Checking results from 'Params_All' run: |