mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 11:06:56 +08:00
70 lines
2.1 KiB
YAML
70 lines
2.1 KiB
YAML
name: Params
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
python_version:
|
|
description: 'Python version.'
|
|
required: false
|
|
default: '3.10'
|
|
type: string
|
|
python_version_list:
|
|
description: 'Space separated list of Python versions to run tests with.'
|
|
required: false
|
|
default: '3.6 3.7 3.8 3.9 3.10'
|
|
type: string
|
|
name:
|
|
description: 'Name of the tool.'
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
params:
|
|
description: "Parameters to be used in other jobs."
|
|
value: ${{ jobs.Params.outputs.params }}
|
|
python_jobs:
|
|
description: "List of Python versions to be used in the matrix of other jobs."
|
|
value: ${{ jobs.Params.outputs.python_jobs }}
|
|
|
|
jobs:
|
|
|
|
Params:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
params: ${{ steps.params.outputs.params }}
|
|
python_jobs: ${{ steps.params.outputs.python_jobs }}
|
|
steps:
|
|
|
|
- name: Generate 'params' and 'python_jobs'
|
|
id: params
|
|
shell: python
|
|
run: |
|
|
name = '${{ inputs.name }}'
|
|
params = {
|
|
'python_version': '${{ inputs.python_version }}',
|
|
'artifacts': {
|
|
'unittesting': f'{name}-TestReport',
|
|
'coverage': f'{name}-coverage',
|
|
'typing': f'{name}-typing',
|
|
'package': f'{name}-package',
|
|
'doc': f'{name}-doc',
|
|
}
|
|
}
|
|
print(f'::set-output name=params::{params!s}')
|
|
print("Params:")
|
|
print(params)
|
|
|
|
data = {
|
|
'3.6': { 'icon': '🔴', 'until': '23.12.2021' },
|
|
'3.7': { 'icon': '🟠', 'until': '27.06.2023' },
|
|
'3.8': { 'icon': '🟡', 'until': 'Oct. 2024' },
|
|
'3.9': { 'icon': '🟢', 'until': 'Oct. 2025' },
|
|
'3.10': { 'icon': '🟢', 'until': 'Oct. 2026' },
|
|
}
|
|
jobs = [
|
|
{'python': version, 'icon': data[version]['icon']}
|
|
for version in '${{ inputs.python_version_list }}'.split(' ')
|
|
]
|
|
print(f'::set-output name=python_jobs::{jobs!s}')
|
|
print("Python jobs:")
|
|
print(jobs)
|