tox-gh-actions is a tox plugin which helps running tox on GitHub Actions
with multiple different Python versions on multiple workers in parallel.
This project is inspired by tox-travis.
If there are multiple matching Python versions in the configuration, only the most precise one is used.
For example, if you are running CPython 3.14 and gh-actions.python has both 3 and 3.14,
tox-gh-actions gets factors only from the key 3.14.
Changed in 3.0: pypy3 is not supported in the configuration anymore. Please use pypy-3 instead.
Factor-Conditional Settings: Environment Variable
You can also use environment variable to decide which environment to run.
The following is an example to install different dependency based on platform.
It will create 9 jobs when running the workflow on GitHub Actions.
On Python 3.10/ubuntu-latest job, tox runs py310-linux environment
On Python 3.12/ubuntu-latest job, tox runs py312-linux environment
[tox]
envlist = py{310,312,314}-{linux,macos,windows}
[gh-actions]
python =
3.10: py310
3.12: py312
3.14: py3114
[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
[testenv]
deps =
<common dependency>
linux: <Linux specific deps>
macos: <macOS specific deps>
windows: <Windows specific deps>
...
Changed in 3.0: Environment variables should not use lowercase letters.
Because of the limitation in tox's configuration loading API,
tox-gh-actions always convert keys in [gh-actions:env] to uppercase.
tox requires
If your project uses tox's requires configuration,
you must add tox-gh-actions to the requires configuration as well. Otherwise, tox-gh-actions won't be loaded as a tox plugin.
[tox]
requires =
tox-conda
tox-gh-actions
Overriding Environments to Run
Changed in 2.0: When a list of environments to run is specified explicitly via -e option or TOXENV environment variable (tox's help),
tox-gh-actions respects the given environments and simply runs the given environments without enforcing its configuration.
Before 2.0, tox-gh-actions was always enforcing its configuration even when a list of environments is given explicitly.
Versioning
This project follows PEP 440 and uses a format of major.minor.patch (X.Y.Z).
The major version (X) will be incremented when we make backward incompatible changes to a public API.
The public API of this project is the configuration of tox-gh-actions.
The major version can be also incremented when we require a new version of tox.
This project tries not to introduce backward incompatibles changes as much as possible so that users don't need to
update their project's configuration too frequently.
tox-gh-actions 3.x may drop support of unsupported Python 3.y versions in the future without bumping its major version.
Versions and Compatibility
We recommend to use the latest version of tox 4.x and tox-gh-actions 3.x.
To use tox-gh-actions with tox 3.x, please install tox-gh-actions 2.x.
The following table shows compatibility between tox and tox-gh-actions.
tox-gh-actions writes log messages using the standard logging module.
This is handy for understanding behavior of tox-gh-actions and for debugging tox-gh-actions.
To see the log messages, please run tox -vv.
Alternatives
Use instead of tox-gh-actions: tools that do the same job, closest first.