Writing sanity checks in Python.

This commit is contained in:
Patrick Lehmann
2022-11-03 21:24:55 +01:00
parent 26768a3855
commit cf2c3f19cf

View File

@@ -56,28 +56,65 @@ jobs:
- Params_Exclude - Params_Exclude
- Params_All - Params_All
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run:
shell: python
steps: steps:
- run: | - run: |
echo "python_version: ${{ needs.Params_Default.outputs.python_version }}" from json import loads as json_loads
echo "python_jobs: ${{ needs.Params_Default.outputs.python_jobs }}" from sys import exit
echo "artifact_names: ${{ needs.Params_Default.outputs.artifact_names }}"
- run: | expectedPythonVersion = "3.11"
echo "python_version: ${{ needs.Params_PythonVersions.outputs.python_version }}" expectedPythons = ["3.7", "3.8", "3.9", "3.10", "3.11"]
echo "python_jobs: ${{ needs.Params_PythonVersions.outputs.python_jobs }}" expectedSystems = ["ubuntu", "windows", "macos"]
echo "artifact_names: ${{ needs.Params_PythonVersions.outputs.artifact_names }}" expectedJobs = [f"{system}:{python}" for system in expectedSystems for python in expectedPythons] + ["mingw64:3.10"]
- run: | expectedName = "Example"
echo "python_version: ${{ needs.Params_Systems.outputs.python_version }}" expectedArtifacts = {
echo "python_jobs: ${{ needs.Params_Systems.outputs.python_jobs }}" "unittesting": f"{expectedName}-TestReport",
echo "artifact_names: ${{ needs.Params_Systems.outputs.artifact_names }}" "codecoverage": f"{expectedName}-Coverage",
- run: | "statictyping": f"{expectedName}-Typing",
echo "python_version: ${{ needs.Params_Include.outputs.python_version }}" "package": f"{expectedName}-Package",
echo "python_jobs: ${{ needs.Params_Include.outputs.python_jobs }}" "documentation": f"{expectedName}-Documentation"
echo "artifact_names: ${{ needs.Params_Include.outputs.artifact_names }}" }
- run: |
echo "python_version: ${{ needs.Params_Exclude.outputs.python_version }}" actualPythonVersion = "${{ needs.Params_Default.outputs.python_version }}"
echo "python_jobs: ${{ needs.Params_Exclude.outputs.python_jobs }}" actualPythonJobs = json_loads("${{ needs.Params_Default.outputs.python_jobs }}".replace("'", '"'))
echo "artifact_names: ${{ needs.Params_Exclude.outputs.artifact_names }}" actualArtifactNames = json_loads("${{ needs.Params_Default.outputs.artifact_names }}".replace("'", '"'))
- run: | errors = 0
echo "python_version: ${{ needs.Params_All.outputs.python_version }}"
echo "python_jobs: ${{ needs.Params_All.outputs.python_jobs }}" if actualPythonVersion != expectedPythonVersion:
echo "artifact_names: ${{ needs.Params_All.outputs.artifact_names }}" 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 }}"