Cache nox virtual environments in CI to reduce setup time #1946

Open
opened 2026-04-03 00:20:12 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: task/cache-nox-virtual-environments
  • Commit Message: perf(ci): cache nox virtual environments to reduce CI setup time
  • Milestone: v3.8.0
  • Parent Epic: #1678

Overview

Each CI run currently recreates all nox virtual environments from scratch, adding significant wall-clock time before any test or lint work begins. By caching the .nox/ directory (keyed on the relevant dependency lock files and noxfile.py), subsequent runs can skip environment creation entirely when dependencies have not changed.

This is a targeted performance improvement that complements the broader CI execution time optimisations tracked in Epic #1678.

Subtasks

  • Add a cache step to .forgejo/workflows/ci.yml that saves and restores the .nox/ directory
  • Key the cache on a hash of pyproject.toml, uv.lock (or equivalent lock file), and noxfile.py so it is invalidated whenever dependencies change
  • Verify that all nox sessions (lint, typecheck, unit_tests, integration_tests, coverage_report, build) still pass correctly when the cache is restored
  • Update features/ci_workflow_validation.feature to assert the cache step is present in the workflow
  • Confirm coverage ≥ 97%

Definition of Done

  • .forgejo/workflows/ci.yml includes a cache action step that saves/restores .nox/
  • Cache key incorporates hashes of pyproject.toml, lock file(s), and noxfile.py
  • A cache hit on a clean run skips virtual-environment creation for all nox sessions
  • features/ci_workflow_validation.feature is updated to cover the new cache step
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `task/cache-nox-virtual-environments` - **Commit Message**: `perf(ci): cache nox virtual environments to reduce CI setup time` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Overview Each CI run currently recreates all nox virtual environments from scratch, adding significant wall-clock time before any test or lint work begins. By caching the `.nox/` directory (keyed on the relevant dependency lock files and `noxfile.py`), subsequent runs can skip environment creation entirely when dependencies have not changed. This is a targeted performance improvement that complements the broader CI execution time optimisations tracked in Epic #1678. ## Subtasks - [ ] Add a `cache` step to `.forgejo/workflows/ci.yml` that saves and restores the `.nox/` directory - [ ] Key the cache on a hash of `pyproject.toml`, `uv.lock` (or equivalent lock file), and `noxfile.py` so it is invalidated whenever dependencies change - [ ] Verify that all nox sessions (`lint`, `typecheck`, `unit_tests`, `integration_tests`, `coverage_report`, `build`) still pass correctly when the cache is restored - [ ] Update `features/ci_workflow_validation.feature` to assert the cache step is present in the workflow - [ ] Confirm coverage ≥ 97% ## Definition of Done - [ ] `.forgejo/workflows/ci.yml` includes a `cache` action step that saves/restores `.nox/` - [ ] Cache key incorporates hashes of `pyproject.toml`, lock file(s), and `noxfile.py` - [ ] A cache hit on a clean run skips virtual-environment creation for all nox sessions - [ ] `features/ci_workflow_validation.feature` is updated to cover the new cache step - [ ] 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-03 00:20:28 +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#1946
No description provided.