2
2
name : tox
3
3
4
4
on :
5
- push : # only publishes pushes to the main branch to TestPyPI
6
- branches : # any integration branch but not tag
5
+ push :
6
+ branches :
7
7
- " main"
8
8
pull_request :
9
9
branches :
10
10
- " main"
11
+ schedule :
12
+ - cron : " 0 0 * * *"
13
+ workflow_call :
11
14
12
15
concurrency :
13
16
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
20
23
jobs :
21
24
prepare :
22
25
name : prepare
23
- runs-on : ubuntu-22 .04
26
+ runs-on : ubuntu-24 .04
24
27
outputs :
25
28
matrix : ${{ steps.generate_matrix.outputs.matrix }}
26
29
steps :
27
30
- name : Determine matrix
28
31
id : generate_matrix
29
- uses : coactions/dynamic-matrix@v1
32
+ uses : coactions/dynamic-matrix@v4
30
33
with :
31
- min_python : " 3.9"
32
- max_python : " 3.12"
34
+ min_python : " 3.10"
35
+ max_python : " 3.13"
36
+ default_python : " 3.10"
33
37
other_names : |
34
38
lint
35
39
pkg
36
40
devel
41
+ platforms : linux,macos
37
42
build :
38
43
name : ${{ matrix.name }}
39
44
environment : test
40
- runs-on : ${{ matrix.os || 'ubuntu-22 .04' }}
45
+ runs-on : ${{ matrix.os || 'ubuntu-24 .04' }}
41
46
needs :
42
47
- prepare
43
48
defaults :
@@ -53,56 +58,54 @@ jobs:
53
58
- uses : actions/checkout@v4
54
59
with :
55
60
fetch-depth : 0 # needed by setuptools-scm
61
+ submodules : true
56
62
57
63
- name : Set pre-commit cache
58
64
uses : actions/cache@v4
59
- if : ${{ matrix.passed_name == 'lint' }}
65
+ if : ${{ matrix.name == 'lint' }}
60
66
with :
61
67
path : |
62
68
~/.cache/pre-commit
63
- key : pre-commit-${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }}
69
+ key : pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }}
64
70
65
- - name : Set up Python ${{ matrix.python_version || '3.9' }}
71
+ - name : Set up Python ${{ matrix.python_version || '3.10' }}
72
+ if : " !contains(matrix.shell, 'wsl')"
66
73
uses : actions/setup-python@v5
67
74
with :
68
75
cache : pip
69
- python-version : ${{ matrix.python_version || '3.9 ' }}
76
+ python-version : ${{ matrix.python_version || '3.10 ' }}
70
77
71
78
- name : Install tox
72
79
run : |
73
80
python3 -m pip install --upgrade pip
74
- python3 -m pip install --upgrade "tox>=4.0.8"
81
+ python3 -m pip install --upgrade "tox>=4.0.0" "tox-uv>=1.20.2" uv
75
82
76
83
- name : Log installed dists
77
84
run : python3 -m pip freeze --all
78
85
79
- - name : Initialize tox envs ${{ matrix.passed_name }}
80
- run : python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }}
81
- timeout-minutes : 5 # average is under 1, but macos can be over 3
86
+ - run : ${{ matrix.command }}
82
87
83
- # sequential run improves browsing experience (almost no speed impact)
84
- - name : tox -e ${{ matrix.passed_name }}
85
- run : python3 -m tox -e ${{ matrix.passed_name }}
88
+ - run : ${{ matrix.command2 }}
89
+ if : ${{ matrix.command2 }}
86
90
87
- - name : Combine coverage data
88
- if : ${{ startsWith(matrix.passed_name, 'py') }}
89
- # produce a single .coverage file at repo root
90
- run : tox -e coverage
91
+ - run : ${{ matrix.command3 }}
92
+ if : ${{ matrix.command3 }}
91
93
92
- - name : Upload coverage data
93
- if : ${{ startsWith(matrix.passed_name, 'py') }}
94
- uses : codecov/codecov-action@v4
95
- with :
96
- name : ${{ matrix.passed_name }}
97
- token : ${{ secrets.CODECOV_TOKEN }}
98
- verbose : true # optional (default = false)
99
- fail_ci_if_error : true
94
+ - run : ${{ matrix.command4 }}
95
+ if : ${{ matrix.command4 }}
96
+
97
+ - run : ${{ matrix.command5 }}
98
+ if : ${{ matrix.command5 }}
100
99
101
100
- name : Archive logs
102
101
uses : actions/upload-artifact@v4
103
102
with :
104
103
name : logs-${{ matrix.name }}.zip
105
- path : .tox/**/log/
104
+ include-hidden-files : true
105
+ path : |
106
+ .tox/**/log/
107
+ .tox/**/.coverage*
108
+ .tox/**/coverage.xml
106
109
107
110
- name : Report failure if git reports dirty status
108
111
run : |
@@ -118,35 +121,64 @@ jobs:
118
121
if : always()
119
122
permissions :
120
123
pull-requests : write # allow codenotify to comment on pull-request
121
-
124
+ id-token : write
125
+ checks : read
122
126
needs :
123
127
- build
124
128
125
- runs-on : ubuntu-latest
129
+ runs-on : ubuntu-24.04
126
130
127
131
steps :
132
+ # checkout needed for codecov action which needs codecov.yml file
133
+ - uses : actions/checkout@v4
134
+
135
+ - name : Set up Python # likely needed for coverage
136
+ uses : actions/setup-python@v5
137
+ with :
138
+ python-version : " 3.13"
139
+
140
+ - run : pip3 install 'coverage>=7.5.1'
141
+
128
142
- name : Merge logs into a single archive
129
143
uses : actions/upload-artifact/merge@v4
130
144
with :
131
145
name : logs.zip
132
- pattern : logs*.zip
133
- delete-merged : true
146
+ include-hidden-files : true
147
+ pattern : logs-*.zip
148
+ # artifacts like py312.zip and py312-macos do have overlapping files
149
+ separate-directories : true
150
+
151
+ - name : Download artifacts
152
+ uses : actions/download-artifact@v4
153
+ continue-on-error : true # to allow rerunning this job
154
+ with :
155
+ name : logs.zip
156
+ path : .
134
157
135
- - name : Check codecov.io status
136
- if : github.event_name == 'pull_request'
137
- uses : coactions/codecov-status@main
158
+ - name : Check for expected number of coverage.xml reports
159
+ run : |
160
+ JOBS_PRODUCING_COVERAGE=6
161
+ if [ "$(find . -name coverage.xml | wc -l | bc)" -ne "${JOBS_PRODUCING_COVERAGE}" ]; then
162
+ echo "::error::Number of coverage.xml files was not the expected one (${JOBS_PRODUCING_COVERAGE}): $(find . -name coverage.xml |xargs echo)"
163
+ exit 1
164
+ fi
165
+
166
+ - name : Upload coverage data
167
+
168
+ with :
169
+ name : ${{ matrix.name }}
170
+ # verbose: true # optional (default = false)
171
+ fail_ci_if_error : true
172
+ use_oidc : ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} # cspell:ignore oidc
138
173
139
174
- name : Decide whether the needed jobs succeeded or failed
140
175
uses : re-actors/alls-green@release/v1
141
176
with :
142
177
jobs : ${{ toJSON(needs) }}
143
178
144
- - name : Check out src from Git
145
- uses : actions/checkout@v4
146
-
147
- - name : Notify repository owners about lint change affecting them
148
- uses :
sourcegraph/[email protected]
149
- env :
150
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
151
- # https://github.com/sourcegraph/codenotify/issues/19
152
- continue-on-error : true
179
+ - name : Delete Merged Artifacts
180
+ uses : actions/upload-artifact/merge@v4
181
+ with :
182
+ include-hidden-files : true
183
+ delete-merged : true
184
+ pattern : logs-*.zip
0 commit comments