Skip to content

CI: Run plugin tests only when code changes#595

Open
skoeva wants to merge 1 commit intoAzure:mainfrom
skoeva:ci-fixes
Open

CI: Run plugin tests only when code changes#595
skoeva wants to merge 1 commit intoAzure:mainfrom
skoeva:ci-fixes

Conversation

@skoeva
Copy link
Copy Markdown
Collaborator

@skoeva skoeva commented Apr 14, 2026

These changes extend ci.yml with a find_changed_plugins pre-job so only the plugins affected by a PR are tested, rather than running all three on every push.

Fixes: #594

Summary

  • Adds a find_changed_plugin job that uses git diff origin/main...HEAD to dynamically build a matrix of only the plugins with changed files
  • All jobs (test, lint, build, security) consume the dynamic matrix and are skipped entirely if no plugins changed
  • translations job runs only when aks-desktop, ai-assistant, or Localize/ is touched
  • If any file outside plugins/ or Localize/ changes (e.g. .github/, root package.json, shared scripts), all plugins run as a fallback
  • Follows the same pattern used in headlamp-k8s/plugins

Testing

  • Open a PR touching only plugins/aks-desktop and verify only aks-desktop jobs run
  • Open a PR touching only plugins/ai-assistant and verify only ai-assistant jobs run
  • Open a PR touching only plugins/insights-plugin and verify only insights-plugin jobs run
  • Open a PR touching only Localize/** and verify only the translations job runs
  • Open a PR touching a root-level file (e.g. package.json) and verify all plugins run

@skoeva skoeva self-assigned this Apr 14, 2026
@skoeva skoeva added the quality label Apr 14, 2026
Copilot AI review requested due to automatic review settings April 14, 2026 13:57

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings April 14, 2026 15:00

This comment was marked as outdated.

@illume
Copy link
Copy Markdown
Collaborator

illume commented Apr 15, 2026

Can be done keeping the one file?

I remember doing something like this in the plugins repo with one file. Hrmm.

@skoeva
Copy link
Copy Markdown
Collaborator Author

skoeva commented Apr 15, 2026

@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

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/ci.yml Outdated
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/ci.yml
Comment on lines +34 to +35
changed_files=$(git diff --name-only origin/main...HEAD)
echo "Changed files:"
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CI: skip plugin tests when plugin code is unchanged

3 participants