Implement conditional test execution in CI pipeline #2459

Open
opened 2026-04-03 18:28:58 +00:00 by freemo · 1 comment
Owner

Metadata

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

Background and Context

The CI pipeline currently runs all tests on every pull request, regardless of which parts of the codebase have changed. This is inefficient and leads to unnecessarily long CI run times, especially for pull requests that only touch a small, isolated area of the codebase. Reducing unnecessary test execution is a key part of the broader CI execution time optimization effort tracked in Epic #1678.

Expected Behavior

The ci.yml workflow should detect which parts of the codebase have changed in a given pull request and only run the test jobs relevant to those changed paths. Pull requests that touch only a small portion of the codebase should see meaningfully reduced CI run times.

Acceptance Criteria

  • A path-change detection mechanism is implemented in .forgejo/workflows/ci.yml (e.g., using a paths filter or a dedicated job that outputs change flags).
  • Each test job in the workflow conditionally executes only when its relevant paths have changed.
  • Pull requests that change only unrelated parts of the codebase skip unaffected test jobs.
  • The CI pipeline continues to run all tests when changes affect shared/core paths.
  • All existing CI quality gates (lint, typecheck, coverage ≥ 97%) remain enforced.

Supporting Information

  • Parent Epic: #1678 — CI Execution Time Optimization
  • Relevant file: .forgejo/workflows/ci.yml
  • Related: Forgejo/GitHub Actions paths and paths-ignore filters, and job-level if: conditionals with path-change outputs.

Subtasks

  • Audit .forgejo/workflows/ci.yml to identify all test jobs and their relevant source paths
  • Implement a path-change detection step or job (e.g., using dorny/paths-filter or native paths: triggers) to produce per-area change flags
  • Update each test job with an if: conditional that gates execution on the relevant change flag
  • Ensure shared/core path changes trigger all test jobs as a safety net
  • Update features/ci_workflow_validation.feature to assert conditional execution logic is present
  • Run nox (all default sessions) and fix any errors
  • Verify coverage ≥ 97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • .forgejo/workflows/ci.yml uses path-based conditional logic to skip test jobs unaffected by a given PR's changes.
  • features/ci_workflow_validation.feature is updated to cover the new conditional execution steps.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • 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**: `chore/ci-conditional-test-execution` - **Commit Message**: `chore(ci): implement conditional test execution based on changed paths` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Background and Context The CI pipeline currently runs all tests on every pull request, regardless of which parts of the codebase have changed. This is inefficient and leads to unnecessarily long CI run times, especially for pull requests that only touch a small, isolated area of the codebase. Reducing unnecessary test execution is a key part of the broader CI execution time optimization effort tracked in Epic #1678. ## Expected Behavior The `ci.yml` workflow should detect which parts of the codebase have changed in a given pull request and only run the test jobs relevant to those changed paths. Pull requests that touch only a small portion of the codebase should see meaningfully reduced CI run times. ## Acceptance Criteria - A path-change detection mechanism is implemented in `.forgejo/workflows/ci.yml` (e.g., using a `paths` filter or a dedicated job that outputs change flags). - Each test job in the workflow conditionally executes only when its relevant paths have changed. - Pull requests that change only unrelated parts of the codebase skip unaffected test jobs. - The CI pipeline continues to run all tests when changes affect shared/core paths. - All existing CI quality gates (lint, typecheck, coverage ≥ 97%) remain enforced. ## Supporting Information - Parent Epic: #1678 — CI Execution Time Optimization - Relevant file: `.forgejo/workflows/ci.yml` - Related: Forgejo/GitHub Actions `paths` and `paths-ignore` filters, and job-level `if:` conditionals with path-change outputs. ## Subtasks - [ ] Audit `.forgejo/workflows/ci.yml` to identify all test jobs and their relevant source paths - [ ] Implement a path-change detection step or job (e.g., using `dorny/paths-filter` or native `paths:` triggers) to produce per-area change flags - [ ] Update each test job with an `if:` conditional that gates execution on the relevant change flag - [ ] Ensure shared/core path changes trigger all test jobs as a safety net - [ ] Update `features/ci_workflow_validation.feature` to assert conditional execution logic is present - [ ] Run `nox` (all default sessions) and fix any errors - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - [ ] All subtasks above are completed and checked off. - [ ] `.forgejo/workflows/ci.yml` uses path-based conditional logic to skip test jobs unaffected by a given PR's changes. - [ ] `features/ci_workflow_validation.feature` is updated to cover the new conditional execution steps. - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - [ ] The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - [ ] 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-03 18:29:03 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Could Have — Desirable improvement but not necessary for the milestone. Include only if time permits.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Could Have — Desirable improvement but not necessary for the milestone. Include only if time permits. --- **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#2459
No description provided.