Repository navigation
Commit 1e5edbc
ci: run tox weekly and on demand
The main CI does not use tox, so the tox configuration can break
without anyone noticing. It has: `tox -e html` stopped working when
9e54de4 (gitpython-developers#2243) removed the `doc` extra, `tox -e misc` has run
`ruff check` again since b7ce712 (gitpython-developers#2031) changed that hook's id, and
the `base_python` fallbacks have not meant what they said since
62c024e (gitpython-developers#1693). New releases of tox and virtualenv can also change
how the configuration behaves, as when tox 4.56.0 made missing
interpreters fail. But running every tox environment is too slow for
every push and pull request.
Add a `tox` workflow that runs on a weekly schedule and through
`workflow_dispatch`. Each job runs the tox environments for one Python
version, from 3.8 to 3.15, on Ubuntu. 3.8 and 3.9 run on `ubuntu-24.04`,
since `setup-python` has no builds of them for Ubuntu 26.04. The 3.12
job also runs `gix`, and the 3.13 job also runs `ruff`, `format`,
`mypy`, `html`, and `misc`. The steps that prepare for the tests (Rust
for GixPython source builds, current Git from the git-core PPA,
`init-tests-after-clone.sh`, and the test Git identity and aliases) are
the same as in `pythonpackage.yml`.
tox and the plugin used below both need Python 3.11 or later, so
`setup-python` also installs Python 3.13, and tox runs on that. tox is
installed unpinned, so that the workflow tests the configuration with
the tox and virtualenv that a contributor would get. The job has only
`contents: read` and uses no secrets.
For running tox on GitHub Actions, there are two tox plugins and one
action:
- `tox-gh`, from the `tox-dev` organization that maintains tox, selects
the environments for the job's Python version from a mapping in the
tox configuration, puts each environment's output in its own log
group, and summarizes the results.
- `tox-gh-actions`, an older plugin maintained outside `tox-dev`, does
the same with more ways to select environments, and also supports
tox 3. This project needs only selection by Python version.
- `fedora-python/tox-github-action` runs tox in a Fedora container
that has most Python versions, but no longer 3.8. It also pulls its
image by a mutable tag, its repository has no license, and it runs
tox as root in the container, which would change what GitPython's
tests see about file ownership and `safe.directory`.
Use `tox-gh`. Selecting environments by version is simple here, but the
log groups make long weekly logs easier to read, and it adds little
risk, since it comes from the `tox-dev` organization, like tox itself.
Its mapping goes in `[tool.tox.gh.python]` in `pyproject.toml`.
`tox-gh` does nothing outside GitHub Actions, and without it,
`tox config` only adds a note that `gh` is unused. The job sets
`TOX_GH_MAJOR_MINOR` to the matrix version, as `tox-gh` documents for
when tox runs on a different Python.
`actionlint`, `zizmor` 1.31.1 (pedantic, with online audits), and
`pinact run --check --verify-comment` report nothing for the new
workflow, and all pre-commit hooks pass. With `GITHUB_ACTIONS=true`
set locally, tox with `tox-gh` ran only `py38` for
`TOX_GH_MAJOR_MINOR=3.8`, in its own log group, and set up `py313`,
`ruff`, `format`, `mypy`, `html`, and `misc` for 3.13.
`workflow_dispatch` and `schedule` only work once the workflow is on
the default branch, so it was run on a fork through a temporary `push`
trigger, together with this branch's other changes. Every job passed
except the 3.12 job's `gix` environment, whose installation test needs
package downloads that `test/run-local.py` blocks. With a separate
change that allows them, every job passed. The 3.12 job, which takes
longest, took between 13 and 17 minutes.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent aa476c3 commit 1e5edbc
2 files changed
Lines changed: 106 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
0 commit comments