CI: Run plugin tests only when code changes#595
Conversation
|
Can be done keeping the one file? I remember doing something like this in the plugins repo with one file. Hrmm. |
|
@illume I think so...I just thought it would be nice to split things up like in the main headlamp repo. I suppose one file would be good in the case that we add more plugins |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| changed_files=$(git diff --name-only origin/main...HEAD) | ||
| echo "Changed files:" |
There was a problem hiding this comment.
git diff --name-only origin/main...HEAD won’t correctly detect changes on push events to main (after the push, origin/main typically points at the same commit as HEAD, so the diff is empty and the workflow falls back to “run all plugins”). If the goal is to reduce work on both PRs and pushes (as described), consider selecting the diff base by event type (e.g., for push: ${{ github.event.before }}..${{ github.sha }}; for pull_request: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) instead of always using origin/main...HEAD.
These changes extend
ci.ymlwith afind_changed_pluginspre-job so only the plugins affected by a PR are tested, rather than running all three on every push.Fixes: #594
Summary
find_changed_pluginjob that usesgit diff origin/main...HEADto dynamically build a matrix of only the plugins with changed filestest,lint,build,security) consume the dynamic matrix and are skipped entirely if no plugins changedtranslationsjob runs only whenaks-desktop,ai-assistant, orLocalize/is touchedplugins/orLocalize/changes (e.g..github/, rootpackage.json, shared scripts), all plugins run as a fallbackTesting
plugins/aks-desktopand verify onlyaks-desktopjobs runplugins/ai-assistantand verify onlyai-assistantjobs runplugins/insights-pluginand verify onlyinsights-pluginjobs runLocalize/**and verify only thetranslationsjob runspackage.json) and verify all plugins run