mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Check job matrix.
This commit is contained in:
@@ -25,11 +25,12 @@ runs:
|
|||||||
- name: Check artifact names
|
- name: Check artifact names
|
||||||
id: check
|
id: check
|
||||||
shell: python
|
shell: python
|
||||||
working-directory: ${{ inputs.path }}
|
|
||||||
run: |
|
run: |
|
||||||
from pyTooling.Common import zipdicts
|
from pyTooling.Common import zipdicts
|
||||||
|
|
||||||
expectedName = "Example"
|
actualArtifactNames = json_loads("""${{ inputs.generated-names }}""".replace("'", '"'))
|
||||||
|
|
||||||
|
expectedName = "${{ inputs.prefix }}"
|
||||||
expectedArtifacts = {
|
expectedArtifacts = {
|
||||||
"unittesting_xml": f"{expectedName}-UnitTestReportSummary-XML",
|
"unittesting_xml": f"{expectedName}-UnitTestReportSummary-XML",
|
||||||
"unittesting_html": f"{expectedName}-UnitTestReportSummary-HTML",
|
"unittesting_html": f"{expectedName}-UnitTestReportSummary-HTML",
|
||||||
@@ -49,9 +50,7 @@ runs:
|
|||||||
"documentation_pdf": f"{expectedName}-Documentation-PDF",
|
"documentation_pdf": f"{expectedName}-Documentation-PDF",
|
||||||
}
|
}
|
||||||
|
|
||||||
actualArtifactNames = json_loads("""${{ inputs }}""".replace("'", '"'))
|
|
||||||
errors = 0
|
errors = 0
|
||||||
|
|
||||||
if len(actualArtifactNames) != len(expectedArtifacts):
|
if len(actualArtifactNames) != len(expectedArtifacts):
|
||||||
print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.")
|
print(f"Number of 'artifact_names' does not match: {len(actualArtifactNames)} != {len(expectedArtifacts)}.")
|
||||||
errors += 1
|
errors += 1
|
||||||
|
|||||||
36
.github/actions/CheckJobMatrix/action.yml
vendored
36
.github/actions/CheckJobMatrix/action.yml
vendored
@@ -45,23 +45,23 @@ runs:
|
|||||||
from json import loads as json_loads
|
from json import loads as json_loads
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
|
||||||
expectedPythonVersion = """${{ inputs.expected-default-version }}"""
|
|
||||||
expectedPythons = json_loads("""${{ inputs.expected-python-versions }}""".replace("'", '"'))
|
|
||||||
expectedSystems = json_loads("""${{ inputs.expected-systems }}""".replace("'", '"'))
|
|
||||||
excludedJobs = json_loads("""${{ inputs.expected-exclude-jobs }}""".replace("'", '"'))
|
|
||||||
includeJobs = json_loads("""${{ inputs.expected-include-jobs }}""".replace("'", '"'))
|
|
||||||
expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons if f"{system}:{python}" not in excludedJobs] + includeJobs
|
|
||||||
|
|
||||||
actualPythonVersion = """${{ inputs.generated-default-version }}"""
|
actualPythonVersion = """${{ inputs.generated-default-version }}"""
|
||||||
actualPythonJobs = json_loads("""${{ inputs.generated-jobmatrix }}""".replace("'", '"'))
|
actualPythonJobs = json_loads("""${{ inputs.generated-jobmatrix }}""".replace("'", '"'))
|
||||||
errors = 0
|
|
||||||
|
|
||||||
|
expectedPythonVersion = """${{ inputs.expected-default-version }}"""
|
||||||
|
expectedPythons = json_loads("""${{ inputs.expected-python-versions }}""".replace("'", '"'))
|
||||||
|
expectedSystems = json_loads("""${{ inputs.expected-systems }}""".replace("'", '"'))
|
||||||
|
excludedJobs = json_loads("""${{ inputs.expected-exclude-jobs }}""".replace("'", '"'))
|
||||||
|
includeJobs = json_loads("""${{ inputs.expected-include-jobs }}""".replace("'", '"'))
|
||||||
|
expectedJobs = sorted([f"{system}:{python}" for system in expectedSystems for python in expectedPythons if f"{system}:{python}" not in excludedJobs] + includeJobs)
|
||||||
|
|
||||||
|
errors = 0
|
||||||
if actualPythonVersion != expectedPythonVersion:
|
if actualPythonVersion != expectedPythonVersion:
|
||||||
print(f"'python_version' does not match: '{actualPythonVersion}' != '{expectedPythonVersion}'.")
|
print(f"'python_version' does not match: '{actualPythonVersion}' != '{expectedPythonVersion}'.")
|
||||||
errors += 1
|
errors += 1
|
||||||
|
|
||||||
if len(actualPythonJobs) != len(expectedJobs):
|
if len(actualPythonJobs) != len(expectedJobs):
|
||||||
print(f"Number of 'python_jobs' does not match: {len(actualPythonJobs)} != {len(expectedJobs)}.")
|
print(f"❌ Number of 'python_jobs' does not match: {len(actualPythonJobs)} != {len(expectedJobs)}.")
|
||||||
print("Actual jobs:")
|
print("Actual jobs:")
|
||||||
for job in actualPythonJobs:
|
for job in actualPythonJobs:
|
||||||
if job['system'] == "msys2":
|
if job['system'] == "msys2":
|
||||||
@@ -74,9 +74,19 @@ runs:
|
|||||||
print(f" {job}")
|
print(f" {job}")
|
||||||
errors += 1
|
errors += 1
|
||||||
else:
|
else:
|
||||||
print("❌ Checking job matrix is not implemented")
|
print("✅ Number of 'python_jobs' as expected.")
|
||||||
|
print("Checking job combinations ...")
|
||||||
|
|
||||||
|
actualJobs = sorted([f"{job['system'] if job['system'] != 'msys2' else job['runtime'].lower()}:{job['python']}" for job in actualPythonJobs])
|
||||||
|
for actual, expected in zip(actualJobs, expectedJobs):
|
||||||
|
if actual != expected:
|
||||||
|
print(f" ❌ Job does not match: {actual} != {expected}.")
|
||||||
|
errors += 1
|
||||||
|
else:
|
||||||
|
print(f" ☑ Job as expected: {actual}.")
|
||||||
|
|
||||||
if errors == 0:
|
if errors == 0:
|
||||||
print(f"All checks PASSED.")
|
print("✅ All checks PASSED.")
|
||||||
|
else:
|
||||||
exit(errors)
|
print(f"❌ Counted {errors} errors.")
|
||||||
|
exit(errors)
|
||||||
|
|||||||
3
.github/workflows/_Checking_JobTemplates.yml
vendored
3
.github/workflows/_Checking_JobTemplates.yml
vendored
@@ -15,7 +15,8 @@ jobs:
|
|||||||
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
|
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
|
||||||
with:
|
with:
|
||||||
package_name: 'myPackage'
|
package_name: 'myPackage'
|
||||||
python_version_list: '3.9 3.10 3.11 3.12 3.13 3.14 pypy-3.10 pypy-3.11'
|
python_version: '3.13' # workaround to use Sphinx in Python 3.13 for sphinx_reports not yet supporting lxml 6.0
|
||||||
|
python_version_list: '3.10 3.11 3.12 3.13 3.14 pypy-3.10 pypy-3.11'
|
||||||
disable_list: 'windows-arm:pypy-3.10 windows-arm:pypy-3.11'
|
disable_list: 'windows-arm:pypy-3.10 windows-arm:pypy-3.11'
|
||||||
|
|
||||||
PlatformTestingParams:
|
PlatformTestingParams:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
package_namespace: 'myFramework'
|
package_namespace: 'myFramework'
|
||||||
package_name: 'Extension'
|
package_name: 'Extension'
|
||||||
|
unittest_python_version: '3.13' # workaround to use Sphinx in Python 3.13 for sphinx_reports not yet supporting lxml 6.0
|
||||||
bandit: 'true'
|
bandit: 'true'
|
||||||
pylint: 'true'
|
pylint: 'true'
|
||||||
codecov: 'true'
|
codecov: 'true'
|
||||||
|
|||||||
12
.github/workflows/_Checking_Parameters.yml
vendored
12
.github/workflows/_Checking_Parameters.yml
vendored
@@ -97,7 +97,7 @@ jobs:
|
|||||||
- name: Checking job matrix from 'Params_PythonVersions'
|
- name: Checking job matrix from 'Params_PythonVersions'
|
||||||
uses: ./.github/actions/CheckJobMatrix
|
uses: ./.github/actions/CheckJobMatrix
|
||||||
with:
|
with:
|
||||||
expected-default-version: '3.13'
|
expected-default-version: '3.14'
|
||||||
expected-python-versions: '["3.12", "3.13", "pypy-3.10", "pypy-3.11"]'
|
expected-python-versions: '["3.12", "3.13", "pypy-3.10", "pypy-3.11"]'
|
||||||
expected-systems: '["ubuntu", "ubuntu-arm", "windows", "windows-arm", "macos", "macos-arm"]'
|
expected-systems: '["ubuntu", "ubuntu-arm", "windows", "windows-arm", "macos", "macos-arm"]'
|
||||||
expected-exclude-jobs: '["windows-arm:pypy-3.10", "windows-arm:pypy-3.11"]'
|
expected-exclude-jobs: '["windows-arm:pypy-3.10", "windows-arm:pypy-3.11"]'
|
||||||
@@ -119,7 +119,7 @@ jobs:
|
|||||||
- name: Checking job matrix from 'Params_Systems'
|
- name: Checking job matrix from 'Params_Systems'
|
||||||
uses: ./.github/actions/CheckJobMatrix
|
uses: ./.github/actions/CheckJobMatrix
|
||||||
with:
|
with:
|
||||||
expected-default-version: '3.13'
|
expected-default-version: '3.14'
|
||||||
expected-python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
|
expected-python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
|
||||||
expected-systems: '["windows"]'
|
expected-systems: '["windows"]'
|
||||||
expected-exclude-jobs: '[]'
|
expected-exclude-jobs: '[]'
|
||||||
@@ -141,7 +141,7 @@ jobs:
|
|||||||
- name: Checking job matrix from 'Params_Include'
|
- name: Checking job matrix from 'Params_Include'
|
||||||
uses: ./.github/actions/CheckJobMatrix
|
uses: ./.github/actions/CheckJobMatrix
|
||||||
with:
|
with:
|
||||||
expected-default-version: '3.13'
|
expected-default-version: '3.14'
|
||||||
expected-python-versions: '["3.12"]'
|
expected-python-versions: '["3.12"]'
|
||||||
expected-systems: '["ubuntu", "windows", "macos", "macos-arm"]'
|
expected-systems: '["ubuntu", "windows", "macos", "macos-arm"]'
|
||||||
expected-exclude-jobs: '[]'
|
expected-exclude-jobs: '[]'
|
||||||
@@ -163,7 +163,7 @@ jobs:
|
|||||||
- name: Checking job matrix from 'Params_Exclude'
|
- name: Checking job matrix from 'Params_Exclude'
|
||||||
uses: ./.github/actions/CheckJobMatrix
|
uses: ./.github/actions/CheckJobMatrix
|
||||||
with:
|
with:
|
||||||
expected-default-version: '3.13'
|
expected-default-version: '3.14'
|
||||||
expected-python-versions: '["3.13"]'
|
expected-python-versions: '["3.13"]'
|
||||||
expected-systems: '["ubuntu", "macos", "macos-arm"]'
|
expected-systems: '["ubuntu", "macos", "macos-arm"]'
|
||||||
expected-exclude-jobs: '[]'
|
expected-exclude-jobs: '[]'
|
||||||
@@ -185,7 +185,7 @@ jobs:
|
|||||||
- name: Checking job matrix from 'Params_Disable'
|
- name: Checking job matrix from 'Params_Disable'
|
||||||
uses: ./.github/actions/CheckJobMatrix
|
uses: ./.github/actions/CheckJobMatrix
|
||||||
with:
|
with:
|
||||||
expected-default-version: '3.13'
|
expected-default-version: '3.14'
|
||||||
expected-python-versions: '["3.13"]'
|
expected-python-versions: '["3.13"]'
|
||||||
expected-systems: '["ubuntu", "windows", "macos", "macos-arm"]'
|
expected-systems: '["ubuntu", "windows", "macos", "macos-arm"]'
|
||||||
expected-exclude-jobs: '["windows:3.13"]'
|
expected-exclude-jobs: '["windows:3.13"]'
|
||||||
@@ -207,7 +207,7 @@ jobs:
|
|||||||
- name: Checking job matrix from 'Params_All'
|
- name: Checking job matrix from 'Params_All'
|
||||||
uses: ./.github/actions/CheckJobMatrix
|
uses: ./.github/actions/CheckJobMatrix
|
||||||
with:
|
with:
|
||||||
expected-default-version: '3.13'
|
expected-default-version: '3.14'
|
||||||
expected-python-versions: '["3.12", "3.13"]'
|
expected-python-versions: '["3.12", "3.13"]'
|
||||||
expected-systems: '["ubuntu", "windows", "macos-arm"]'
|
expected-systems: '["ubuntu", "windows", "macos-arm"]'
|
||||||
expected-exclude-jobs: '[]'
|
expected-exclude-jobs: '[]'
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ jobs:
|
|||||||
uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@dev
|
uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@dev
|
||||||
with:
|
with:
|
||||||
package_name: 'myPackage'
|
package_name: 'myPackage'
|
||||||
|
unittest_python_version: '3.13' # workaround to use Sphinx in Python 3.13 for sphinx_reports not yet supporting lxml 6.0
|
||||||
bandit: 'true'
|
bandit: 'true'
|
||||||
pylint: 'true'
|
pylint: 'true'
|
||||||
codecov: 'true'
|
codecov: 'true'
|
||||||
|
|||||||
Reference in New Issue
Block a user