Parameters: add option 'system_list'; UnitTesting now requires field 'system' in the matrix

This commit is contained in:
umarcor
2022-01-06 23:37:49 +01:00
parent 26afa43fa4
commit 3f489f0bed
3 changed files with 30 additions and 9 deletions

View File

@@ -35,6 +35,11 @@ on:
required: false required: false
default: '3.7 3.8 3.9 3.10' default: '3.7 3.8 3.9 3.10'
type: string type: string
system_list:
description: 'Space separated list of systems to run tests on.'
required: false
default: 'ubuntu windows macos'
type: string
name: name:
description: 'Name of the tool.' description: 'Name of the tool.'
required: true required: true
@@ -75,18 +80,32 @@ jobs:
print("Parameters:") print("Parameters:")
print(params) print(params)
systems = '${{ inputs.system_list }}'.split(' ')
versions = '${{ inputs.python_version_list }}'.split(' ') versions = '${{ inputs.python_version_list }}'.split(' ')
if '3.6' in versions: if '3.6' in versions:
print('WARNING: support for Python 3.6 ended in 2021.12.23') print('WARNING: support for Python 3.6 ended in 2021.12.23')
data = { data = {
'3.6': { 'icon': '⚫', 'until': '2021.12.23' }, 'python': {
'3.7': { 'icon': '🔴', 'until': '2023.06.27' }, '3.6': { 'icon': '', 'until': '2021.12.23' },
'3.8': { 'icon': '🟠', 'until': '2024.10' }, '3.7': { 'icon': '🔴', 'until': '2023.06.27' },
'3.9': { 'icon': '🟡', 'until': '2025.10' }, '3.8': { 'icon': '🟠', 'until': '2024.10' },
'3.10': { 'icon': '🟢', 'until': '2026.10' }, '3.9': { 'icon': '🟡', 'until': '2025.10' },
'3.10': { 'icon': '🟢', 'until': '2026.10' },
},
'sys': {
'ubuntu': '🐧',
'windows': '🧊',
'macos': '🍎',
}
} }
jobs = [ jobs = [
{'python': version, 'icon': data[version]['icon']} {
'sysicon': data['sys'][system],
'system': system,
'pyicon': data['python'][version]['icon'],
'python': version
}
for system in systems
for version in versions for version in versions
] ]
print(f'::set-output name=python_jobs::{jobs!s}') print(f'::set-output name=python_jobs::{jobs!s}')

View File

@@ -48,8 +48,8 @@ on:
jobs: jobs:
UnitTesting: UnitTesting:
name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }} name: ${{ matrix.sysicon }} ${{ matrix.pyicon }} Unit Tests using Python ${{ matrix.python }}
runs-on: ubuntu-latest runs-on: ${{ matrix.system }}-latest
strategy: strategy:
fail-fast: false fail-fast: false
@@ -71,6 +71,7 @@ jobs:
python -m pip install ${{ inputs.requirements }} python -m pip install ${{ inputs.requirements }}
- name: ☑ Run unit tests - name: ☑ Run unit tests
shell: bash
run: | run: |
[ 'x${{ inputs.artifact }}' != 'x' ] && PYTEST_ARGS='--junitxml=TestReport.xml' || unset PYTEST_ARGS [ 'x${{ inputs.artifact }}' != 'x' ] && PYTEST_ARGS='--junitxml=TestReport.xml' || unset PYTEST_ARGS
python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes
@@ -79,7 +80,7 @@ jobs:
if: inputs.artifact != '' if: inputs.artifact != ''
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ inputs.artifact }}-${{ matrix.python }} name: ${{ inputs.artifact }}-${{ matrix.system }}-${{ matrix.python }}
path: TestReport.xml path: TestReport.xml
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1

View File

@@ -34,6 +34,7 @@ jobs:
with: with:
name: ToolName name: ToolName
# Optional # Optional
system_list: 'ubuntu windows macos'
python_version: '3.10' python_version: '3.10'
python_version_list: '3.8 3.9 3.10' python_version_list: '3.8 3.9 3.10'