ci: only run jobs when relevant files have been changed#12006
ci: only run jobs when relevant files have been changed#12006terrytangyuan merged 25 commits intoargoproj:masterfrom
Conversation
- e.g. don't run E2E tests if only UI or only Docs have changed - or don't run UI CI when UI has not chaged - use [`tj-actions/changed-files`](https://github.com/tj-actions/changed-files) action for this - the most popular and full featured one I could find - run `changed-files` in its own job that must run before all other jobs - have it `output` booleans for specific changes -- limit all the `changed_files` nuances, naming, syntax, etc to that one job - job `outputs` are also needed for skipping other jobs, as step outputs can't be directly accessed - see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs and https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context - have other jobs specify it in their `needs` and then skip if not needed with `if` - use multi-output variant of `changed-files` YAML directive - so can check e2e vs docs vs UI etc - use `any_modified` as that includes added, copied, modified, renamed, and deleted (ACMRD) - `any_changed` does not include deletions NOTE: I realized after that `docs` isn't a job, `lint` is, so there's gonna be some follow-up commits - and well need to test anyway too - will also include the `all` list _after_ testing, since it would make everything run Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- also tiny renames Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- list merging is not supported in YAML natively, but `changed-files` appears to support it? https://github.com/tj-actions/changed-files/blob/2a10bef1b42044172f2e64d40beeb8fbad792438/test/changed-files.yml#L8-L11 Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- both can run independently of each other and independently of tests - they should fail fast if the other one fails though, I suppose - otherwise this breaks some of the checks, since if tests are skipped, then codegen and lint are skipped too - or, well, that's my hypothesis at least -- will test by pushing this Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- so now only lint should run... Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
This reverts commit 34671d7. Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
agilgur5
left a comment
There was a problem hiding this comment.
left some comments for some in-line clarity about some changes
| common: &common | ||
| - .github/workflows/ci-build.yaml | ||
| tests: &tests | ||
| - *common |
There was a problem hiding this comment.
as mentioned in the PR description, tj-actions/changed-files supports a YAML variant that has array anchors & aliases
Can you elaborate on this? |
If one or more items of a So now that That is, I explicitly chose the safer option as it otherwise does not cover all cases (which I literally noticed while testing the "only run
In There is also a separate |
Mmm I think there is a way to leave the GH Actions have some implicit conditionals that are very disorienting IMO. They're basically missing Argo's enhanced Not a huge difference either way though with or without the |
|
Ah thanks @agilgur5, makes sense now, I misunderstood previously, in that case you have fixed an issue withe the CI process really. |
isubasinghe
left a comment
There was a problem hiding this comment.
I'd personally prefer if the Makefile was included, I think the tasks.yaml can probably be avoidede though
Sort of; it would never occur previously because there wasn't a conditional on |
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Fixes #10156
Fixes #10265
Motivation
Make CI run faster for certain kinds of PRs, use less CI minutes (and just reduce unnecessary compute in general), and limit the blast radius of flaky tests as well
Modifications
Changed Files checks
use
tj-actions/changed-filesaction for thisrun
changed-filesin its own job that must run before all other jobsoutputbooleans for specific changes -- limit all thechanged_filesnuances, naming, syntax, etc to that one joboutputsare also needed for skipping other jobs, as step outputs can't be directly accessedhave other jobs specify it in their
needsand then skip if not needed withifuse multi-output variant of
changed-filesYAML directivechanged-filessupports a YAML variant with list anchoring/aliasinguse
any_modifiedas that includes added, copied, modified, renamed, and deleted (ACMRD)any_changeddoes not include deletionsChanges to
needsforcodegenandlintboth can run independently of each other and independently of tests
without this change some of the checks malfunction, since if tests are skipped, then codegen and lint are skipped too (see
needsdocs)Changes to Status Checks
Note that due to lack of GH features such as actions/runner#952 and https://github.com/orgs/community/discussions/9141, there is a workaround embedded here for the E2E test matrix
e2e-testsjob will cause status checks for individual E2E tests to just hang indefinitelyiffor every singlestepof the E2E tests and also check for changed files within each E2E teste2e-tests-composite-resultjob aggregates all of the results as a workaroundVerification
I tested this quite extensively in my fork in agilgur5#1:
Notes to Reviewers
Future Work
argoexec-imagejob as well.dockerignoreetc