Repository navigation
Commit 916622b
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` ran `ruff
check` again after b7ce712 (gitpython-developers#2031) changed that hook's id, and the
`base_python` fallbacks did not mean what they said from 62c024e
(gitpython-developers#1693) on. 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.13
job also runs `gix`, `ruff`, `format`, `mypy`, `html`, and `misc`.
`gix` goes there because its `base_python` is `python3`, which
virtualenv satisfies with the Python that tox itself runs on, which
here is 3.13, as described below. 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.
To select each job's environments, use `tox-gh`, from the `tox-dev`
organization that maintains tox. It reads a mapping from Python
versions to environments, here in `[tool.tox.gh.python]`, puts each
environment's output in its own log group, and does nothing outside
GitHub Actions. The job sets `TOX_GH_MAJOR_MINOR` to the matrix
version, as `tox-gh` documents for when tox runs on a different Python.
The alternatives were `tox-gh-actions`, an older plugin maintained
outside `tox-dev` whose extra ways of selecting environments this
project does not need, and `fedora-python/tox-github-action`, which
runs tox as root in a Fedora container that no longer has Python 3.8,
pulled by a mutable tag, from a repository with no license. Running as
root would also change what GitPython's tests see about file ownership
and `safe.directory`.
The configuration sets `skip_missing_interpreters = true`, so that
local runs skip Python versions that are not installed. A job here
must not skip, since it exists to test one Python version, so pass
`--skip-missing-interpreters=false`. The option's value is optional,
and a bare `--skip-missing-interpreters` means `true`, so the `=` form
makes clear that `false` is its value.
Give each job `timeout-minutes: 60`, so that a hang, such as a stuck
test, Git fetch, or build, stops long before GitHub's default of 6
hours. That should only stop a job that has hung. The `test` jobs on
Ubuntu in `pythonpackage.yml` take about 4 to 9 minutes, with a warm
Cargo cache. Here there is no Cargo cache, each job for Python 3.11 or
later builds GixPython from source, and the 3.13 job runs seven
environments.
`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. In a minimal project
with `skip_missing_interpreters = true` and `tox-gh` active, a job
whose mapped environment had no interpreter failed with
`--skip-missing-interpreters=false`.
`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. Run that way with this branch's other changes, every job
passed. In the latest run, the 3.13 job took about 13 minutes, the
other jobs for 3.11 and later 8 to 9 minutes, and the 3.8, 3.9, and
3.10 jobs about a minute or less. Earlier runs, before the tests of
`tox -e gix` could use the package index, failed only in `gix`.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 9fbf521 commit 916622b
2 files changed
Lines changed: 109 additions & 1 deletion
| 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 | + | |
| 95 | + | |
| 96 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
0 commit comments