TEST-INFRA: [ci-pipeline-design] Implement conditional test execution based on file changes #3743

Open
opened 2026-04-05 22:25:04 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: task/backlog/ci-pipeline-conditional-test-execution-file-changes
  • Commit Message: chore(ci): implement conditional test execution based on changed files
  • Milestone: (none — backlog)
  • Parent Epic: #3204

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Description

The current CI pipeline (.forgejo/workflows/ci.yml) runs the entire test suite (unit, integration, E2E) on every push and pull request, regardless of which files have changed. As the codebase grows, this will lead to increasingly long CI run times, slowing down development velocity.

Proposed Solution

We propose to implement a conditional test execution strategy that only runs tests relevant to the files changed in a pull request or push. This can be achieved by:

  1. Identifying changed files: Using git diff to get a list of changed files between the current commit and the base branch.
  2. Mapping files to tests: Establishing a mapping between source code files and their corresponding test files.
  3. Running only affected tests: Modifying the test execution step to only run the tests that are affected by the changes.

This will significantly reduce the CI run time for most changes, while still ensuring that all relevant tests are run.

Subtasks

  • Choose a strategy for identifying changed files and mapping them to tests.
  • Implement the chosen strategy in the CI workflow.
  • Update the nox sessions for testing to accept a list of test files to run.
  • Verify that the conditional test execution is working correctly and that all relevant tests are being run.

Definition of Done

  • The CI pipeline only runs tests relevant to the changed files.
  • The CI run time is significantly reduced for small changes.
  • The full test suite is still run on a regular basis (e.g., nightly) to catch any regressions.
  • All nox stages pass.
  • Coverage >= 97%

Duplicate Check

  • Search queries: "conditional", "test execution", "file changes", "changed files"
  • Results: Multiple similar issues found in backlog (e.g., #3627, #3399, #3098, #2258). This issue provides a more detailed proposed solution with explicit file-change mapping strategy.
  • Conclusion: Tracked as a distinct issue with enhanced detail; consider consolidating with existing backlog items during human review.

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

## Metadata - **Branch**: `task/backlog/ci-pipeline-conditional-test-execution-file-changes` - **Commit Message**: `chore(ci): implement conditional test execution based on changed files` - **Milestone**: *(none — backlog)* - **Parent Epic**: #3204 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ### Description The current CI pipeline (`.forgejo/workflows/ci.yml`) runs the entire test suite (unit, integration, E2E) on every push and pull request, regardless of which files have changed. As the codebase grows, this will lead to increasingly long CI run times, slowing down development velocity. ### Proposed Solution We propose to implement a conditional test execution strategy that only runs tests relevant to the files changed in a pull request or push. This can be achieved by: 1. **Identifying changed files:** Using `git diff` to get a list of changed files between the current commit and the base branch. 2. **Mapping files to tests:** Establishing a mapping between source code files and their corresponding test files. 3. **Running only affected tests:** Modifying the test execution step to only run the tests that are affected by the changes. This will significantly reduce the CI run time for most changes, while still ensuring that all relevant tests are run. ## Subtasks - [ ] Choose a strategy for identifying changed files and mapping them to tests. - [ ] Implement the chosen strategy in the CI workflow. - [ ] Update the `nox` sessions for testing to accept a list of test files to run. - [ ] Verify that the conditional test execution is working correctly and that all relevant tests are being run. ## Definition of Done - [ ] The CI pipeline only runs tests relevant to the changed files. - [ ] The CI run time is significantly reduced for small changes. - [ ] The full test suite is still run on a regular basis (e.g., nightly) to catch any regressions. - [ ] All nox stages pass. - [ ] Coverage >= 97% ### Duplicate Check - **Search queries:** "conditional", "test execution", "file changes", "changed files" - **Results:** Multiple similar issues found in backlog (e.g., #3627, #3399, #3098, #2258). This issue provides a more detailed proposed solution with explicit file-change mapping strategy. - **Conclusion:** Tracked as a distinct issue with enhanced detail; consider consolidating with existing backlog items during human review. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
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#3743
No description provided.