Skip to content
Draft
Changes from all 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.

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.

# 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"
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.

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/nox@2025.05.01
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.