Skip to content

Commit

Permalink
Workflows: generate matrix dynamically with a prep-job
Browse files Browse the repository at this point in the history
  • Loading branch information
Tattoo committed Oct 16, 2023
1 parent 9a6c43f commit 954264b
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,29 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
PYTHON: ['python310', 'python311', 'python312']
RF_VERSION: ['3.2.2', '4.1', '6.1.1'] #TODO add RF5

jobs:

generate-matrix:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.generate-matrix.outputs.PYTHONS }}
rf-versions: ${{ steps.generate-matrix.outputs.RF_VERSIONS }}
steps:
- name: "Generate Matrix"
id: generate-matrix
run: |
echo 'PYTHONS=["python310", "python311", "python312"]' >> $GITHUB_OUTPUT
echo 'RF_VERSIONS=["3.2.2", "4.1.3", "5.0.1", "6.1.1"]' >> $GITHUB_OUTPUT
# Running tests on Windows under Windows Subsystem for Linux (WSL)
windows:
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
python: ${{ env.PYTHON }}
rfVersion: ${{ env.RF_VERSION }}
python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
rfVersion: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
runs-on: windows-latest
name: Windows (${{ matrix.python }}, robotframework-${{ matrix.rfVersion }})
defaults:
Expand Down Expand Up @@ -59,11 +69,13 @@ jobs:
exit $(cat /home/test/result/exitCode)
linux:
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
python: ${{ env.PYTHON }}
rfVersion: ${{ env.RF_VERSION }}
python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
rfVersion: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
runs-on: ubuntu-latest
name: Linux (${{ matrix.python }}, robotframework-${{ matrix.rfVersion }})
steps:
Expand All @@ -77,11 +89,13 @@ jobs:
exit $(cat ./result/exitCode)
macos:
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
python: ${{ env.PYTHON }}
rfVersion: ${{ env.RF_VERSION }}
python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
rfVersion: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
runs-on: macos-latest
name: MacOS (${{ matrix.python }}, robotframework-${{ matrix.rfVersion }})
steps:
Expand Down

0 comments on commit 954264b

Please sign in to comment.