From 3f489f0bed14cf064bc06ef0ca4948d0357b64d3 Mon Sep 17 00:00:00 2001 From: umarcor Date: Thu, 6 Jan 2022 23:37:49 +0100 Subject: [PATCH] Parameters: add option 'system_list'; UnitTesting now requires field 'system' in the matrix --- .github/workflows/Parameters.yml | 31 +++++++++++++++++++++++++------ .github/workflows/UnitTesting.yml | 7 ++++--- ExamplePipeline.yml | 1 + 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Parameters.yml b/.github/workflows/Parameters.yml index 8668a3d..128ca36 100644 --- a/.github/workflows/Parameters.yml +++ b/.github/workflows/Parameters.yml @@ -35,6 +35,11 @@ on: required: false default: '3.7 3.8 3.9 3.10' type: string + system_list: + description: 'Space separated list of systems to run tests on.' + required: false + default: 'ubuntu windows macos' + type: string name: description: 'Name of the tool.' required: true @@ -75,18 +80,32 @@ jobs: print("Parameters:") print(params) + systems = '${{ inputs.system_list }}'.split(' ') versions = '${{ inputs.python_version_list }}'.split(' ') if '3.6' in versions: print('WARNING: support for Python 3.6 ended in 2021.12.23') data = { - '3.6': { 'icon': '⚫', 'until': '2021.12.23' }, - '3.7': { 'icon': '🔴', 'until': '2023.06.27' }, - '3.8': { 'icon': '🟠', 'until': '2024.10' }, - '3.9': { 'icon': '🟡', 'until': '2025.10' }, - '3.10': { 'icon': '🟢', 'until': '2026.10' }, + 'python': { + '3.6': { 'icon': '⚫', 'until': '2021.12.23' }, + '3.7': { 'icon': '🔴', 'until': '2023.06.27' }, + '3.8': { 'icon': '🟠', 'until': '2024.10' }, + '3.9': { 'icon': '🟡', 'until': '2025.10' }, + '3.10': { 'icon': '🟢', 'until': '2026.10' }, + }, + 'sys': { + 'ubuntu': '🐧', + 'windows': '🧊', + 'macos': '🍎', + } } 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 ] print(f'::set-output name=python_jobs::{jobs!s}') diff --git a/.github/workflows/UnitTesting.yml b/.github/workflows/UnitTesting.yml index ada82b4..7a88ddf 100644 --- a/.github/workflows/UnitTesting.yml +++ b/.github/workflows/UnitTesting.yml @@ -48,8 +48,8 @@ on: jobs: UnitTesting: - name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }} - runs-on: ubuntu-latest + name: ${{ matrix.sysicon }} ${{ matrix.pyicon }} Unit Tests using Python ${{ matrix.python }} + runs-on: ${{ matrix.system }}-latest strategy: fail-fast: false @@ -71,6 +71,7 @@ jobs: python -m pip install ${{ inputs.requirements }} - name: ☑ Run unit tests + shell: bash run: | [ 'x${{ inputs.artifact }}' != 'x' ] && PYTEST_ARGS='--junitxml=TestReport.xml' || unset PYTEST_ARGS python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes @@ -79,7 +80,7 @@ jobs: if: inputs.artifact != '' uses: actions/upload-artifact@v2 with: - name: ${{ inputs.artifact }}-${{ matrix.python }} + name: ${{ inputs.artifact }}-${{ matrix.system }}-${{ matrix.python }} path: TestReport.xml if-no-files-found: error retention-days: 1 diff --git a/ExamplePipeline.yml b/ExamplePipeline.yml index 8e4af52..75c2745 100644 --- a/ExamplePipeline.yml +++ b/ExamplePipeline.yml @@ -34,6 +34,7 @@ jobs: with: name: ToolName # Optional + system_list: 'ubuntu windows macos' python_version: '3.10' python_version_list: '3.8 3.9 3.10'