mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
generate matrix of jobs in workflow Params, instead of UnitTesting
This commit is contained in:
33
.github/workflows/UnitTesting.yml
vendored
33
.github/workflows/UnitTesting.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user