Repository navigation
CI Have the name of the failing build in the tracking issue - #33203
Conversation
| shell: bash | ||
| run: | | ||
| set -ex | ||
| if [[ -z "$JOB_NAME" ]]; then JOB_NAME="${{ matrix.name }}"; fi |
There was a problem hiding this comment.
Actually I think we have a similar problem in other places like the ccache step, we use ${{ matrix.name }} but actually this is empty for non-standard jobs (e.g. free-threaded).
I am wondering if one work-around would be to have a step early on that defines the env variable JOB_NAME by putting it in GITHUB_ENV and then using env.JOB_NAME everywhere?
There was a problem hiding this comment.
Yes good point, I noticed ${{ matrix.LOCK_FILE }} is also used, I'll try to add a strep to put both variables in env.
| COVERAGE: false | ||
| # Disable pytest-xdist to use multiple cores for stress-testing with pytest-run-parallel | ||
| PYTEST_XDIST_VERSION: none | ||
| JOB_NAME: "Linux x86-64 pylatest_free_threaded" |
There was a problem hiding this comment.
I am wondering whether using YAML anchor would be a good idea or not, something like (untested)
name: Linux x86-64 pylatest_free_threaded &free-threaded-job-name
env:
JOB_NAME: *free-threaded-job-nameThis may be overkill to be honest not 100% sure ...
Maybe adding a comment would be useful (not sure where exactly) that setting the JOB_VARIABLE variable is needed to overcome a limitation of GitHub this is a limitation of GitHub with a link to a somewhat useful source?
There was a problem hiding this comment.
I did not find a nice and clean source, my conclusion came from experiments on my fork and discussions with chatbots, but looking for a ref I stumbled upon a 3rd party action which provides the job name as an env variable. Not sure it's worth adding it though.
There was a problem hiding this comment.
Probably not worth depending on a 3rd party action for such a small functionality.
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set env variables |
There was a problem hiding this comment.
Explain somewhere that this is needed to treat matrix jobs and separate jobs (like free-threaded or debian-32) in a uniform manner.
Co-authored-by: Loïc Estève <[email protected]>
Co-authored-by: Loïc Estève <[email protected]>
Co-authored-by: Loïc Estève <[email protected]>
…OB_NAME declaration
|
Nice, I can tell from your tests on your fork this seems to work fine, see e.g. FrancoisPgm#46. |
|
|
||
| free-threaded: | ||
| name: Linux x86-64 pylatest_free_threaded | ||
| name: &free-threaded-job-name Linux x86-64 pylatest_free_threaded |
There was a problem hiding this comment.
Have you tried doing it the other way around. I would find it a tiny bit less ugly (first real content, then quirky thing for the anchor ...)
| name: &free-threaded-job-name Linux x86-64 pylatest_free_threaded | |
| name: Linux x86-64 pylatest_free_threaded &free-threaded-job-name |
There was a problem hiding this comment.
I tried but then ruff got angry at me :
check yaml...............................................................Failed
- hook id: check-yaml
- exit code: 1
found undefined alias 'free-threaded-job-name'
in ".github/workflows/unit-tests.yml", line 316, column 17
There was a problem hiding this comment.
OK, fair enough, it's more pre-commit and its check-yaml check than ruff but let's keep it like this anyway 🤷
|
|
||
| scipy-dev: | ||
| name: Linux x86-64 pylatest_pip_scipy_dev | ||
| name: &scipy-dev-job-name Linux x86-64 pylatest_pip_scipy_dev |
There was a problem hiding this comment.
In case that works with YAML anchor and GitHub restricted implementation of them
| name: &scipy-dev-job-name Linux x86-64 pylatest_pip_scipy_dev | |
| name: Linux x86-64 pylatest_pip_scipy_dev &scipy-dev-job-name |
lesteve
left a comment
There was a problem hiding this comment.
Other than the two comments, looks good to me, thanks!
Reference Issues/PRs
Fix issue raised in #33152 (comment)
What does this implement/fix? Explain your changes.
Get the name of the failing build in the tracking issue name, even if the build is not in the job matrix.
AI usage disclosure
I used AI assistance for:
Any other comments?
Apparently there is no way to access the job name from the job steps, so I used an env variable containing the job name as a workaround.