Lookup github action values from nox #800
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, thanks for this awesome project!
This PR establishes a single source of truth for python versions and tests matrix, driven by nox.
I had this idea for my own projects as I've often been frustrated with duplicated data between pre-commit, nox, and gitlab. I wanted to implement this in this project for a few reasons:
nox
docs about this.Changes
These are the differences in behavior from before:
if: matrix.python-version != '3.7'
withinci.yml
because that is already in thenoxfile.py
asif (python, tox_version) != ("3.7", "latest")
, and the goal of this PR is to create a single source of truth. In order to do this, I had to change the dimensions of thestrategy:matrix
from[os, python-version]
to[os, python-version, tox-version]
. This may actually improve run time as more jobs run in parallelnox -s 'tests(tox_version=latest)'
will only runtest_tox_to_nox.py
by default. This was done to make the local test and CI behave the same, which reduces developer confusion as well as special-case code inci.yml
. To override, just pass-- tests
Other thoughts
The most difficult part of this project was discovering the right incantations for
jq
to mutate the data fromnox -l --json
(though it is fairly readable once it's done). If this idea catches on, I foresee a need for a CLI tool (either part of nox or separate) which can reduce the complexity and boilerplate by preparing nox session data in ways that can be more easily consumed by Gitlab, Github, pre-commit, etc.