Skip to content

Commit

Permalink
Adopt GHA dynamic-matrix (#121)
Browse files Browse the repository at this point in the history
Adopt dynamic-matrix
  • Loading branch information
ssbarnea committed Dec 21, 2022
1 parent fa51284 commit 3016449
Showing 1 changed file with 28 additions and 34 deletions.
62 changes: 28 additions & 34 deletions .github/workflows/tox.yml
Expand Up @@ -10,58 +10,52 @@ on:
- main

jobs:
pre:
name: pre
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- name: Determine matrix
id: generate_matrix
uses: coactions/matrix@main
with:
other_names: |
lint
packaging
docs
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
needs: pre
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}

strategy:
fail-fast: false
matrix:
include:
- name: docs
python: "3.10"
tox_env: docs
- name: "lint"
python: "3.10"
tox_env: "lint"
- name: "packaging"
python: "3.10"
tox_env: "packaging"

- name: py37
python: "3.7"
tox_env: py37
- name: py38
python: "3.8"
tox_env: py38
- name: py39
python: "3.9"
tox_env: py39
- name: py310
python: "3.10"
tox_env: py310
- name: py311
python: "~3.11.0-0" # see https://github.com/actions/setup-python/issues/213#issuecomment-1146676713
tox_env: py311
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
with:
fetch-depth: 0 # needed by setuptools-scm

- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: ${{ matrix.python_version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: "tox -e ${{ matrix.tox_env }}"
pip install tox>=4.0
- name: tox run -e ${{ matrix.passed_name }}
run: tox run -e ${{ matrix.passed_name }}

check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
Expand Down

0 comments on commit 3016449

Please sign in to comment.