-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Generate CI matrix at runtime #428
Conversation
3ff0476
to
8047f17
Compare
- pythonbuild | ||
runs-on: depot-macos-14 | ||
strategy: | ||
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} |
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 did not realize this magic was possible. Otherwise I would have done this months ago.
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.
It's fairly new (though at least a year old). I'm glad you're into it!
Another note for the future, we could roll these into a single workflow. I don't know if it's worth it though. We can also use this to automatically split the matrix if we exceed the matrix job limit again (i.e., when adding new variants). |
I want to validate that all the expected artifacts are here before merging, seems like a bit of a pain but I don't want to drop something? edit: I validated these manually, oof. |
8047f17
to
0c9fee4
Compare
0c9fee4
to
9ed69cd
Compare
- name: Generate build matrix | ||
id: set-matrix | ||
run: | | ||
uv run ci-matrix.py --platform darwin --labels "${{ steps.get-labels.outputs.labels }}" > matrix.json && echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT |
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.
Do we need single quotes here to avoid shell injection/escape?
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.
As in, via the labels? I don't think people can create arbitrary labels in the organization, and I don't think commits on main
could be targeted — but I'm happy to switch to single quotes to make it more robust anyway.
Generates the CI matrix dynamically so we can run subsets on pull requests.
ci-targets.yaml
fileci-matrix.py
script which parses theci-targets.yaml
file and outputs a JSON matrixFor example, you can run the matrix generator locally to see the label subsetting in action:
I'll add labels for
platform:darwin
platform:linux
platform:windows
python:3.9
python:3.10
python:3.11
python:3.12
python:3.13
build:debug
build:pgo
build:lto
build:noopt
build:freethreaded
arch:x86_64
arch:aarch64
arch:armv7
arch:s390x
arch:ppc64le
arch:x86
libc:gnu
libc:musl
In a follow-up, I'll update this to use different runners in forks as noted in #426