Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt GHA dynamic-matrix #121

Merged
merged 1 commit into from Dec 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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