diff --git a/.github/workflows/ExamplePipeline.yml b/.github/workflows/ExamplePipeline.yml deleted file mode 100644 index 51c2b6e..0000000 --- a/.github/workflows/ExamplePipeline.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: Example Pipeline - -on: - push: - workflow_dispatch: - -jobs: - Params_Default: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev - with: - name: Example - - Params_PythonVersions: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev - with: - name: Example - python_version_list: "3.9 3.10 pypy-3.8 pypy-3.9" - - Params_Systems: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev - with: - name: Example - system_list: "windows mingw32 mingw64" - - Params_Include: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev - with: - name: Example - python_version_list: "3.10" - system_list: "ubuntu windows macos" - include_list: "ubuntu:3.11 ubuntu:3.12" - - Params_Exclude: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev - with: - name: Example - python_version_list: "3.10" - system_list: "ubuntu windows macos" - exclude_list: "windows:3.10 windows:3.11" - - Params_All: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev - with: - name: Example - python_version_list: "3.10 3.11" - system_list: "ubuntu windows macos" - include_list: "windows:3.8 windows:3.9 windows:3.12" - exclude_list: "macos:3.10 macos:3.11" - - Params_Check: - needs: - - Params_Default - - Params_PythonVersions - - Params_Systems - - Params_Include - - Params_Exclude - - Params_All - runs-on: ubuntu-latest - defaults: - run: - shell: python - steps: - - run: | - from json import loads as json_loads - from sys import exit - - 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" - } - - actualPythonVersion = "${{ needs.Params_Default.outputs.python_version }}" - actualPythonJobs = json_loads("${{ needs.Params_Default.outputs.python_jobs }}".replace("'", '"')) - actualArtifactNames = json_loads("${{ needs.Params_Default.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)}.") - for name in actualArtifactNames: - print(f" {name}") - errors += 1 - - exit(errors) - -# - run: | -# echo "python_version: ${{ needs.Params_PythonVersions.outputs.python_version }}" -# echo "python_jobs: ${{ needs.Params_PythonVersions.outputs.python_jobs }}" -# echo "artifact_names: ${{ needs.Params_PythonVersions.outputs.artifact_names }}" -# - run: | -# echo "python_version: ${{ needs.Params_Systems.outputs.python_version }}" -# echo "python_jobs: ${{ needs.Params_Systems.outputs.python_jobs }}" -# echo "artifact_names: ${{ needs.Params_Systems.outputs.artifact_names }}" -# - run: | -# echo "python_version: ${{ needs.Params_Include.outputs.python_version }}" -# echo "python_jobs: ${{ needs.Params_Include.outputs.python_jobs }}" -# echo "artifact_names: ${{ needs.Params_Include.outputs.artifact_names }}" -# - run: | -# echo "python_version: ${{ needs.Params_Exclude.outputs.python_version }}" -# echo "python_jobs: ${{ needs.Params_Exclude.outputs.python_jobs }}" -# echo "artifact_names: ${{ needs.Params_Exclude.outputs.artifact_names }}" -# - run: | -# echo "python_version: ${{ needs.Params_All.outputs.python_version }}" -# echo "python_jobs: ${{ needs.Params_All.outputs.python_jobs }}" -# echo "artifact_names: ${{ needs.Params_All.outputs.artifact_names }}" diff --git a/.github/workflows/Parameters.yml b/.github/workflows/Parameters.yml index 47f1843..b11f921 100644 --- a/.github/workflows/Parameters.yml +++ b/.github/workflows/Parameters.yml @@ -54,6 +54,7 @@ on: required: false default: '' type: string + outputs: python_version: description: "Default Python version for other jobs." @@ -69,7 +70,6 @@ on: value: ${{ jobs.Parameters.outputs.params }} jobs: - Parameters: runs-on: ubuntu-latest outputs: @@ -77,8 +77,8 @@ jobs: python_jobs: ${{ steps.params.outputs.python_jobs }} artifact_names: ${{ steps.params.outputs.artifact_names }} params: ${{ steps.params.outputs.params }} - steps: + steps: - name: Generate 'params' and 'python_jobs' id: params shell: python @@ -208,8 +208,9 @@ jobs: if system in data['sys'] and version in data['python'] ] - print(f"combinations ({len(combinations)}):") - print(combinations) + print(f"Combinations ({len(combinations)}):") + for system, version in combinations: + print(f" {system}:{version}") jobs = [ { @@ -260,6 +261,6 @@ jobs: id: verify run: | echo "python_version: ${{ steps.params.outputs.python_version }}" - echo "python_jobs: ${{ steps.params.outputs.python_version }}" + echo "python_jobs: ${{ steps.params.outputs.python_jobs }}" echo "artifact_names: ${{ steps.params.outputs.artifact_names }}" echo "params: ${{ steps.params.outputs.params }}" diff --git a/.github/workflows/_Checking_Parameters.yml b/.github/workflows/_Checking_Parameters.yml new file mode 100644 index 0000000..e9555b7 --- /dev/null +++ b/.github/workflows/_Checking_Parameters.yml @@ -0,0 +1,313 @@ +name: Verification Pipeline for Parameters + +on: + push: + workflow_dispatch: + +jobs: + Params_Default: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + + Params_PythonVersions: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + python_version_list: "3.9 3.10 pypy-3.8 pypy-3.9" + + Params_Systems: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + system_list: "windows mingw32 mingw64" + + Params_Include: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + python_version_list: "3.10" + system_list: "ubuntu windows macos" + include_list: "ubuntu:3.11 ubuntu:3.12" + + Params_Exclude: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + python_version_list: "3.10" + system_list: "ubuntu windows macos" + exclude_list: "windows:3.10 windows:3.11" + + Params_All: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: Example + python_version_list: "3.10 3.11" + system_list: "ubuntu windows macos" + include_list: "windows:3.8 windows:3.9 windows:3.12" + exclude_list: "macos:3.10 macos:3.11" + + Params_Check: + needs: + - Params_Default + - Params_PythonVersions + - Params_Systems + - Params_Include + - Params_Exclude + - Params_All + runs-on: ubuntu-latest + defaults: + run: + shell: python + steps: + # Params_Default + - name: Checking results from 'Params_Default' + run: | + from json import loads as json_loads + from sys import exit + + 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" + } + + actualPythonVersion = "${{ needs.Params_Default.outputs.python_version }}" + actualPythonJobs = json_loads("${{ needs.Params_Default.outputs.python_jobs }}".replace("'", '"')) + actualArtifactNames = json_loads("${{ needs.Params_Default.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)}.") + for name in actualArtifactNames: + print(f" {name}") + errors += 1 + + if errors == 0: + print(f"All checks PASSED.") + exit(errors) + + # Params_PythonVersions + - name: Checking results from 'Params_PythonVersions' + run: | + from json import loads as json_loads + from sys import exit + + 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" + } + + actualPythonVersion = "${{ needs.Params_PythonVersions.outputs.python_version }}" + actualPythonJobs = json_loads("${{ needs.Params_PythonVersions.outputs.python_jobs }}".replace("'", '"')) + actualArtifactNames = json_loads("${{ needs.Params_PythonVersions.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)}.") + for name in actualArtifactNames: + print(f" {name}") + errors += 1 + + if errors == 0: + print(f"All checks PASSED.") + exit(errors) + + # Params_Systems + - name: Checking results from 'Params_Systems' + run: | + from json import loads as json_loads + from sys import exit + + 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" + } + + actualPythonVersion = "${{ needs.Params_Systems.outputs.python_version }}" + actualPythonJobs = json_loads("${{ needs.Params_Systems.outputs.python_jobs }}".replace("'", '"')) + actualArtifactNames = json_loads("${{ needs.Params_Systems.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)}.") + for name in actualArtifactNames: + print(f" {name}") + errors += 1 + + if errors == 0: + print(f"All checks PASSED.") + exit(errors) + + # Params_Include + - name: Checking results from 'Params_Include' + run: | + from json import loads as json_loads + from sys import exit + + 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" + } + + actualPythonVersion = "${{ needs.Params_Include.outputs.python_version }}" + actualPythonJobs = json_loads("${{ needs.Params_Include.outputs.python_jobs }}".replace("'", '"')) + actualArtifactNames = json_loads("${{ needs.Params_Include.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)}.") + for name in actualArtifactNames: + print(f" {name}") + errors += 1 + + if errors == 0: + print(f"All checks PASSED.") + exit(errors) + + # Params_Exclude + - name: Checking results from 'Params_Exclude' + run: | + from json import loads as json_loads + from sys import exit + + 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" + } + + 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)}.") + for name in actualArtifactNames: + print(f" {name}") + errors += 1 + + if errors == 0: + print(f"All checks PASSED.") + exit(errors) + + # Params_All + - name: Checking results from 'Params_All' + run: | + from json import loads as json_loads + from sys import exit + + 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" + } + + actualPythonVersion = "${{ needs.Params_All.outputs.python_version }}" + actualPythonJobs = json_loads("${{ needs.Params_All.outputs.python_jobs }}".replace("'", '"')) + actualArtifactNames = json_loads("${{ needs.Params_All.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)}.") + for name in actualArtifactNames: + print(f" {name}") + errors += 1 + + if errors == 0: + print(f"All checks PASSED.") + exit(errors)