-
Notifications
You must be signed in to change notification settings - Fork 306
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
Finish transition from tox to Nox for current continuous integration checks and weekly tests #2694
base: main
Are you sure you want to change the base?
Finish transition from tox to Nox for current continuous integration checks and weekly tests #2694
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2694 +/- ##
==========================================
- Coverage 95.24% 95.14% -0.10%
==========================================
Files 104 107 +3
Lines 9435 9411 -24
Branches 2167 2168 +1
==========================================
- Hits 8986 8954 -32
- Misses 272 276 +4
- Partials 177 181 +4 ☔ View full report in Codecov by Sentry. |
To make sure that mypy is run consistently across platforms.
I updated the conditions when this workflow happens so that it is only done as a cron job for PlasmaPy/PlasmaPy@main, but will still run on PRs with the appropriate label, and by workflow dispatch.
@@ -12,12 +16,10 @@ on: | |||
workflow_dispatch: | |||
|
|||
env: | |||
DOC_TROUBLESHOOTING: "Warnings like 'reference target not found' occur when Sphinx tries to interpret text as a Python object, but is unable to do so. This warning can often be fixed by surrounding text in double back ticks instead of single back ticks (e.g., by changing `y` to ``y``) so that it gets formatted as an in-line literal. For more information about addressing documentation build failures, please check out the documentation troubleshooting guide at: https://docs.plasmapy.org/en/latest/contributing/doc_guide.html#troubleshooting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛗 I moved this into the Nox session (with some edits).
- name: Install nox and uv | ||
- name: Install graphviz and pandoc for documentation builds | ||
if: startsWith(matrix.name, 'Documentation') | ||
run: sudo apt-get install graphviz pandoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📌 In the future, we could add a Nox session that does the installation for us, or include that as part of the docs
session.
|
||
documentation: | ||
|
||
name: Documentation, Python 3.12, Ubuntu | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install graphviz and pandoc | ||
run: sudo apt-get install graphviz pandoc | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
cache: pip | ||
|
||
- name: Install nox uv | ||
run: python -m pip install --progress-bar off --upgrade nox uv | ||
|
||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
.nox | ||
key: docs-${{ runner.os }}-${{ hashFiles('requirements.txt') }} | ||
|
||
- name: Build documentation with Sphinx | ||
run: nox -e docs -- -q | ||
|
||
- name: Print troubleshooting information on failure | ||
if: ${{ failure() }} | ||
run: echo -e $DOC_TROUBLESHOOTING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✂️ There was a lot of duplication in the workflows for building docs and running tests, so I merged them together above.
if: >- | ||
github.event_name == 'workflow_dispatch' || | ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'perform linkcheck in CI')) || | ||
(github.event_name == 'schedule' && github.repository == 'PlasmaPy/PlasmaPy' && github.ref == 'refs/heads/main') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 This is saying that this workflow should only be run:
- If we manually trigger it (via workflow dispatch)
- It's a pull request that has been labeled with "perform linkcheck in CI"
- As a cron job if it's on the
main
branch ofPlasmaPy/PlasmaPy
.
My motivation here is to avoid cron jobs being run on forks, which can waste a lot of computing resources.
I'll be honest...ChatGPT helped me write this one.
…inst-dev-versions-of-dependencies
…inst-dev-versions-of-dependencies
…inst-dev-versions-of-dependencies
if: >- | ||
github.event_name == 'workflow_dispatch' || | ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run weekly tests in CI')) || | ||
(github.event_name == 'schedule' && github.repository == 'PlasmaPy/PlasmaPy' && github.ref == 'refs/heads/main') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 This is saying that we should run tests...
- If we manually trigger it (via workflow dispatch)
- It's a pull request that has been labeled with "run weekly tests in CI"
- As a cron job if it's on the
main
branch ofPlasmaPy/PlasmaPy
.
This PR concludes the switchover from tox to Nox. I wanted to finish this ahead of the PlasmaPy Summer School so that participants won't need to learn how to work with tox (or more specifically,
tox.ini
).The changes in this PR include:
tox.ini
in its entirely, and there was much rejoicing. Using tox has overall been great, except for the INI-formatted configuration files! (We still havemypy.ini
...but I'm hoping that's only temporary.)requirements.txt
, as inspired by Requirements files need to be rethought #2647. It's not being used in CI anymore or by any Nox sessions, so we don't need it. Plus, IDEs are much more adept at getting requirements information frompyproject.toml
than they used to be.Some notes:
sudo apt install
step for pandoc and graphviz is specific to Ubuntu.mypy
to thetests
dependency set, primarily because then we won't have requirements information defined innoxfile.py
that we have to update.Remaining tasks
noxfile.py