mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Reading GITHUB_OUTPUT from env var.
This commit is contained in:
85
.github/workflows/Parameters.yml
vendored
85
.github/workflows/Parameters.yml
vendored
@@ -75,61 +75,75 @@ 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.")
|
||||||
else:
|
else:
|
||||||
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(" ")]
|
||||||
|
|
||||||
if include_list == "":
|
if include_list == "":
|
||||||
includes = []
|
includes = []
|
||||||
else:
|
else:
|
||||||
includes = [tuple(include.strip().split(":")) for include in include_list.split(" ")]
|
includes = [tuple(include.strip().split(":")) for include in include_list.split(" ")]
|
||||||
|
|
||||||
if exclude_list == "":
|
if exclude_list == "":
|
||||||
excludes = []
|
excludes = []
|
||||||
else:
|
else:
|
||||||
excludes = [exclude.strip() for exclude in exclude_list.split(" ")]
|
excludes = [exclude.strip() for exclude in exclude_list.split(" ")]
|
||||||
|
|
||||||
if "3.6" in versions:
|
if "3.6" in versions:
|
||||||
print("::warning title=Deprecated::Support for Python 3.6 ended in 2021.12.23.")
|
print("::warning title=Deprecated::Support for Python 3.6 ended in 2021.12.23.")
|
||||||
if "msys2" in systems:
|
if "msys2" in systems:
|
||||||
print("::warning title=Deprecated::System 'msys2' will be replaced by 'mingw64'.")
|
print("::warning title=Deprecated::System 'msys2' will be replaced by 'mingw64'.")
|
||||||
if currentAlphaVersion in versions:
|
if currentAlphaVersion in versions:
|
||||||
print(f"::notice title=Experimental::Python {currentAlphaVersion} ({currentAlphaRelease}) is a pre-release.")
|
print(f"::notice title=Experimental::Python {currentAlphaVersion} ({currentAlphaRelease}) is a pre-release.")
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
# Python and PyPy versions supported by "setup-python" action
|
# Python and PyPy versions supported by "setup-python" action
|
||||||
'python': {
|
'python': {
|
||||||
@@ -160,14 +174,14 @@ jobs:
|
|||||||
'ucrt64': { 'icon': '🟨', 'name': 'Windows+MSYS2 (x86-64) - UCRT64' },
|
'ucrt64': { 'icon': '🟨', 'name': 'Windows+MSYS2 (x86-64) - UCRT64' },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print("includes:")
|
print("includes:")
|
||||||
for system,version in includes:
|
for system,version in includes:
|
||||||
print(f"- {system}:{version}")
|
print(f"- {system}:{version}")
|
||||||
print("excludes:")
|
print("excludes:")
|
||||||
for exclude in excludes:
|
for exclude in excludes:
|
||||||
print(f"- {exclude}")
|
print(f"- {exclude}")
|
||||||
|
|
||||||
combinations = [
|
combinations = [
|
||||||
(system, version)
|
(system, version)
|
||||||
for system in systems
|
for system in systems
|
||||||
@@ -181,9 +195,9 @@ 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 = [
|
||||||
{
|
{
|
||||||
'sysicon': data['sys'][system]['icon'],
|
'sysicon': data['sys'][system]['icon'],
|
||||||
@@ -208,18 +222,21 @@ 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 = ""
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
buffer += f" {{ " + ", ".join([f"\"{key}\": \"{value}\"" for key, value in job.items()]) + f" }},\n"
|
buffer += f" {{ " + ", ".join([f"\"{key}\": \"{value}\"" for key, value in job.items()]) + f" }},\n"
|
||||||
|
|
||||||
print(dedent(f"""\
|
print(dedent(f"""\
|
||||||
Python jobs:
|
Python 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}")
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user