mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
includes and excludes.
This commit is contained in:
174
.github/workflows/Parameters.yml
vendored
174
.github/workflows/Parameters.yml
vendored
@@ -25,6 +25,10 @@ name: Parameters
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
name:
|
||||||
|
description: 'Name of the tool.'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
python_version:
|
python_version:
|
||||||
description: 'Python version.'
|
description: 'Python version.'
|
||||||
required: false
|
required: false
|
||||||
@@ -33,16 +37,22 @@ on:
|
|||||||
python_version_list:
|
python_version_list:
|
||||||
description: 'Space separated list of Python versions to run tests with.'
|
description: 'Space separated list of Python versions to run tests with.'
|
||||||
required: false
|
required: false
|
||||||
default: '3.7 3.8 3.9 3.10 3.11 pypy-3.7 pypy-3.8 pypy-3.9'
|
default: '3.7 3.8 3.9 3.10 3.11'
|
||||||
type: string
|
type: string
|
||||||
system_list:
|
system_list:
|
||||||
description: 'Space separated list of systems to run tests on.'
|
description: 'Space separated list of systems to run tests on.'
|
||||||
required: false
|
required: false
|
||||||
default: 'ubuntu windows mingw64 macos'
|
default: 'ubuntu windows mingw64 macos'
|
||||||
type: string
|
type: string
|
||||||
name:
|
include_list:
|
||||||
description: 'Name of the tool.'
|
description: 'Space separated list of system:python items to be included into the list of test.'
|
||||||
required: true
|
required: false
|
||||||
|
default: ''
|
||||||
|
type: string
|
||||||
|
exclude_list:
|
||||||
|
description: 'Space separated list of system:python items to be excluded from the list of test.'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
type: string
|
type: string
|
||||||
outputs:
|
outputs:
|
||||||
params:
|
params:
|
||||||
@@ -66,11 +76,14 @@ jobs:
|
|||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
name = "${{ inputs.name }}".strip()
|
name = "${{ inputs.name }}".strip()
|
||||||
pythonVersion = "${{ inputs.python_version }}".strip()
|
pythonVersion = "${{ 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()
|
||||||
|
exclude_list = "${{ inputs.exclude_list }}".strip()
|
||||||
|
|
||||||
currentMSYS2Version = "3.10"
|
currentMSYS2Version = "3.10"
|
||||||
currentAlphaVersion = "3.12"
|
currentAlphaVersion = "3.12"
|
||||||
@@ -100,69 +113,110 @@ jobs:
|
|||||||
else:
|
else:
|
||||||
versions = [ver.strip() for ver in versions.split(" ")]
|
versions = [ver.strip() for ver in versions.split(" ")]
|
||||||
|
|
||||||
|
if include_list == "":
|
||||||
|
includes = []
|
||||||
|
else:
|
||||||
|
includes = [tuple(include.strip().split(":")) for include in include_list.split(" ")]
|
||||||
|
|
||||||
|
if exclude_list == "":
|
||||||
|
excludes = []
|
||||||
|
else:
|
||||||
|
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': {
|
||||||
'3.6': { 'icon': '⚫', 'until': '2021.12.23' },
|
'3.6': { 'icon': '⚫', 'until': '2021.12.23' },
|
||||||
'3.7': { 'icon': '🔴', 'until': '2023.06.27' },
|
'3.7': { 'icon': '🔴', 'until': '2023.06.27' },
|
||||||
'3.8': { 'icon': '🟠', 'until': '2024.10' },
|
'3.8': { 'icon': '🟠', 'until': '2024.10' },
|
||||||
'3.9': { 'icon': '🟡', 'until': '2025.10' },
|
'3.9': { 'icon': '🟡', 'until': '2025.10' },
|
||||||
'3.10': { 'icon': '🟢', 'until': '2026.10' },
|
'3.10': { 'icon': '🟢', 'until': '2026.10' },
|
||||||
'3.11': { 'icon': '🟢', 'until': '2027.10' },
|
'3.11': { 'icon': '🟢', 'until': '2027.10' },
|
||||||
'3.12': { 'icon': '🟣', 'until': '2028.10' },
|
'3.12': { 'icon': '🟣', 'until': '2028.10' },
|
||||||
'pypy-3.7': { 'icon': '⟲🔴', 'until': '????.??' },
|
'pypy-3.7': { 'icon': '⟲🔴', 'until': '????.??' },
|
||||||
'pypy-3.8': { 'icon': '⟲🟠', 'until': '????.??' },
|
'pypy-3.8': { 'icon': '⟲🟠', 'until': '????.??' },
|
||||||
'pypy-3.9': { 'icon': '⟲🟡', 'until': '????.??' },
|
'pypy-3.9': { 'icon': '⟲🟡', 'until': '????.??' },
|
||||||
},
|
},
|
||||||
# Runner systems (runner images) supported by GitHub Actions
|
# Runner systems (runner images) supported by GitHub Actions
|
||||||
'sys': {
|
'sys': {
|
||||||
'ubuntu': { 'icon': '🐧', 'runs-on': 'ubuntu-latest', 'shell': 'bash', 'name': "Linux (x86-64)" },
|
'ubuntu': { 'icon': '🐧', 'runs-on': 'ubuntu-latest', 'shell': 'bash', 'name': "Linux (x86-64)" },
|
||||||
'windows': { 'icon': '🧊', 'runs-on': 'windows-latest', 'shell': 'pwsh', 'name': "Windows (x86-64)" },
|
'windows': { 'icon': '🧊', 'runs-on': 'windows-latest', 'shell': 'pwsh', 'name': "Windows (x86-64)" },
|
||||||
'macos': { 'icon': '🍎', 'runs-on': 'macos-latest', 'shell': 'bash', 'name': "MacOS (x86-64)" },
|
'macos': { 'icon': '🍎', 'runs-on': 'macos-latest', 'shell': 'bash', 'name': "MacOS (x86-64)" },
|
||||||
},
|
},
|
||||||
# Runtimes provided by MSYS2
|
# Runtimes provided by MSYS2
|
||||||
'runtime': {
|
'runtime': {
|
||||||
'msys': { 'icon': '🟪', 'name': 'Windows+MSYS2 (x86-64) - MSYS' },
|
'msys': { 'icon': '🟪', 'name': 'Windows+MSYS2 (x86-64) - MSYS' },
|
||||||
'mingw32': { 'icon': '⬛', 'name': 'Windows+MSYS2 (x86-64) - MinGW32' },
|
'mingw32': { 'icon': '⬛', 'name': 'Windows+MSYS2 (x86-64) - MinGW32' },
|
||||||
'mingw64': { 'icon': '🟦', 'name': 'Windows+MSYS2 (x86-64) - MinGW64' },
|
'mingw64': { 'icon': '🟦', 'name': 'Windows+MSYS2 (x86-64) - MinGW64' },
|
||||||
'clang32': { 'icon': '🟫', 'name': 'Windows+MSYS2 (x86-64) - Clang32' },
|
'clang32': { 'icon': '🟫', 'name': 'Windows+MSYS2 (x86-64) - Clang32' },
|
||||||
'clang64': { 'icon': '🟧', 'name': 'Windows+MSYS2 (x86-64) - Clang64' },
|
'clang64': { 'icon': '🟧', 'name': 'Windows+MSYS2 (x86-64) - Clang64' },
|
||||||
'ucrt64': { 'icon': '🟨', 'name': 'Windows+MSYS2 (x86-64) - UCRT64' },
|
'ucrt64': { 'icon': '🟨', 'name': 'Windows+MSYS2 (x86-64) - UCRT64' },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jobs = [
|
print("includes:")
|
||||||
{
|
for system,version in includes:
|
||||||
'sysicon': data['sys'][system]['icon'],
|
print(f"- {system}:{version}")
|
||||||
'system': system,
|
print("excludes:")
|
||||||
'runs-on': data['sys'][system]['runs-on'],
|
for exclude in excludes:
|
||||||
'shell': data['sys'][system]['shell'],
|
print(f"- {exclude}")
|
||||||
'pyicon': data['python'][version]['icon'],
|
|
||||||
'python': currentAlphaRelease if version == currentAlphaVersion else version,
|
combinations = [
|
||||||
'envname': data['sys'][system]['name'],
|
(system, version)
|
||||||
}
|
for system in systems
|
||||||
for system in systems if system in data['sys']
|
if system in data['sys'] or system in data['runtime']
|
||||||
for version in versions
|
for version in versions
|
||||||
|
if version in data['python']
|
||||||
|
and f"{system}:{version}" not in excludes
|
||||||
] + [
|
] + [
|
||||||
{
|
(system, version)
|
||||||
'sysicon': data['runtime'][runtime]['icon'],
|
for system, version in includes
|
||||||
'system': "msys2",
|
if system in data['sys']
|
||||||
'runs-on': "windows-latest",
|
and version in data['python']
|
||||||
'runtime': runtime.upper(),
|
]
|
||||||
'shell': "msys2 {0}",
|
#print("combinations:")
|
||||||
'pyicon': data['python'][currentMSYS2Version]['icon'],
|
#print(combinations)
|
||||||
'python': currentMSYS2Version,
|
|
||||||
'envname': data['runtime'][runtime]['name'],
|
jobs = [
|
||||||
}
|
{
|
||||||
for runtime in systems if runtime not in data['sys']
|
'sysicon': data['sys'][system]['icon'],
|
||||||
|
'system': system,
|
||||||
|
'runs-on': data['sys'][system]['runs-on'],
|
||||||
|
'shell': data['sys'][system]['shell'],
|
||||||
|
'pyicon': data['python'][version]['icon'],
|
||||||
|
'python': currentAlphaRelease if version == currentAlphaVersion else version,
|
||||||
|
'envname': data['sys'][system]['name'],
|
||||||
|
}
|
||||||
|
for system, version in combinations if system in data['sys']
|
||||||
|
] + [
|
||||||
|
{
|
||||||
|
'sysicon': data['runtime'][runtime]['icon'],
|
||||||
|
'system': "msys2",
|
||||||
|
'runs-on': "windows-latest",
|
||||||
|
'runtime': runtime.upper(),
|
||||||
|
'shell': "msys2 {0}",
|
||||||
|
'pyicon': data['python'][currentMSYS2Version]['icon'],
|
||||||
|
'python': currentMSYS2Version,
|
||||||
|
'envname': data['runtime'][runtime]['name'],
|
||||||
|
}
|
||||||
|
for runtime, version in combinations if runtime not in data['sys']
|
||||||
]
|
]
|
||||||
print(f'::set-output name=python_jobs::{jobs!s}')
|
print(f'::set-output name=python_jobs::{jobs!s}')
|
||||||
print("Python jobs:")
|
|
||||||
pprint(jobs, indent=2)
|
# Format jobs as list of dictionaries
|
||||||
|
buffer = ""
|
||||||
|
for job in jobs:
|
||||||
|
buffer += f" {{ " + ", ".join([f"\"{key}\": \"{value}\"" for key, value in job.items()]) + f" }},\n"
|
||||||
|
|
||||||
|
print(dedent(f"""\
|
||||||
|
Python jobs:
|
||||||
|
[
|
||||||
|
{buffer} ]
|
||||||
|
"""))
|
||||||
|
|||||||
Reference in New Issue
Block a user