generate matrix of jobs in workflow Params, instead of UnitTesting

This commit is contained in:
umarcor
2021-11-29 03:16:06 +01:00
parent fbaa2b582f
commit 7616643598
2 changed files with 31 additions and 31 deletions

View File

@@ -3,10 +3,9 @@ name: Unit Testing
on:
workflow_call:
inputs:
python_versions:
jobs:
description: 'Space separated list of Python versions to run tests with.'
required: false
default: '3.6 3.7 3.8 3.9 3.10'
required: true
type: string
requirements:
description: 'Python dependencies to be installed through pip.'
@@ -21,40 +20,14 @@ on:
jobs:
Versions:
runs-on: ubuntu-latest
outputs:
jobs: ${{ steps.versions.outputs.jobs }}
steps:
- id: versions
shell: python
run: |
icons = {
'3.6': '🔴', # until 23.12.2021
'3.7': '🟠', # until 27.06.2023
'3.8': '🟡', # until Oct. 2024
'3.9': '🟢', # until Oct. 2025
'3.10': '🟢', # until Oct. 2026
}
jobs = [
{'python': version, 'icon': icons[version]}
for version in '${{ inputs.python_versions }}'.split(' ')
]
print(f'::set-output name=jobs::{jobs!s}')
UnitTesting:
name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }}
runs-on: ubuntu-latest
needs:
- Versions
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.Versions.outputs.jobs) }}
include: ${{ fromJson(inputs.jobs) }}
steps:
- name: ⏬ Checkout repository