TEST-INFRA: [ci-execution-time] Cache nox virtual environments in CI #2248

Open
opened 2026-04-03 10:59:50 +00:00 by freemo · 1 comment
Owner

Summary

The current CI pipeline in .forgejo/workflows/ci.yml effectively caches the uv package cache, which significantly speeds up dependency installation. However, it does not cache the nox virtual environments themselves (the .nox directory).

Each CI job that runs nox has to create a new virtual environment and install the dependencies from the uv cache. While this is fast, we could potentially save a few seconds on each job by caching and restoring the entire .nox directory.

Proposal

I propose to add another cache step to the CI workflow that caches the .nox directory.

Example Implementation

- name: Cache nox virtual environments
  uses: actions/cache@v3
  with:
    path: .nox
    key: nox-${{ hashFiles('pyproject.toml', 'noxfile.py') }}
    restore-keys: |
      nox-

This would be in addition to the existing uv cache.

Trade-offs

  • Pros:
    • Faster CI jobs, as nox would not need to create and populate the virtual environments from scratch.
  • Cons:
    • The .nox directory can be large, which would increase the cache size.
    • There is a small risk of cache corruption, which could lead to flaky builds.

This is a low-priority suggestion, as the current CI pipeline is already quite fast. However, it's worth considering as a potential micro-optimization.


Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-test-infra-improver

## Summary The current CI pipeline in `.forgejo/workflows/ci.yml` effectively caches the `uv` package cache, which significantly speeds up dependency installation. However, it does not cache the nox virtual environments themselves (the `.nox` directory). Each CI job that runs nox has to create a new virtual environment and install the dependencies from the `uv` cache. While this is fast, we could potentially save a few seconds on each job by caching and restoring the entire `.nox` directory. ## Proposal I propose to add another cache step to the CI workflow that caches the `.nox` directory. ### Example Implementation ```yaml - name: Cache nox virtual environments uses: actions/cache@v3 with: path: .nox key: nox-${{ hashFiles('pyproject.toml', 'noxfile.py') }} restore-keys: | nox- ``` This would be in addition to the existing `uv` cache. ## Trade-offs * **Pros:** * Faster CI jobs, as nox would not need to create and populate the virtual environments from scratch. * **Cons:** * The `.nox` directory can be large, which would increase the cache size. * There is a small risk of cache corruption, which could lead to flaky builds. This is a low-priority suggestion, as the current CI pipeline is already quite fast. However, it's worth considering as a potential micro-optimization. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-test-infra-improver
Author
Owner

I was unable to add the following labels to this issue due to API limitations:

  • State/Unverified
  • Type/Task
  • Priority/Low

Could a human please add them?


Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-test-infra-improver

I was unable to add the following labels to this issue due to API limitations: - `State/Unverified` - `Type/Task` - `Priority/Low` Could a human please add them? --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-test-infra-improver
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.

Dependencies

No dependencies set.

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