2020 PY_COLORS : 1
2121
2222jobs :
23+ pre :
24+ name : pre
25+ runs-on : ubuntu-22.04
26+ outputs :
27+ matrix : ${{ steps.generate_matrix.outputs.matrix }}
28+ steps :
29+ - name : Determine matrix
30+ id : generate_matrix
31+ uses : coactions/matrix@main
32+ with :
33+ other_names : |
34+ lint
35+ pkg
36+ devel
2337 build :
24- name : ${{ matrix.name || matrix.tox_env }}
38+ name : ${{ matrix.name || matrix.passed_name || '?' }}
39+ needs : pre
2540 runs-on : ${{ matrix.os || 'ubuntu-22.04' }}
2641 defaults :
2742 run :
2843 shell : ${{ matrix.shell || 'bash'}}
2944 strategy :
3045 fail-fast : false
31- matrix :
32- include :
33- - tox_env : lint
34- - name : pkg
35- tox_env : pkg
36- - name : py38
37- tox_env : py38,py38-devel
38- python-version : 3.8
39- - name : py39
40- tox_env : py39,py39-devel
41- python-version : 3.9
42- - tox_env : py310
43- python-version : " 3.10"
44- - name : py311
45- tox_env : py311,py311-devel
46- python-version : " 3.11"
46+ matrix : ${{ fromJson(needs.pre.outputs.matrix) }}
4747 env :
4848 PYTEST_REQPASS : 1
4949
@@ -53,17 +53,17 @@ jobs:
5353 fetch-depth : 0 # needed by setuptools-scm
5454
5555 - name : Set caches
56- if : " ${{ contains(matrix.tox_env , 'lint') }}"
56+ if : " ${{ contains(matrix.passed_name , 'lint') }}"
5757 uses : actions/cache@v3
5858 with :
5959 path : ~/.cache/pre-commit
60- key : ${{ matrix.name || matrix.tox_env }}-${{ hashFiles('.pre-commit-config.yaml') }}
60+ key : ${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }}
6161
62- - name : Set up Python ${{ matrix.python-version || '3.9' }}
62+ - name : Set up Python ${{ matrix.python_version || '3.9' }}
6363 uses : actions/setup-python@v4
6464 with :
6565 cache : pip
66- python-version : ${{ matrix.python-version || '3.9' }}
66+ python-version : ${{ matrix.python_version || '3.9' }}
6767
6868 - name : Install tox
6969 run : |
@@ -73,24 +73,24 @@ jobs:
7373 - name : Log installed dists
7474 run : python3 -m pip freeze --all
7575
76- - name : Initialize tox envs ${{ matrix.tox_env }}
77- run : python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.tox_env }}
76+ - name : Initialize tox envs ${{ matrix.passed_env }}
77+ run : python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }}
7878 timeout-minutes : 5 # average is under 1, but macos can be over 3
7979
8080 # sequential run improves browsing experience (almost no speed impact)
81- - name : tox -e ${{ matrix.tox_env }}
82- run : python3 -m tox -e ${{ matrix.tox_env }}
81+ - name : tox -e ${{ matrix.passed_name }}
82+ run : python3 -m tox -e ${{ matrix.passed_name }}
8383
8484 - name : Combine coverage data
85- if : ${{ startsWith(matrix.tox_env , 'py') }}
85+ if : ${{ startsWith(matrix.passed_name , 'py') }}
8686 # produce a single .coverage file at repo root
8787 run : tox -e coverage
8888
8989 - name : Upload coverage data
90- if : ${{ startsWith(matrix.tox_env , 'py') }}
90+ if : ${{ startsWith(matrix.passed_name , 'py') }}
9191 uses : codecov/codecov-action@v3
9292 with :
93- name : ${{ matrix.tox_env }}
93+ name : ${{ matrix.passed_name }}
9494 fail_ci_if_error : false # see https://github.com/codecov/codecov-action/issues/598
9595 token : ${{ secrets.CODECOV_TOKEN }}
9696 verbose : true # optional (default = false)
0 commit comments