mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
UnitTesting: generate matrix of jobs dynamically
This commit is contained in:
38
.github/workflows/UnitTesting.yml
vendored
38
.github/workflows/UnitTesting.yml
vendored
@@ -3,6 +3,11 @@ name: Unit Testing
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
python_versions:
|
||||||
|
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
|
||||||
requirements:
|
requirements:
|
||||||
description: 'Python dependencies to be installed through pip.'
|
description: 'Python dependencies to be installed through pip.'
|
||||||
required: false
|
required: false
|
||||||
@@ -16,19 +21,40 @@ on:
|
|||||||
|
|
||||||
jobs:
|
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:
|
UnitTesting:
|
||||||
name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }}
|
name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- Versions
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include: ${{ fromJson(needs.Versions.outputs.jobs) }}
|
||||||
# - {python: "3.6", icon: 🔴} # until 23.12.2021
|
|
||||||
- {python: "3.7", icon: 🟠} # until 27.06.2023
|
|
||||||
- {python: "3.8", icon: 🟡} # until Oct. 2024
|
|
||||||
- {python: "3.9", icon: 🟢} # until Oct. 2025
|
|
||||||
- {python: "3.10", icon: 🟢} # until Oct. 2026
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: ⏬ Checkout repository
|
- name: ⏬ Checkout repository
|
||||||
|
|||||||
Reference in New Issue
Block a user