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 id: params
shell: python shell: python
run: | run: |
from os import getenv
from pathlib import Path
from pprint import pprint from pprint import pprint
from textwrap import dedent from textwrap import dedent
name = "${{ inputs.name }}".strip() name = "${{ inputs.name }}".strip()
pythonVersion = "${{ inputs.python_version }}".strip() python_version = "${{ inputs.python_version }}".strip()
systems = "${{ inputs.system_list }}".strip() systems = "${{ inputs.system_list }}".strip()
versions = "${{ inputs.python_version_list }}".strip() versions = "${{ inputs.python_version_list }}".strip()
include_list = "${{ inputs.include_list }}".strip() include_list = "${{ inputs.include_list }}".strip()
exclude_list = "${{ inputs.exclude_list }}".strip() exclude_list = "${{ inputs.exclude_list }}".strip()
currentMSYS2Version = "3.10" currentMSYS2Version = "3.10"
currentAlphaVersion = "3.12" currentAlphaVersion = "3.12"
currentAlphaRelease = "3.12.0-alpha.1" 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 = { params = {
'python_version': pythonVersion, 'python_version': python_version,
'artifacts': { 'artifacts': {
'unittesting': f"{name}-TestReport", 'unittesting': f"{artifact_names['unittesting']}",
'coverage': f"{name}-Coverage", 'coverage': f"{artifact_names['codecoverage']}",
'typing': f"{name}-Typing", 'typing': f"{artifact_names['statictyping']}",
'package': f"{name}-Package", 'package': f"{artifact_names['package']}",
'doc': f"{name}-Documentation", 'doc': f"{artifact_names['documentation']}",
} }
} }
print(f"::set-output name=params::{params!s}")
print("Parameters:") 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 == "": if systems == "":
print("::error title=Parameter::system_list is empty.") print("::error title=Parameter::system_list is empty.")
@@ -109,7 +123,7 @@ jobs:
systems = [sys.strip() for sys in systems.split(" ")] systems = [sys.strip() for sys in systems.split(" ")]
if versions == "": if versions == "":
versions = [ pythonVersion ] versions = [ python_version ]
else: else:
versions = [ver.strip() for ver in versions.split(" ")] versions = [ver.strip() for ver in versions.split(" ")]
@@ -181,8 +195,8 @@ jobs:
if system in data['sys'] if system in data['sys']
and version in data['python'] and version in data['python']
] ]
#print("combinations:") print("combinations:")
#print(combinations) print(combinations)
jobs = [ jobs = [
{ {
@@ -208,10 +222,6 @@ jobs:
} }
for runtime, version in combinations if runtime not in data['sys'] 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 # Format jobs as list of dictionaries
buffer = "" buffer = ""
@@ -223,3 +233,10 @@ jobs:
[ [
{buffer} ] {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 #sphinxcontrib-spelling>=2.2.0
autoapi autoapi
sphinx_fontawesome>=0.0.6 sphinx_fontawesome>=0.0.6
sphinx_autodoc_typehints>=1.19.4 sphinx_autodoc_typehints>=1.19.5
# changelog>=0.3.5 # changelog>=0.3.5
# BuildTheDocs Extensions (mostly patched Sphinx extensions) # BuildTheDocs Extensions (mostly patched Sphinx extensions)