Skip to content

Add GitHub Actions workflow for tox #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 19, 2021
Merged

Add GitHub Actions workflow for tox #527

merged 19 commits into from
May 19, 2021

Conversation

jayaddison
Copy link
Contributor

@jayaddison jayaddison commented Jan 10, 2021

Provides a migration path for #525.

  • The python debug.py post-build step from .travis.yml has not been migrated; GitHub Actions workflows support a continue-on-error configuration flag at the job and step level, but I don't yet see whether this can be used to provide an equivalent 'post-job' command.
  • As of the initial version of this pull request, builds take place within a single GitHub Actions workflow that runs tox in parallel mode. Build output for each Python environment is present in the workflow console, but it's not as human-readable as the grouping provided by Travis CI.

@jayaddison
Copy link
Contributor Author

See https://github.com/jayaddison/html5lib-python/runs/1677406878 for example GitHub Actions build output corresponding to c217133.

@hugovk
Copy link
Contributor

hugovk commented Jan 11, 2021

GitHub Actions provides 20 parallel workers, have you considered using a matrix to test each Python version in its own worker rather than all in parallel in a single worker? Should be much quicker.

@hugovk
Copy link
Contributor

hugovk commented Jan 11, 2021

But otherwise, big 👍 for moving from Travis CI to GHA.

@jayaddison
Copy link
Contributor Author

@hugovk Thanks! Using a matrix strategy would seem ideal - the challenge is the combinatorial tox envlist, since the Python interpreter versions provided in GitHub Actions don't correspond to the tox.ini-defined interpreter names.

The tox-gh-actions plugin is fairly widely adopted to solve more-or-less this problem, and it does that by reading a Python-version-to-environment mapping from the tox.ini file (example).

It's worth pausing and thinking about this change for a little while before merge, I think. There may be a way to achieve the worker-per-environment goal in a different way - or perhaps it should be reported / discussed upstream.

@jayaddison
Copy link
Contributor Author

tox-dev/tox#659 may be a relevant issue to track relating to this

@jayaddison
Copy link
Contributor Author

The latest commits re-attempt a matrix build strategy via GitHub Actions; the generic py prefix for tox generative names should map to the 'current default Python interpreter', so the generative factor is removed from tox.ini and replaced by the GHA YAML configuration.

This does have an unfortunate side-effect that it'll be trickier for developers with a local checkout of the repository to test the package against all Python versions by simply running tox. Instead it will test against their default Python interpreter. That doesn't seem perfect.

runs-on: ubuntu-latest
strategy:
matrix:
python: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy3]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB for review: do pypy-2.7 and pypy3 respectively correspond to pypy and pypy3 as previously listed in tox.ini?

@jayaddison
Copy link
Contributor Author

GitHub Actions provides 20 parallel workers, have you considered using a matrix to test each Python version in its own worker rather than all in parallel in a single worker? Should be much quicker.

Ok, my mistake previously @hugovk; I overcomplicated things. This does look feasible after all, with one caveat/tradeoff regarding developer experience for local checkouts.

See https://github.com/jayaddison/html5lib-python/runs/1691598506 for an example multi-pipeline build via GHA using a matrix strategy

@jayaddison
Copy link
Contributor Author

... and perhaps that local checkout dev experience issue is now resolved too. Each GHA worker now runs tox -e py, invoking the test suite for a single Python interpreter, as configured via the matrix worker environment list.

The remaining tradeoff/downside is that the environment list now exists in tox.ini (for local workflows) and is duplicated in the GHA YAML file.

https://github.com/jayaddison/html5lib-python/actions/runs/481474149 contains the latest build output as per commit 19cf7f7

@jayaddison
Copy link
Contributor Author

Ping @gsnedders @jgraham @willkg

@jgraham jgraham merged commit 2f25bf2 into html5lib:master May 19, 2021
@jayaddison jayaddison deleted the github-workflows/python-tox branch May 19, 2021 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants