Skip to content

Commit 3016449

Browse files
authored
Adopt GHA dynamic-matrix (#121)
Adopt dynamic-matrix
1 parent fa51284 commit 3016449

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

.github/workflows/tox.yml

+28-34
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,52 @@ on:
1010
- main
1111

1212
jobs:
13+
pre:
14+
name: pre
15+
runs-on: ubuntu-22.04
16+
outputs:
17+
matrix: ${{ steps.generate_matrix.outputs.matrix }}
18+
steps:
19+
- name: Determine matrix
20+
id: generate_matrix
21+
uses: coactions/matrix@main
22+
with:
23+
other_names: |
24+
lint
25+
packaging
26+
docs
1327
build:
1428
name: ${{ matrix.name }}
15-
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
29+
needs: pre
30+
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
1631

1732
strategy:
1833
fail-fast: false
19-
matrix:
20-
include:
21-
- name: docs
22-
python: "3.10"
23-
tox_env: docs
24-
- name: "lint"
25-
python: "3.10"
26-
tox_env: "lint"
27-
- name: "packaging"
28-
python: "3.10"
29-
tox_env: "packaging"
30-
31-
- name: py37
32-
python: "3.7"
33-
tox_env: py37
34-
- name: py38
35-
python: "3.8"
36-
tox_env: py38
37-
- name: py39
38-
python: "3.9"
39-
tox_env: py39
40-
- name: py310
41-
python: "3.10"
42-
tox_env: py310
43-
- name: py311
44-
python: "~3.11.0-0" # see https://github.com/actions/setup-python/issues/213#issuecomment-1146676713
45-
tox_env: py311
34+
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
4635

4736
steps:
4837
- uses: actions/checkout@v3
49-
- name: Set up Python ${{ matrix.python }}
38+
with:
39+
fetch-depth: 0 # needed by setuptools-scm
40+
41+
- name: Set up Python ${{ matrix.python_version }}
5042
uses: actions/setup-python@v4
5143
with:
52-
python-version: ${{ matrix.python }}
44+
python-version: ${{ matrix.python_version }}
45+
5346
- name: Install dependencies
5447
run: |
5548
python -m pip install --upgrade pip
56-
pip install tox
57-
- name: Test
58-
run: "tox -e ${{ matrix.tox_env }}"
49+
pip install tox>=4.0
50+
51+
- name: tox run -e ${{ matrix.passed_name }}
52+
run: tox run -e ${{ matrix.passed_name }}
5953

6054
check: # This job does nothing and is only used for the branch protection
6155
if: always()
6256
needs:
6357
- build
64-
runs-on: ubuntu-latest
58+
runs-on: ubuntu-22.04
6559
steps:
6660
- name: Decide whether the needed jobs succeeded or failed
6761
uses: re-actors/alls-green@release/v1

0 commit comments

Comments
 (0)