Skip to content

Commit

Permalink
GHA: refactor repeating steps in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Tattoo committed Oct 18, 2023
1 parent 3708297 commit b7ec60d
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 63 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Run tests'
inputs:
python-version:
required: true
rf-version:
required: true
shell-var:
required: true
runs:
using: "composite"
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
- name: Install dependencies
shell: ${{ inputs.shell-var }}
run: |
pip install -r requirements.txt
pip install robotframework==${{ inputs.rf-version }}
- name: Run tests
shell: ${{ inputs.shell-var }}
run: |
invoke test
154 changes: 91 additions & 63 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,80 +20,108 @@ jobs:
run: |
echo 'PYTHONS=["3.10.11", "3.11.6", "3.12.0"]' >> $GITHUB_OUTPUT
echo 'RF_VERSIONS=["3.2.2", "4.1.3", "5.0.1", "6.1.1"]' >> $GITHUB_OUTPUT
windows:
runs-on: windows-latest
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
rf-version: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
name: Windows (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
name: Windows
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install robotframework==${{ matrix.rf-version }}
- name: Run tests
run: |
invoke test
macos:
runs-on: macos-latest
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
rf-version: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
name: MacOS (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: ./.github/workflows/run-tests
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install robotframework==${{ matrix.rf-version }}
- name: Run tests
run: |
invoke test
- python-version: "3.12.0"
- rf-version: "6.1.1"
- shell-var: "pwsh"

linux:
runs-on: ubuntu-latest
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
rf-version: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
name: Linux (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
name: Linux
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install robotframework==${{ matrix.rf-version }}
- name: Run tests
run: |
invoke test
uses: ./.github/workflows/run-tests
with:
- python-version: "3.12.0"
- rf-version: "6.1.1"
- shell-var: "bash"

# windows:
# runs-on: windows-latest
# needs:
# - generate-matrix
# strategy:
# fail-fast: false
# matrix:
# python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
# rf-version: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
# name: Windows (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
# steps:
# - name: Checkout the repository
# uses: actions/checkout@v4
# - name: Install Python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# cache: 'pip'
# - name: Install dependencies
# run: |
# pip install -r requirements.txt
# pip install robotframework==${{ matrix.rf-version }}
# - name: Run tests
# run: |
# invoke test
#
# macos:
# runs-on: macos-latest
# needs:
# - generate-matrix
# strategy:
# fail-fast: false
# matrix:
# python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
# rf-version: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
# name: MacOS (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
# steps:
# - name: Checkout the repository
# uses: actions/checkout@v4
# - name: Install Python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# cache: 'pip'
# - name: Install dependencies
# run: |
# pip install -r requirements.txt
# pip install robotframework==${{ matrix.rf-version }}
# - name: Run tests
# run: |
# invoke test
#
# linux:
# runs-on: ubuntu-latest
# needs:
# - generate-matrix
# strategy:
# fail-fast: false
# matrix:
# python: ${{ fromJSON(needs.generate-matrix.outputs.python-versions) }}
# rf-version: ${{ fromJSON(needs.generate-matrix.outputs.rf-versions) }}
# name: Linux (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
# steps:
# - name: Checkout the repository
# uses: actions/checkout@v4
# - name: Install Python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# cache: 'pip'
# - name: Install dependencies
# run: |
# pip install -r requirements.txt
# pip install robotframework==${{ matrix.rf-version }}
# - name: Run tests
# run: |
# invoke test

0 comments on commit b7ec60d

Please sign in to comment.