CI Pipeline: Implement conditional test execution #1758

Open
opened 2026-04-02 23:44:10 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: feature/ci-conditional-test-execution
  • Commit Message: feat(ci): implement conditional test execution based on changed files
  • Milestone: v3.8.0
  • Parent Epic: #1678

Background and Context

The current CI pipeline runs the full test suite on every commit, regardless of which files were changed. For a growing project, this results in unnecessary CI execution time and wastes shared runner capacity. For example, a commit that only modifies documentation files should not trigger unit and integration test runs.

Implementing a mechanism to conditionally execute tests based on the set of changed files would significantly reduce CI wall-clock time and improve developer feedback loops.

Expected Behavior

The CI pipeline should detect which files have changed in a given commit or PR and selectively skip test jobs (unit, integration) when the changed files do not include any source code or test files. Documentation-only, configuration-only, or other non-code changes should bypass test execution entirely.

Acceptance Criteria

  • When only documentation files are changed, unit and integration test jobs are skipped.
  • When source code or test files are changed, all relevant test jobs run as normal.
  • The conditional logic is reliable and does not skip tests that should be run.
  • The overall CI execution time is measurably reduced for non-code changes.
  • The CI pipeline remains stable and does not introduce false negatives (i.e., tests are never incorrectly skipped when code changes are present).

Supporting Information

  • Parent Epic: #1678 — CI Execution Time Optimization — Timeouts, Concurrency, and Coverage Artifact Sharing
  • Forgejo Actions supports paths and paths-ignore filters on workflow triggers, as well as job-level if: conditions using github.event.commits or path-filter actions.
  • A path-filter step (e.g., using dorny/paths-filter or a native shell script) can output boolean flags consumed by downstream jobs via needs.<job>.outputs.

Subtasks

  • Investigate available methods for detecting changed files in Forgejo Actions (native paths/paths-ignore filters vs. explicit path-filter step)
  • Define the file path patterns that constitute "code changes" (source, tests, CI config) vs. "non-code changes" (docs, assets, changelogs)
  • Implement a changes detection job or step in .forgejo/workflows/ci.yml that outputs boolean flags per category
  • Add if: conditions to unit_tests and integration_tests jobs to skip when no code changes are detected
  • Ensure coverage and build jobs also respect the conditional flags appropriately
  • Update features/ci_workflow_validation.feature to assert conditional execution behaviour is present and correct
  • Tests (Robot/BDD): Add integration scenarios verifying that doc-only commits skip test jobs
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions) and fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • .forgejo/workflows/ci.yml contains a path-detection mechanism that conditionally skips test jobs for non-code changes.
  • features/ci_workflow_validation.feature is updated to cover conditional execution scenarios.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (feat(ci): implement conditional test execution based on changed files), followed by a blank line, then additional lines providing relevant implementation details.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (feature/ci-conditional-test-execution).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `feature/ci-conditional-test-execution` - **Commit Message**: `feat(ci): implement conditional test execution based on changed files` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Background and Context The current CI pipeline runs the full test suite on every commit, regardless of which files were changed. For a growing project, this results in unnecessary CI execution time and wastes shared runner capacity. For example, a commit that only modifies documentation files should not trigger unit and integration test runs. Implementing a mechanism to conditionally execute tests based on the set of changed files would significantly reduce CI wall-clock time and improve developer feedback loops. ## Expected Behavior The CI pipeline should detect which files have changed in a given commit or PR and selectively skip test jobs (unit, integration) when the changed files do not include any source code or test files. Documentation-only, configuration-only, or other non-code changes should bypass test execution entirely. ## Acceptance Criteria - When only documentation files are changed, unit and integration test jobs are skipped. - When source code or test files are changed, all relevant test jobs run as normal. - The conditional logic is reliable and does not skip tests that should be run. - The overall CI execution time is measurably reduced for non-code changes. - The CI pipeline remains stable and does not introduce false negatives (i.e., tests are never incorrectly skipped when code changes are present). ## Supporting Information - Parent Epic: #1678 — CI Execution Time Optimization — Timeouts, Concurrency, and Coverage Artifact Sharing - Forgejo Actions supports `paths` and `paths-ignore` filters on workflow triggers, as well as job-level `if:` conditions using `github.event.commits` or path-filter actions. - A path-filter step (e.g., using `dorny/paths-filter` or a native shell script) can output boolean flags consumed by downstream jobs via `needs.<job>.outputs`. ## Subtasks - [ ] Investigate available methods for detecting changed files in Forgejo Actions (native `paths`/`paths-ignore` filters vs. explicit path-filter step) - [ ] Define the file path patterns that constitute "code changes" (source, tests, CI config) vs. "non-code changes" (docs, assets, changelogs) - [ ] Implement a `changes` detection job or step in `.forgejo/workflows/ci.yml` that outputs boolean flags per category - [ ] Add `if:` conditions to `unit_tests` and `integration_tests` jobs to skip when no code changes are detected - [ ] Ensure `coverage` and `build` jobs also respect the conditional flags appropriately - [ ] Update `features/ci_workflow_validation.feature` to assert conditional execution behaviour is present and correct - [ ] Tests (Robot/BDD): Add integration scenarios verifying that doc-only commits skip test jobs - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions) and fix any errors ## Definition of Done This issue is complete when: - [ ] All subtasks above are completed and checked off. - [ ] `.forgejo/workflows/ci.yml` contains a path-detection mechanism that conditionally skips test jobs for non-code changes. - [ ] `features/ci_workflow_validation.feature` is updated to cover conditional execution scenarios. - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`feat(ci): implement conditional test execution based on changed files`), followed by a blank line, then additional lines providing relevant implementation details. - [ ] The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`feature/ci-conditional-test-execution`). - [ ] The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - [ ] All nox stages pass. - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-02 23:44:36 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Could Have — CI/test infrastructure improvement.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Could Have — CI/test infrastructure improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#1758
No description provided.