| 1 |
name: test |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
- "[0-9]+.[0-9]+.x" |
| 8 |
- "test-me-*" |
| 9 |
tags: |
| 10 |
- "[0-9]+.[0-9]+.[0-9]+" |
| 11 |
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" |
| 12 |
|
| 13 |
pull_request: |
| 14 |
branches: |
| 15 |
- main |
| 16 |
- "[0-9]+.[0-9]+.x" |
| 17 |
types: |
| 18 |
- opened # default |
| 19 |
- synchronize # default |
| 20 |
- reopened # default |
| 21 |
- ready_for_review # used in PRs created from the release workflow |
| 22 |
|
| 23 |
workflow_dispatch: # allows manual triggering of the workflow |
| 24 |
|
| 25 |
env: |
| 26 |
PYTEST_ADDOPTS: "--color=yes" |
| 27 |
|
| 28 |
# Cancel running jobs for the same workflow and branch. |
| 29 |
concurrency: |
| 30 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 31 |
cancel-in-progress: true |
| 32 |
|
| 33 |
# Set permissions at the job level. |
| 34 |
permissions: {} |
| 35 |
|
| 36 |
jobs: |
| 37 |
package: |
| 38 |
runs-on: ubuntu-latest |
| 39 |
steps: |
| 40 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 41 |
with: |
| 42 |
fetch-depth: 0 |
| 43 |
persist-credentials: false |
| 44 |
- name: Build and Check Package |
| 45 |
uses: hynek/build-and-inspect-python-package@d44ca7d91762de7a7d5436ddae667c6da6d1c3df |
| 46 |
|
| 47 |
build: |
| 48 |
needs: [package] |
| 49 |
|
| 50 |
runs-on: ${{ matrix.os }} |
| 51 |
timeout-minutes: 45 |
| 52 |
permissions: |
| 53 |
contents: read |
| 54 |
|
| 55 |
strategy: |
| 56 |
fail-fast: false |
| 57 |
matrix: |
| 58 |
name: [ |
| 59 |
"windows-py310-unittest-asynctest", |
| 60 |
"windows-py310-unittest-twisted24", |
| 61 |
"windows-py310-unittest-twisted25", |
| 62 |
"windows-py310-pluggy", |
| 63 |
"windows-py310-xdist", |
| 64 |
"windows-py311", |
| 65 |
"windows-py312", |
| 66 |
"windows-py313", |
| 67 |
"windows-py314", |
| 68 |
"windows-py315", |
| 69 |
|
| 70 |
"ubuntu-py310-unittest-asynctest", |
| 71 |
"ubuntu-py310-unittest-twisted24", |
| 72 |
"ubuntu-py310-unittest-twisted25", |
| 73 |
"ubuntu-py310-lsof-numpy-pexpect", |
| 74 |
"ubuntu-py310-pluggy", |
| 75 |
"ubuntu-py310-freeze", |
| 76 |
"ubuntu-py310-xdist", |
| 77 |
"ubuntu-py311", |
| 78 |
"ubuntu-py312", |
| 79 |
"ubuntu-py313-pexpect", |
| 80 |
"ubuntu-py314", |
| 81 |
"ubuntu-py315", |
| 82 |
"ubuntu-pypy3-xdist", |
| 83 |
|
| 84 |
"macos-py310", |
| 85 |
"macos-py312", |
| 86 |
"macos-py313", |
| 87 |
"macos-py314", |
| 88 |
"macos-py315", |
| 89 |
|
| 90 |
"doctesting", |
| 91 |
"plugins", |
| 92 |
] |
| 93 |
|
| 94 |
include: |
| 95 |
# Use separate jobs for different unittest flavors (twisted, asynctest) to ensure proper coverage. |
| 96 |
- name: "windows-py310-unittest-asynctest" |
| 97 |
python: "3.10" |
| 98 |
os: windows-latest |
| 99 |
tox_env: "py310-asynctest" |
| 100 |
use_coverage: true |
| 101 |
|
| 102 |
- name: "windows-py310-unittest-twisted24" |
| 103 |
python: "3.10" |
| 104 |
os: windows-latest |
| 105 |
tox_env: "py310-twisted24" |
| 106 |
use_coverage: true |
| 107 |
|
| 108 |
- name: "windows-py310-unittest-twisted25" |
| 109 |
python: "3.10" |
| 110 |
os: windows-latest |
| 111 |
tox_env: "py310-twisted25" |
| 112 |
use_coverage: true |
| 113 |
|
| 114 |
- name: "windows-py310-pluggy" |
| 115 |
python: "3.10" |
| 116 |
os: windows-latest |
| 117 |
tox_env: "py310-pluggymain-pylib-xdist" |
| 118 |
xfail: true |
| 119 |
|
| 120 |
- name: "windows-py310-xdist" |
| 121 |
python: "3.10" |
| 122 |
os: windows-latest |
| 123 |
tox_env: "py310-xdist" |
| 124 |
|
| 125 |
- name: "windows-py311" |
| 126 |
python: "3.11" |
| 127 |
os: windows-latest |
| 128 |
tox_env: "py311" |
| 129 |
|
| 130 |
- name: "windows-py312" |
| 131 |
python: "3.12" |
| 132 |
os: windows-latest |
| 133 |
tox_env: "py312" |
| 134 |
|
| 135 |
- name: "windows-py313" |
| 136 |
python: "3.13" |
| 137 |
os: windows-latest |
| 138 |
tox_env: "py313" |
| 139 |
xfail: true |
| 140 |
|
| 141 |
- name: "windows-py314" |
| 142 |
python: "3.14" |
| 143 |
os: windows-latest |
| 144 |
tox_env: "py314" |
| 145 |
use_coverage: true |
| 146 |
|
| 147 |
- name: "windows-py315" |
| 148 |
python: "3.15" |
| 149 |
os: windows-latest |
| 150 |
tox_env: "py315" |
| 151 |
|
| 152 |
# Use separate jobs for different unittest flavors (twisted, asynctest) to ensure proper coverage. |
| 153 |
- name: "ubuntu-py310-unittest-asynctest" |
| 154 |
python: "3.10" |
| 155 |
os: ubuntu-latest |
| 156 |
tox_env: "py310-asynctest" |
| 157 |
use_coverage: true |
| 158 |
|
| 159 |
- name: "ubuntu-py310-unittest-twisted24" |
| 160 |
python: "3.10" |
| 161 |
os: ubuntu-latest |
| 162 |
tox_env: "py310-twisted24" |
| 163 |
use_coverage: true |
| 164 |
|
| 165 |
- name: "ubuntu-py310-unittest-twisted25" |
| 166 |
python: "3.10" |
| 167 |
os: ubuntu-latest |
| 168 |
tox_env: "py310-twisted25" |
| 169 |
use_coverage: true |
| 170 |
|
| 171 |
- name: "ubuntu-py310-lsof-numpy-pexpect" |
| 172 |
python: "3.10" |
| 173 |
os: ubuntu-latest |
| 174 |
tox_env: "py310-lsof-numpy-pexpect" |
| 175 |
use_coverage: true |
| 176 |
|
| 177 |
- name: "ubuntu-py310-pluggy" |
| 178 |
python: "3.10" |
| 179 |
os: ubuntu-latest |
| 180 |
tox_env: "py310-pluggymain-pylib-xdist" |
| 181 |
xfail: true |
| 182 |
|
| 183 |
- name: "ubuntu-py310-freeze" |
| 184 |
python: "3.10" |
| 185 |
os: ubuntu-latest |
| 186 |
tox_env: "py310-freeze" |
| 187 |
xfail: true |
| 188 |
|
| 189 |
- name: "ubuntu-py310-xdist" |
| 190 |
python: "3.10" |
| 191 |
os: ubuntu-latest |
| 192 |
tox_env: "py310-xdist" |
| 193 |
|
| 194 |
- name: "ubuntu-py311" |
| 195 |
python: "3.11" |
| 196 |
os: ubuntu-latest |
| 197 |
tox_env: "py311" |
| 198 |
use_coverage: true |
| 199 |
|
| 200 |
- name: "ubuntu-py312" |
| 201 |
python: "3.12" |
| 202 |
os: ubuntu-latest |
| 203 |
tox_env: "py312" |
| 204 |
use_coverage: true |
| 205 |
|
| 206 |
- name: "ubuntu-py313-pexpect" |
| 207 |
python: "3.13" |
| 208 |
os: ubuntu-latest |
| 209 |
tox_env: "py313-pexpect" |
| 210 |
use_coverage: true |
| 211 |
xfail: true |
| 212 |
|
| 213 |
- name: "ubuntu-py314" |
| 214 |
python: "3.14" |
| 215 |
os: ubuntu-latest |
| 216 |
tox_env: "py314" |
| 217 |
use_coverage: true |
| 218 |
|
| 219 |
- name: "ubuntu-py315" |
| 220 |
python: "3.15" |
| 221 |
os: ubuntu-latest |
| 222 |
tox_env: "py315" |
| 223 |
use_coverage: true |
| 224 |
|
| 225 |
- name: "ubuntu-pypy3-xdist" |
| 226 |
python: "pypy-3.10" |
| 227 |
os: ubuntu-latest |
| 228 |
tox_env: "pypy3-xdist" |
| 229 |
|
| 230 |
|
| 231 |
- name: "macos-py310" |
| 232 |
python: "3.10" |
| 233 |
os: macos-latest |
| 234 |
tox_env: "py310-xdist" |
| 235 |
xfail: true |
| 236 |
|
| 237 |
- name: "macos-py312" |
| 238 |
python: "3.12" |
| 239 |
os: macos-latest |
| 240 |
tox_env: "py312-xdist" |
| 241 |
|
| 242 |
- name: "macos-py313" |
| 243 |
python: "3.13" |
| 244 |
os: macos-latest |
| 245 |
tox_env: "py313-xdist" |
| 246 |
xfail: true |
| 247 |
|
| 248 |
- name: "macos-py314" |
| 249 |
python: "3.14" |
| 250 |
os: macos-latest |
| 251 |
tox_env: "py314-xdist" |
| 252 |
|
| 253 |
- name: "macos-py315" |
| 254 |
python: "3.15" |
| 255 |
os: macos-latest |
| 256 |
tox_env: "py315-xdist" |
| 257 |
|
| 258 |
- name: "plugins" |
| 259 |
python: "3.12" |
| 260 |
os: ubuntu-latest |
| 261 |
tox_env: "plugins" |
| 262 |
|
| 263 |
|
| 264 |
- name: "doctesting" |
| 265 |
python: "3.10" |
| 266 |
os: ubuntu-latest |
| 267 |
tox_env: "doctesting" |
| 268 |
use_coverage: true |
| 269 |
|
| 270 |
continue-on-error: ${{ matrix.xfail && true || false }} |
| 271 |
|
| 272 |
steps: |
| 273 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 274 |
with: |
| 275 |
fetch-depth: 0 |
| 276 |
persist-credentials: false |
| 277 |
|
| 278 |
- name: Download Package |
| 279 |
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 280 |
with: |
| 281 |
name: Packages |
| 282 |
path: dist |
| 283 |
|
| 284 |
- name: Set up Python ${{ matrix.python }} |
| 285 |
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 286 |
with: |
| 287 |
python-version: ${{ matrix.python }} |
| 288 |
check-latest: true |
| 289 |
allow-prereleases: true |
| 290 |
|
| 291 |
- name: Install tox |
| 292 |
run: | |
| 293 |
python -m pip install --upgrade pip |
| 294 |
pip install tox |
| 295 |
|
| 296 |
- name: Test without coverage |
| 297 |
if: "! matrix.use_coverage" |
| 298 |
shell: bash |
| 299 |
env: |
| 300 |
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit.xml |
| 301 |
run: tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz` |
| 302 |
|
| 303 |
- name: Test with coverage |
| 304 |
if: "matrix.use_coverage" |
| 305 |
shell: bash |
| 306 |
env: |
| 307 |
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit.xml |
| 308 |
run: tox run -e ${{ matrix.tox_env }}-coverage --installpkg `find dist/*.tar.gz` |
| 309 |
|
| 310 |
- name: Upload coverage to Codecov |
| 311 |
if: "matrix.use_coverage" |
| 312 |
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 |
| 313 |
with: |
| 314 |
fail_ci_if_error: false |
| 315 |
files: ./coverage.xml |
| 316 |
verbose: true |
| 317 |
|
| 318 |
- name: Upload JUnit report to Codecov |
| 319 |
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 |
| 320 |
with: |
| 321 |
fail_ci_if_error: false |
| 322 |
files: junit.xml |
| 323 |
report_type: test_results |
| 324 |
verbose: true |
| 325 |
|
| 326 |
check: # This job does nothing and is only used for the branch protection |
| 327 |
if: always() |
| 328 |
|
| 329 |
needs: |
| 330 |
- build |
| 331 |
|
| 332 |
runs-on: ubuntu-latest |
| 333 |
|
| 334 |
steps: |
| 335 |
- name: Decide whether the needed jobs succeeded or failed |
| 336 |
uses: re-actors/alls-green@a638d6464689bbb24c325bb3fe9404d63a913030 |
| 337 |
with: |
| 338 |
jobs: ${{ toJSON(needs) }} |