TEST-INFRA: [ci-execution-time] Cache test artifacts to avoid re-running tests in coverage job #1845

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

Background and Context

The CI pipeline's coverage job currently re-executes the full test suite by calling nox -s coverage_report. The unit_tests job already runs the same tests and produces a .coverage data file. This duplication wastes CI runner time and increases overall pipeline wall-clock time unnecessarily.

By uploading the .coverage artifact from the unit_tests job and downloading it in the coverage job, the coverage report can be generated from already-collected data — eliminating the redundant test run entirely.

This issue implements subtask #child-3 of Epic #1678.

Current Behavior

  • The unit_tests job runs all unit tests and produces a .coverage file locally, but discards it.
  • The coverage job independently calls nox -s coverage_report, which re-runs the full test suite from scratch before generating the HTML/XML report.
  • This results in the test suite being executed twice per CI run, doubling runner time for test execution.

Expected Behavior

  • The unit_tests job uploads the .coverage data file as a CI artifact after tests complete.
  • The coverage job downloads the .coverage artifact and runs only the report-generation step (e.g., coverage report, coverage html, coverage xml) without re-running tests.
  • The features/ci_workflow_validation.feature BDD tests are updated to assert that the artifact upload/download steps are present in the workflow.

Acceptance Criteria

  • .forgejo/workflows/ci.yml unit_tests job includes an upload-artifact step that saves .coverage
  • .forgejo/workflows/ci.yml coverage job includes a download-artifact step before report generation
  • The coverage job no longer re-runs the test suite (no pytest or nox -s unit_tests invocation)
  • features/ci_workflow_validation.feature asserts the upload and download artifact steps exist
  • All nox stages pass
  • Coverage ≥ 97%

Supporting Information

  • Parent Epic: #1678 — CI Execution Time Optimization — Timeouts, Concurrency, and Coverage Artifact Sharing
  • Related: #1783 — Optimize CI / integration_tests (push)
  • Related: #1786 — Parallelize e2e_tests
  • Related: #1788 — Create a custom Docker image for CI jobs

Metadata

  • Branch: feature/m9-cache-test-artifacts
  • Commit Message: feat(ci): upload .coverage artifact from unit_tests and download in coverage job
  • Milestone: v3.8.0
  • Parent Epic: #1678

Subtasks

  • Add upload-artifact step to unit_tests job in .forgejo/workflows/ci.yml
  • Add download-artifact step to coverage job in .forgejo/workflows/ci.yml
  • Remove redundant test re-execution from coverage job (update nox session or CI step)
  • Update features/ci_workflow_validation.feature to assert artifact upload/download steps
  • Run full nox suite locally to verify no regressions
  • Confirm coverage ≥ 97%

Definition of Done

  • unit_tests job uploads .coverage as a named artifact
  • coverage job downloads the .coverage artifact and generates the report without re-running tests
  • BDD feature file updated to cover the new artifact steps
  • All nox stages pass
  • Coverage ≥ 97%

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

## Background and Context The CI pipeline's `coverage` job currently re-executes the full test suite by calling `nox -s coverage_report`. The `unit_tests` job already runs the same tests and produces a `.coverage` data file. This duplication wastes CI runner time and increases overall pipeline wall-clock time unnecessarily. By uploading the `.coverage` artifact from the `unit_tests` job and downloading it in the `coverage` job, the coverage report can be generated from already-collected data — eliminating the redundant test run entirely. This issue implements subtask #child-3 of Epic #1678. ## Current Behavior - The `unit_tests` job runs all unit tests and produces a `.coverage` file locally, but discards it. - The `coverage` job independently calls `nox -s coverage_report`, which re-runs the full test suite from scratch before generating the HTML/XML report. - This results in the test suite being executed **twice** per CI run, doubling runner time for test execution. ## Expected Behavior - The `unit_tests` job uploads the `.coverage` data file as a CI artifact after tests complete. - The `coverage` job downloads the `.coverage` artifact and runs only the report-generation step (e.g., `coverage report`, `coverage html`, `coverage xml`) without re-running tests. - The `features/ci_workflow_validation.feature` BDD tests are updated to assert that the artifact upload/download steps are present in the workflow. ## Acceptance Criteria - [ ] `.forgejo/workflows/ci.yml` `unit_tests` job includes an `upload-artifact` step that saves `.coverage` - [ ] `.forgejo/workflows/ci.yml` `coverage` job includes a `download-artifact` step before report generation - [ ] The `coverage` job no longer re-runs the test suite (no `pytest` or `nox -s unit_tests` invocation) - [ ] `features/ci_workflow_validation.feature` asserts the upload and download artifact steps exist - [ ] All nox stages pass - [ ] Coverage ≥ 97% ## Supporting Information - Parent Epic: #1678 — CI Execution Time Optimization — Timeouts, Concurrency, and Coverage Artifact Sharing - Related: #1783 — Optimize `CI / integration_tests (push)` - Related: #1786 — Parallelize e2e_tests - Related: #1788 — Create a custom Docker image for CI jobs ## Metadata - **Branch**: `feature/m9-cache-test-artifacts` - **Commit Message**: `feat(ci): upload .coverage artifact from unit_tests and download in coverage job` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Subtasks - [ ] Add `upload-artifact` step to `unit_tests` job in `.forgejo/workflows/ci.yml` - [ ] Add `download-artifact` step to `coverage` job in `.forgejo/workflows/ci.yml` - [ ] Remove redundant test re-execution from `coverage` job (update nox session or CI step) - [ ] Update `features/ci_workflow_validation.feature` to assert artifact upload/download steps - [ ] Run full nox suite locally to verify no regressions - [ ] Confirm coverage ≥ 97% ## Definition of Done - [ ] `unit_tests` job uploads `.coverage` as a named artifact - [ ] `coverage` job downloads the `.coverage` artifact and generates the report without re-running tests - [ ] BDD feature file updated to cover the new artifact steps - [ ] All nox stages pass - [ ] Coverage ≥ 97% --- **Automated by CleverAgents Bot** Supervisor: Unknown | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-02 23:57:46 +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#1845
No description provided.