Skip to content

Conversation

@x1101
Copy link
Contributor

@x1101 x1101 commented Oct 31, 2025

Marked as a DRAFT because it depends on a local fork of mine making changes to the upstream GHA. I have a PR in for that change. Once that's accepted, or the feature added in other ways, we can more accurately review this.

Addressed the request in #2511.

I am a little unsure of the approach I took on this, as the GHA looks for a single list of sessions to run. I converted the matrix over to that, but I'm unclear on what (if any) visibility into the details we'll lose that way. The other potential loss is if we intend to run different sessions against different python version in the same run (as opposed to running the whole action against a matrix of python versions).

If we determine that we're losing too many details or that we do need the ability to target multiple distinct pythons for different parts of the run, I can easily swap it back to the matrix setup, but still using this GHA.

Thoughts/questions/comments greatly appreciated.

Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

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

Thanks @x1101 Some nits for your day. Can we also update the PR title so it is a bit more descriptive about what we're converting?

workflow_call:
inputs:
python-versions:
description: Space-seperated list of python version(s) to run nox sessions with
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: Space-seperated list of python version(s) to run nox sessions with
description: Space-separated list of Python version(s) to install

required: false
default: "3.12"
sessions:
description: Space-seperated list of sessions
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: Space-seperated list of sessions
description: Space-separated list of nox sessions to run

description: Space-seperated list of sessions
type: string
required: false
default: "static formatters_check typing spelling checkers(rstcheck) checkers(rst-yamllint) checkers(docs-build) actionlint"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we just have "checkers" and run all three of those checks? I'm not sure it's necessary to specify which ones we want because it's all of them.

with:
sessions: "${{ inputs.sessions }}"

- name: "Run Sessions with Args"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- name: "Run Sessions with Args"
- name: "Run the pip-compile session in check mode"

uses: x1101/github-action-run-nox@ca8b16f76c53a04b14952620e7a4ac5c7dc29812
with:
sessions: "pip-compile"
extra-args: "--check"
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty line at end of file needed. 😄

Comment on lines 12 to 36
matrix:
include:
# Inputs:
# session: name of session
# python-versions: comma-separated list of Python versions to install
# extra-args (optional): extra arguments to pass to nox session.
- session: static
python-versions: "3.12"
- session: formatters_check
python-versions: "3.12"
- session: typing
python-versions: "3.12"
- session: spelling
python-versions: "3.12"
- session: "checkers(rstcheck)"
python-versions: "3.12"
- session: "checkers(rst-yamllint)"
python-versions: "3.12"
- session: "checkers(docs-build)"
python-versions: "3.12"
- session: "actionlint"
python-versions: "3.12"
- session: "pip-compile"
extra-args: "--check"
python-versions: "3.12"
Copy link
Member

Choose a reason for hiding this comment

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

The matrix is needed so that there's multiple jobs. But it should be moved outside the reusable workflow into the calling one.
Having one step with everything in the CI log produces a wall of text that is difficult to parse and individual checks aren't represented in the checks widget in PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that's exactly what I was concerned about, and the feedback I was looking for.

I'll rework it to address this.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I actually have been researching mass maintenance of tox-managed projects and this is conceptually the same. I came up with a bunch of such principles when working on reusable-tox (calling side example: https://github.com/cherrypy/cheroot/blob/06a6d67e549ccaefe332cd0539c21e1483031071/.github/workflows/ci-cd.yml#L586-L690) and contributing to CPython's CI infra.

You can lurk in https://github.com/tox-dev/workflow/blob/208490c75f7f6b81e2698cc959f24d264c462d57/.github/workflows/reusable-tox.yml to see if you'd want to borrow some ideas.

@x1101
Copy link
Contributor Author

x1101 commented Nov 8, 2025

@webknjaz I think bringing the Matrix of sessions back addresses this concerns?

@oraNod I think this succeeds your concern about naming of the sessions. But I can see as its running that I missed "needs a blank line at the end of the file" when pushing this. I'll get one in for that.

@x1101 x1101 changed the title Convert to using nox GHA Convert reusable-nox workflowk to using nox GHA Nov 8, 2025
- Per discussions, added the sessions matrix back in, instead of
  a single string list of sessions to support cleaner output of statuses
- Replaced (temp) x1101/github-action-run-nox with
  ansible-community/github-action-run-nox
- Repalced "matrix.sessions" with "matrix.session"
- All sessions now in quotes
@x1101
Copy link
Contributor Author

x1101 commented Nov 8, 2025

I did a few fixups, and now it looks like its down to failing the actionlint session. I'll continue to investigate why this is.

- Replaced `inputs.` with `matrix.` This resovles the `actionlint`
  errors
@x1101
Copy link
Contributor Author

x1101 commented Nov 8, 2025

I think I found it. I was still using inputs. instead of matrix. in some places. While that didn't seem to impact the running of the sessions, it caused actionlint to fail. Correcting that seems to have resolved the issues.

At this point, I think this is ready to remove the "Draft" tag and be considered for full PR, unless there's additional feedback from @webknjaz or @oraNod on its current state.

# python-versions: comma-separated list of Python versions to install
# extra-args (optional): extra arguments to pass to nox session.
- session: static
- session: "static"
Copy link
Member

Choose a reason for hiding this comment

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

Did somebody request wrapping string literals with quotes? My preference is usually removing them as much as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I was having issues isolating the individual sessions, and this was one of the steps I took to do that.

Given the other fixes, there's a good chance its not needed. I'll re-test without them.

matrix:
include:
# Inputs:
# matrix:
Copy link
Member

Choose a reason for hiding this comment

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

Seeing the word from two lines above repeated looks confusing. It seems to be commented out code at glance.

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Copy link
Member

Choose a reason for hiding this comment

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

What I meant originally is that this matrix should be in the calling workflow, not the reusable one. That would be ci.yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean. But I think that's a larger change to the workflow. As I understand it, the goal here is to take the existing workflow, which calls nox directly from a matrix and replace it with one that uses the GHA.

My preference would be to get the in-place change made and functional first before looking at reorganizing things.

That being said, if there's a strong desire to wrap that effort into this one, we can better outline that in the initial issue and I can look into tacking that too.

Comment on lines +54 to +59
- name: "Run nox session"
uses: ansible-community/github-action-run-nox@v1
with:
sessions: "${{ matrix.session }}"
extra-args: "${{ matrix.extra-args || '' }}"
force-pythons: "${{ matrix.python-versions }}"
Copy link
Member

@webknjaz webknjaz Nov 8, 2025

Choose a reason for hiding this comment

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

Here's examples of splitting provisioning the venv and running the logic:

TL;DR for two steps to show up separately in CI, they should be actual separate entries in the step list (for the same session). The first one would run with nox --install-only, and it'd be followed by nox --no-install.

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