Reading GITHUB_OUTPUT from env var.

This commit is contained in:
Patrick Lehmann
2022-11-02 22:46:05 +01:00
parent 4aa82d16d3
commit 1748911f70
2 changed files with 52 additions and 35 deletions

View File

@@ -75,33 +75,47 @@ jobs:
id: params
shell: python
run: |
from os import getenv
from pathlib import Path
from pprint import pprint
from textwrap import dedent
name = "${{ inputs.name }}".strip()
pythonVersion = "${{ inputs.python_version }}".strip()
systems = "${{ inputs.system_list }}".strip()
versions = "${{ inputs.python_version_list }}".strip()
include_list = "${{ inputs.include_list }}".strip()
exclude_list = "${{ inputs.exclude_list }}".strip()
name = "${{ inputs.name }}".strip()
python_version = "${{ inputs.python_version }}".strip()
systems = "${{ inputs.system_list }}".strip()
versions = "${{ inputs.python_version_list }}".strip()
include_list = "${{ inputs.include_list }}".strip()
exclude_list = "${{ inputs.exclude_list }}".strip()
currentMSYS2Version = "3.10"
currentAlphaVersion = "3.12"
currentAlphaRelease = "3.12.0-alpha.1"
artifact_names = {
"unittesting": f"{name}-TestReport",
"codecoverage": f"{name}-Coverage",
"statictyping": f"{name}-Typing",
"package": f"{name}-Package",
"documentation": f"{name}-Documentation",
}
# Deprecated structure
params = {
'python_version': pythonVersion,
'python_version': python_version,
'artifacts': {
'unittesting': f"{name}-TestReport",
'coverage': f"{name}-Coverage",
'typing': f"{name}-Typing",
'package': f"{name}-Package",
'doc': f"{name}-Documentation",
'unittesting': f"{artifact_names['unittesting']}",
'coverage': f"{artifact_names['codecoverage']}",
'typing': f"{artifact_names['statictyping']}",
'package': f"{artifact_names['package']}",
'doc': f"{artifact_names['documentation']}",
}
}
print(f"::set-output name=params::{params!s}")
print("Parameters:")
pprint(params, indent=2)
print(f" python_version: {python_version}")
print(f" artifact_names:")
for id, name in artifact_names.items():
print(f" {id:>14}: {name}")
if systems == "":
print("::error title=Parameter::system_list is empty.")
@@ -109,7 +123,7 @@ jobs:
systems = [sys.strip() for sys in systems.split(" ")]
if versions == "":
versions = [ pythonVersion ]
versions = [ python_version ]
else:
versions = [ver.strip() for ver in versions.split(" ")]
@@ -181,8 +195,8 @@ jobs:
if system in data['sys']
and version in data['python']
]
#print("combinations:")
#print(combinations)
print("combinations:")
print(combinations)
jobs = [
{
@@ -208,10 +222,6 @@ jobs:
}
for runtime, version in combinations if runtime not in data['sys']
]
print(f'::set-output name=python_jobs::{jobs!s}')
print("${{ GITHUB_OUTPUT }}")
with Path("${{ GITHUB_OUTPUT }}").open("a+") as f:
f.write(f"python_jobs2={jobs!s}")
# Format jobs as list of dictionaries
buffer = ""
@@ -223,3 +233,10 @@ jobs:
[
{buffer} ]
"""))
# Write jobs to special file
with Path(getenv("GITHUB_OUTPUT")).open("a+") as f:
f.write(f"python_version={python_version}")
f.write(f"artifact_names={params['artifacts']!s}")
f.write(f"params={params!s}")
f.write(f"python_jobs={jobs!s}")

View File

@@ -14,7 +14,7 @@ sphinxcontrib-mermaid>=0.7.1
#sphinxcontrib-spelling>=2.2.0
autoapi
sphinx_fontawesome>=0.0.6
sphinx_autodoc_typehints>=1.19.4
sphinx_autodoc_typehints>=1.19.5
# changelog>=0.3.5
# BuildTheDocs Extensions (mostly patched Sphinx extensions)