Rework StaticTypeCheck.

This commit is contained in:
Patrick Lehmann
2025-09-14 00:10:19 +02:00
parent ae6f532e52
commit e2e8b39c41
6 changed files with 231 additions and 67 deletions

View File

@@ -56,9 +56,6 @@ on:
package_directory:
description: ""
value: ${{ jobs.Extract.outputs.package_directory }}
mypy_prepare_command:
description: ""
value: ${{ jobs.Extract.outputs.mypy_prepare_command }}
unittest_report_xml_directory:
description: ""
value: ${{ jobs.Extract.outputs.unittest_report_xml_directory }}
@@ -98,11 +95,22 @@ on:
coverage_report_json:
description: ""
value: ${{ jobs.Extract.outputs.coverage_report_json }}
typing_report_cobertura_directory:
description: ""
value: ${{ jobs.Extract.outputs.typing_report_cobertura_directory }}
typing_report_cobertura_file:
description: ""
value: ${{ jobs.Extract.outputs.typing_report_cobertura_file }}
typing_report_junit_directory:
description: ""
value: ${{ jobs.Extract.outputs.typing_report_junit_directory }}
typing_report_junit_file:
description: ""
value: ${{ jobs.Extract.outputs.typing_report_junit_file }}
typing_report_html_directory:
description: ""
value: ${{ jobs.Extract.outputs.typing_report_html_directory }}
jobs:
Extract:
name: 📓 Extract configurations from pyproject.toml
@@ -110,7 +118,6 @@ jobs:
outputs:
package_fullname: ${{ steps.getPackageName.outputs.package_fullname }}
package_directory: ${{ steps.getPackageName.outputs.package_directory }}
mypy_prepare_command: ${{ steps.getPackageName.outputs.mypy_prepare_command }}
unittest_report_xml_directory: ${{ steps.getVariables.outputs.unittest_report_xml_directory }}
unittest_report_xml_filename: ${{ steps.getVariables.outputs.unittest_report_xml_filename }}
unittest_report_xml: ${{ steps.getVariables.outputs.unittest_report_xml }}
@@ -124,6 +131,10 @@ jobs:
coverage_report_json_directory: ${{ steps.getVariables.outputs.coverage_report_json_directory }}
coverage_report_json_filename: ${{ steps.getVariables.outputs.coverage_report_json_filename }}
coverage_report_json: ${{ steps.getVariables.outputs.coverage_report_json }}
typing_report_cobertura_directory: ${{ steps.getVariables.outputs.typing_report_cobertura_directory }}
typing_report_cobertura_file: ${{ steps.getVariables.outputs.typing_report_cobertura_file }}
typing_report_junit_directory: ${{ steps.getVariables.outputs.typing_report_junit_directory }}
typing_report_junit_file: ${{ steps.getVariables.outputs.typing_report_junit_file }}
typing_report_html_directory: ${{ steps.getVariables.outputs.typing_report_html_directory }}
steps:
@@ -159,17 +170,14 @@ jobs:
if namespace == "" or namespace == ".":
fullname = f"{name}"
directory = f"{name}"
mypy_prepare_command = ""
else:
fullname = f"{namespace}.{name}"
directory = f"{namespace}/{name}"
mypy_prepare_command = f"touch {namespace}/__init__.py"
print(dedent(f"""\
OUTPUTS:
package_fullname: {fullname}
package_directory: {directory}
mypy_prepare_command: {mypy_prepare_command}
"""))
github_output = Path(getenv("GITHUB_OUTPUT"))
@@ -178,7 +186,6 @@ jobs:
f.write(dedent(f"""\
package_fullname={fullname}
package_directory={directory}
mypy_prepare_command={mypy_prepare_command}
"""))
- name: 🔁 Extract configurations from pyproject.toml
@@ -199,6 +206,8 @@ jobs:
coverageXMLFile = Path("./coverage.xml")
coverageJSONFile = Path("./coverage.json")
coverageRC = "${{ inputs.coverage_config }}".strip()
typingCoberturaFile = Path("report/typing/cobertura.xml")
typingJUnitFile = Path("report/typing/StaticTypingSummary.xml")
typingHTMLDirectory = Path("htmlmypy")
# Read output paths from 'pyproject.toml' file
@@ -213,6 +222,8 @@ jobs:
coverageHTMLDirectory = Path(pyProjectSettings["tool"]["coverage"]["html"]["directory"])
coverageXMLFile = Path(pyProjectSettings["tool"]["coverage"]["xml"]["output"])
coverageJSONFile= Path(pyProjectSettings["tool"]["coverage"]["json"]["output"])
typingCoberturaFile = Path(pyProjectSettings["tool"]["mypy"]["cobertura_xml_report"]) / "cobertura.xml"
typingJUnitFile = Path(pyProjectSettings["tool"]["mypy"]["junit_xml"])
typingHTMLDirectory = Path(pyProjectSettings["tool"]["mypy"]["html_report"])
else:
print(f"File '{pyProjectFile}' not found.")
@@ -221,6 +232,8 @@ jobs:
# Read output paths from '.coveragerc' file
elif len(coverageRC) > 0:
print(f"::warning title=Deprecated::Using '{coverageRCFile}' is deprecated. Please use 'pyproject.toml'.")
coverageRCFile = Path(coverageRC)
if coverageRCFile.exists():
with coverageRCFile.open("rb") as file:
@@ -252,6 +265,10 @@ jobs:
coverage_report_json_directory={coverageJSONFile.parent.as_posix()}
coverage_report_json_filename={coverageJSONFile.name}
coverage_report_json={coverageJSONFile.as_posix()}
typing_report_cobertura_directory={typingCoberturaFile.parent.as_posix()}
typing_report_cobertura_file={typingCoberturaFile.name}
typing_report_junit_directory={typingJUnitFile.parent.as_posix()}
typing_report_junit_file={typingJUnitFile.name}
typing_report_html_directory={typingHTMLDirectory.as_posix()}
"""))
@@ -262,5 +279,7 @@ jobs:
coverage html: {coverageHTMLDirectory}
coverage xml: {coverageXMLFile}
coverage json: {coverageJSONFile}
typing cobertura: {typingCoberturaFile}
typing junit: {typingJUnitFile}
typing html: {typingHTMLDirectory}
"""))