-
Notifications
You must be signed in to change notification settings - Fork 10
Add logic to bypass unneeded container load/workflow #62
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
Conversation
502521d to
e0f518e
Compare
|
@greenc-FNAL, can you explain the need for this PR? It's adding quite a bit a code, and I'd like to understand its benefits before adopting ~500 lines of code that we need to maintain. |
|
I'm particularly curious how much faster using |
|
It was more a case of, "If I have to make a container anyway, may as well use the better thing." |
|
... also the thing that doesn't depend on PERL. |
So now there are two images that we need to maintain? And one that only provides As I mentioned earlier, there are not many files that we need to deal with, and the ones that we do have follow a convention: |
|
The |
- Apply to `cmake-format-check`. Use ripgrep (`rg`) instead of `ack` Fix arguments to rg Remove unnecessary default target build Reduce per-workflow load and correct use of `rg` - Reorganize Dockerfile collection for plurality - Add a minimal container definition for `rg` - Require ripgrep, fail if not found - Use `rg --sort path` and `comm` to compare file lists Handle .in files Fix comment Update more workflows to be more efficient and handle generated files Update permissions
- Initial checks use cached version of workflows, which don't send the required arguments to the action, apparently. Once this PR is merged, this commit can be reverted.
Actions and workflows:
- Are now protected against input-based injection attacks or unsafe
characters (such as apostrophes in comments).
- Use environment variables instead of direct injection (`${{ ... }}`)
for `inputs\..*`.
- Use quoting of variables when appropriate.
- Use `printf` with parameter substitution rather then simply `echo`.
- Use `grep -E` with word boundary checking instead of `contains()` to
avoid false positives.
5e203fa to
24a8460
Compare
|
To address your other point:
|
|
Thanks, @greenc-FNAL, for the explanation. I agree with the goal of this PR. I will add some review comments soon. |
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.
Pull Request Overview
This PR optimizes CI workflows by introducing a change detection mechanism that skips workflows when no relevant files have changed, reducing unnecessary container loads and build operations. The changes introduce a new detect-relevant-changes action that uses file type filtering to determine if workflows should run.
Key changes:
- Created a reusable
detect-relevant-changesaction that filters changed files by type (cpp, cmake) - Added detection jobs to multiple workflows (coverage, clang-tidy-check, clang-format-check, cmake-format-check) with corresponding skip jobs
- Improved shell script safety by quoting variables and using environment variables instead of inline GitHub Actions expressions
- Extended file type coverage to include
.intemplate files for both C++ and CMake formatting workflows
Reviewed Changes
Copilot reviewed 14 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ci/entrypoint.sh | Converted to symbolic link pointing to docker/phlex-ci-default/entrypoint.sh |
| ci/docker/phlex-ci-default/entrypoint.sh | New location for entrypoint script content (relocated from ci/entrypoint.sh) |
| .github/workflows/coverage.yaml | Added change detection job to skip coverage workflow when no C++/CMake changes exist |
| .github/workflows/cmake-format-fix.yaml | Improved shell safety with quoted variables and added .in file support |
| .github/workflows/cmake-format-check.yaml | Added change detection job and extended file pattern matching to include .in files |
| .github/workflows/cmake-build.yaml | Enhanced trigger condition checking with proper quoting and environment variables |
| .github/workflows/clang-tidy-fix.yaml | Improved shell script safety by using environment variables |
| .github/workflows/clang-tidy-check.yaml | Added change detection, removed unnecessary default build step, added container credentials |
| .github/workflows/clang-format-fix.yaml | Added .in file extensions and improved shell safety |
| .github/workflows/clang-format-check.yaml | Added change detection job and extended file type support to .in files |
| .github/actions/setup-build-env/action.yaml | Improved shell safety with quoted variables and printf for path construction |
| .github/actions/detect-relevant-changes/action.yaml | New action implementing file change detection with type-based filtering |
| .github/actions/configure-cmake/action.yaml | Improved shell safety by using environment variables instead of inline expressions |
| .github/actions/build-cmake/action.yaml | Improved shell safety with environment variables |
knoepfel
left a comment
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.
@greenc-FNAL, thanks for the PR. Now that I understand its purpose, I generally agree with these changes. I do have some questions/suggestions below for your consideration.
detect-relevant-changesdetect-relevant-changesinto existing workflows.clang-tidy-check