Repository navigation
test: narrow the runner-shape guards to runs-on values and local steps - #37
Merged
Merged
Conversation
The guard against a self-hosted runner read the whole workflow text, so a comment saying "self-hosted" failed it; it now reads only runs-on values. The guard against the Compose install action checked that no .github/actions directory exists, which also failed on a checkout with leftover untracked files; it now checks that no step uses a local path.
The review found that a step written as name: then uses: loses its dash once the parser strips the line, so the local-action check missed it, as it missed a quoted path. The runs-on check now compares every runs-on line in the file with the expected value, so a block form or a job the parser skipped cannot hide a self-hosted label.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The runner-shape guards in
tests/python/test_workflows.pywere broader than the rule they hold (closes #22): a regex forself-hostedover the whole file failed on a harmless comment, and an assertion that no.github/actionsdirectory exists failed on a checkout with untracked leftovers.What changed
tests/python/test_workflows.py: theself-hostedcheck reads onlyruns-onlines, and compares everyruns-online in the file withruns-on: ubuntu-latest, so a block form or a job the parser skipped cannot hide a label. The local-action check reads the steps of each job for auses:of a./path, with or without the leading dash (a step whose first key isname:) and with or without quotes, instead of checking that a directory is absent.Tests run
docker compose -f docker/compose.yaml run --rm --no-deps python-tests: passes on both commits.runs-on: self-hosted, a block-formself-hostedlist, a first job with a commented header and a block-form list,- uses: ./...,name:thenuses: ./..., a double-quoted path, and extra spaces with a single-quoted path; passes unchanged and when a comment says "self-hosted".Review
Independent review of the first commit. Blocking: a step written as
name:thenuses:loses its dash once the parser strips the line, so the local-action check missed it, and a quoted path too; fixed in the second commit, which also folds in the reviewer's hardening of theruns-oncheck (every line file-wide, independent of the parser). Non-blocking, filed as #36: the job parser drops header lines it does not recognise without failing.