includes and excludes.

This commit is contained in:
Patrick Lehmann
2022-10-27 00:45:24 +02:00
parent 35660ac998
commit 03827ea0b6

View File

@@ -25,6 +25,10 @@ name: Parameters
on:
workflow_call:
inputs:
name:
description: 'Name of the tool.'
required: true
type: string
python_version:
description: 'Python version.'
required: false
@@ -33,16 +37,22 @@ on:
python_version_list:
description: 'Space separated list of Python versions to run tests with.'
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
system_list:
description: 'Space separated list of systems to run tests on.'
required: false
default: 'ubuntu windows mingw64 macos'
type: string
name:
description: 'Name of the tool.'
required: true
include_list:
description: 'Space separated list of system:python items to be included into the list of test.'
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
outputs:
params:
@@ -66,11 +76,14 @@ jobs:
shell: python
run: |
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()
currentMSYS2Version = "3.10"
currentAlphaVersion = "3.12"
@@ -100,6 +113,16 @@ jobs:
else:
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:
print("::warning title=Deprecated::Support for Python 3.6 ended in 2021.12.23.")
if "msys2" in systems:
@@ -138,6 +161,29 @@ jobs:
}
}
print("includes:")
for system,version in includes:
print(f"- {system}:{version}")
print("excludes:")
for exclude in excludes:
print(f"- {exclude}")
combinations = [
(system, version)
for system in systems
if system in data['sys'] or system in data['runtime']
for version in versions
if version in data['python']
and f"{system}:{version}" not in excludes
] + [
(system, version)
for system, version in includes
if system in data['sys']
and version in data['python']
]
#print("combinations:")
#print(combinations)
jobs = [
{
'sysicon': data['sys'][system]['icon'],
@@ -148,8 +194,7 @@ jobs:
'python': currentAlphaRelease if version == currentAlphaVersion else version,
'envname': data['sys'][system]['name'],
}
for system in systems if system in data['sys']
for version in versions
for system, version in combinations if system in data['sys']
] + [
{
'sysicon': data['runtime'][runtime]['icon'],
@@ -161,8 +206,17 @@ jobs:
'python': currentMSYS2Version,
'envname': data['runtime'][runtime]['name'],
}
for runtime in systems 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("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} ]
"""))