Skip to content

chore: optimize CI by skipping unnecessary jobs#853

Merged
nogeenhenk merged 10 commits into
mainfrom
chore/ci-path-filtering
Mar 30, 2026
Merged

chore: optimize CI by skipping unnecessary jobs#853
nogeenhenk merged 10 commits into
mainfrom
chore/ci-path-filtering

Conversation

@nogeenhenk
Copy link
Copy Markdown
Contributor

@nogeenhenk nogeenhenk commented Mar 30, 2026

Summary

Skip expensive CI steps when irrelevant files change, without affecting required checks.

Approach

Instead of using paths filters at the workflow trigger level (which can leave required checks stuck in "pending"), this PR:

  1. Always triggers workflows
  2. Uses a cheap changes job to detect modified files
  3. Jobs always run and report success
  4. Heavy steps (Qt install, build, test) are skipped internally when not needed

This saves CI time while avoiding the "pending required check" issue.

Changes

Workflow Heavy steps skipped when
ccpp.yml no src, tests, Qt, localization, icons, docs changes
codeql.yml no src, tests changes
linter.yml no relevant code, yaml, markdown, scripts, etc. changes
publiccode.yml no publiccode.yml changes
docs.yml no src, tests, docs changes
release-installers.yml no src, tests, Qt changes
reuse.yml always runs full (repo-wide compliance)

merge_group

All workflows also trigger on merge_group to ensure full CI passes before merging.

Benefits

  • Docs-only PRs complete instantly (heavy steps skipped)
  • Required checks always report SUCCESS (never pending)
  • No branch protection changes needed

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 30, 2026

Coverage Status

coverage: 18.447%. remained the same
when pulling 4450742 on chore/ci-path-filtering
into 2ffedf6 on main.

Add paths filters to skip CI when irrelevant files change:
- ccpp.yml: src/**, tests/**, Qt files, localization, icons, docs
- codeql.yml: only C++ code
- publiccode.yml: only publiccode.yml
- reuse.yml: unfiltered (repo-wide compliance check)

Also adds merge_group trigger (without branches filter).

Note: paths filtering is only used for non-required checks.
@nogeenhenk nogeenhenk force-pushed the chore/ci-path-filtering branch from 09c14d2 to 5228b3d Compare March 30, 2026 01:01
@annejan
Copy link
Copy Markdown
Member

annejan commented Mar 30, 2026

I think we can push this a bit further while also avoiding the “pending required check” edge case.

Instead of relying on paths at the workflow trigger level, we can keep workflows always running and gate the expensive jobs internally based on changed files. That way:

  • required checks always report (no pending state)
  • docs-only PRs still complete almost instantly
  • we avoid burning CI resources unnecessarily

Issue #854 moves in a heavy direction while we are introducing a lightweight “changes” step and conditionally running the heavy jobs.

So the pattern would be:

  • always trigger the workflow
  • detect relevant changes early
  • only run build/test jobs when needed
  • otherwise exit fast with success

This gives us the same optimization goal, but without needing to adjust branch protection rules or risk blocking merges.

- Remove paths filter from workflow triggers
- Add dorny/paths-filter to detect changed files
- Make expensive jobs conditional based on changes
- merge_group always runs all jobs

This avoids the 'pending required check' issue by keeping
workflows always running but skipping expensive jobs internally.
- Add changes job to detect relevant file changes
- Make expensive jobs conditional based on changes
- merge_group and tags always run builds
- Tags still trigger builds for releases
@nogeenhenk nogeenhenk changed the title chore: add path-based filtering to GitHub Actions chore: optimize CI by skipping unnecessary jobs Mar 30, 2026
- Add no-op job to each workflow that runs when no relevant files changed
- No-op jobs emit a success result instead of being skipped
- This ensures required checks always report (success or skipped, never pending)

This completes the fix for issue where path filtering caused required checks to stay pending.
- Remove job-level 'if' condition that caused SKIPPED status
- Add step-level conditionals to skip heavy work when no changes
- Job always reports SUCCESS instead of being skipped
- This fixes required checks staying pending
- Remove job-level 'if' conditions that caused SKIPPED status
- Add step-level conditionals to skip heavy work when no changes
- Jobs always report SUCCESS instead of being skipped
- This fixes required checks staying pending
@nogeenhenk nogeenhenk merged commit e8e4679 into main Mar 30, 2026
20 of 21 checks passed
@nogeenhenk nogeenhenk deleted the chore/ci-path-filtering branch March 30, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants