Commit 4b70d1c
Optimize CI: caching, uv, parallel jobs, docs-only skip (#12886)
## Summary
Overhaul the CircleCI pipeline to reduce wall time and save resources.
### Pipeline architecture
```
Stage 1 (parallel): checks ──────────┐
tests ───────────┼──▶ Stage 2 (parallel): tests-search
tests-proxito ───┘ tests-embedapi
│
Stage 3: coverage-report ◀┘
```
- **Stage 1** runs the fast, lightweight jobs in parallel:
linting/migration checks, core tests (no ES), and proxito tests
- **Stage 2** runs the heavier jobs only after Stage 1 passes: search
tests (needs Elasticsearch sidecar) and embed API tests (6 Sphinx
versions) — avoiding wasted resources on broken builds
- **Stage 3** combines coverage from all test jobs (`coverage combine`)
and uploads a single unified report to codecov
### Test marker coverage
Every test runs in exactly one job — no gaps, no duplicates:
| Marker(s) | Job | Django settings |
|---|---|---|
| _(unmarked)_ | `tests` | `readthedocs.settings.test` |
| `search` only | `tests-search` (1st cmd) | `readthedocs.settings.test`
|
| `search` + `proxito` | `tests-search` (2nd cmd) |
`readthedocs.settings.proxito.test` |
| `proxito` only | `tests-proxito` | `readthedocs.settings.proxito.test`
|
| `embed_api` | `tests-embedapi` | `readthedocs.settings.test` |
Notable dual-marked tests handled by `tests-search` with proxito
settings:
- `search/tests/test_proxied_api.py` (search + proxito)
- `search/tests/test_utils.py` (search + proxito)
- `search/api/v3/tests/test_api.py:ProxiedSearchAPITest` (inherits
search, marked proxito)
### Changes
- **Split test suite into parallel jobs**: the single `tests` job
previously ran core, proxito, and search tests serially (~18 min). Now
they're 3 independent jobs
- `tests` — core tests only (no Elasticsearch sidecar needed)
- `tests-proxito` — proxito tests with separate Django settings
- `tests-search` — search tests with Elasticsearch (Stage 2)
- **Combined coverage reporting**: each test job writes to a unique
`COVERAGE_FILE`, persists it via CircleCI workspace, and a final
`coverage-report` job combines them and uploads a single report to
codecov
- **Dependency caching**: pip and tox environments cached across runs,
keyed on all `requirements/*.txt` files
- **`tox-uv` for faster installs**: `tox-uv` plugin uses `uv` for
virtualenv creation and dependency resolution inside tox (tox 4+ jobs)
- **Docs-only skip**: `skip-if-docs-only` command halts test jobs when
only `docs/` files changed (PR branches only, compares against
`origin/main`)
- **DRY shared commands**: `setup-checkout` and `skip-if-docs-only`
reusable commands eliminate duplication
### Expected impact
- **Wall time**: ~26 min → ~15 min (parallel jobs, caching)
- **Docs-only PRs**: skip all test jobs entirely (~30s per job vs ~10+
min)
- **Resource savings**: Elasticsearch only starts for search tests, not
all tests
## Test plan
- [x] All CircleCI jobs pass (checks, tests, tests-proxito,
tests-search, tests-embedapi)
- [x] Docs-only PR (#12896) confirms test jobs halt early with success
- [ ] Verify coverage-report job combines and uploads correctly
- [ ] Verify caching works on subsequent pushes (cache hit in
restore_cache step)
https://claude.ai/code/session_01PrHk6hpFk9eDTaNujKYLon
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Santos Gallegos <stsewd@proton.me>1 parent 4d95ad1 commit 4b70d1c
File tree
6 files changed
+273
-100
lines changed- .circleci
- docs/dev
- requirements
6 files changed
+273
-100
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
1 | 37 | | |
2 | 38 | | |
3 | 39 | | |
4 | 40 | | |
5 | 41 | | |
6 | 42 | | |
7 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
8 | 54 | | |
9 | 55 | | |
10 | 56 | | |
| |||
19 | 65 | | |
20 | 66 | | |
21 | 67 | | |
22 | | - | |
23 | | - | |
| 68 | + | |
24 | 69 | | |
25 | 70 | | |
| 71 | + | |
26 | 72 | | |
27 | 73 | | |
28 | 74 | | |
| |||
31 | 77 | | |
32 | 78 | | |
33 | 79 | | |
| 80 | + | |
| 81 | + | |
34 | 82 | | |
35 | 83 | | |
36 | 84 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
40 | 116 | | |
41 | 117 | | |
42 | 118 | | |
43 | 119 | | |
44 | 120 | | |
45 | 121 | | |
46 | | - | |
47 | 122 | | |
48 | 123 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 124 | + | |
52 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
53 | 129 | | |
54 | 130 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
58 | 171 | | |
59 | 172 | | |
| 173 | + | |
| 174 | + | |
60 | 175 | | |
61 | 176 | | |
62 | 177 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 178 | + | |
66 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
67 | 183 | | |
68 | 184 | | |
69 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
70 | 192 | | |
71 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
72 | 196 | | |
73 | 197 | | |
74 | 198 | | |
75 | 199 | | |
76 | | - | |
77 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
78 | 216 | | |
79 | 217 | | |
80 | | - | |
| 218 | + | |
81 | 219 | | |
82 | 220 | | |
83 | 221 | | |
84 | | - | |
| 222 | + | |
85 | 223 | | |
86 | 224 | | |
87 | 225 | | |
88 | | - | |
| 226 | + | |
89 | 227 | | |
90 | 228 | | |
91 | 229 | | |
| |||
97 | 235 | | |
98 | 236 | | |
99 | 237 | | |
| 238 | + | |
100 | 239 | | |
101 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
102 | 247 | | |
103 | 248 | | |
104 | | - | |
105 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments