Skip to content
Draft
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions .github/workflows/reusable-nox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
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.

Copy link
Member

Choose a reason for hiding this comment

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

The problem is that integrating this action the way it is now kinda makes it impossible to have this nice separation of steps. So I see it as contributing to poor inspectability of the log.

Copy link
Member

Choose a reason for hiding this comment

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

It's probably a good idea to handle that first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that integrating this action the way it is now kinda makes it impossible to have this nice separation of steps ...

I agree here. As written, github-action-run-nox doesn't work like that. That means we either decide not to use it, contribute upstream changes to enable that work (if the folks that maintain in accept them), or spin out a new GHA for this.

include:
# Inputs:
# matrix:
# 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
- session: "static"
python-versions: "3.12"
- session: formatters_check
- session: "formatters_check"
python-versions: "3.12"
- session: typing
- session: "typing"
python-versions: "3.12"
- session: spelling
- session: "spelling"
python-versions: "3.12"
- session: "checkers(rstcheck)"
python-versions: "3.12"
Expand All @@ -34,19 +34,27 @@ jobs:
- session: "pip-compile"
extra-args: "--check"
python-versions: "3.12"

name: "Run nox ${{ matrix.session }} session"
steps:
- name: Check out repo
uses: actions/checkout@v5

- name: Setup nox
uses: wntrblm/[email protected]
with:
python-versions: "${{ matrix.python-versions }}"

- name: Graft ansible-core
run: |
nox -e clone-core
- name: "Run nox -e ${{ matrix.session }}"
run: |
# Using GHA expression interpolation is fine here,
# as we control all the inputs.
nox -e "${{ matrix.session }}" -- ${{ matrix.extra-args }}
uses: ansible-community/github-action-run-nox@v1
with:
sessions: clone-core
force-pythons: "${{ matrix.python-versions }}"

- 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 }}"
Comment on lines +54 to +59
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.

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'll have to dig into this. This might be the way to use the GHA as written and still achieve the two-step process you're looking for. What I'm not clear on (and I'll be looking into this) is if it will correctly re-use the sessions as expected.