Skip to content

Commit

Permalink
Merge pull request #39 from eficode/refactor_gha
Browse files Browse the repository at this point in the history
GHA: refactor repeating steps in pipeline
  • Loading branch information
Tattoo authored Oct 18, 2023
2 parents 3708297 + 36f0c0a commit 49a4ba6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 38 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
terminal:
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.terminal }}
run: |
pip install -r requirements.txt
pip install robotframework==${{ inputs.rf-version }}
- name: Run tests
shell: ${{ inputs.terminal }}
run: |
invoke test
59 changes: 21 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests simple
name: Tests

on:
push:
Expand All @@ -20,6 +20,8 @@ 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:
Expand All @@ -33,67 +35,48 @@ jobs:
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
- name: Run tests
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
rf-version: ${{ matrix.rf-version }}
terminal: "pwsh"

macos:
runs-on: macos-latest
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: MacOS (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
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
- name: Run tests
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
linux:
runs-on: ubuntu-latest
rf-version: ${{ matrix.rf-version }}
terminal: "bash"
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: Linux (${{ matrix.python }}, robotframework-${{ matrix.rf-version }})
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
- name: Run tests
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
rf-version: ${{ matrix.rf-version }}
terminal: "bash"

0 comments on commit 49a4ba6

Please sign in to comment.