Skip to content

Commit 0a3f3f0

Browse files
phernandezclaude
andcommitted
fix: run coverage instead of tests on 3.12/ubuntu, not in addition to
Previous commit still ran tests twice on the coverage matrix entry. Now the 3.12/ubuntu/main combo runs with coverage directly, and all other matrix entries run without. No duplicate work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 184ea6d commit 0a3f3f0

1 file changed

Lines changed: 46 additions & 32 deletions

File tree

.github/workflows/test.yml

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
include:
6060
- os: ubuntu-latest
6161
python-version: "3.12"
62+
coverage: true
6263
- os: ubuntu-latest
6364
python-version: "3.13"
6465
- os: ubuntu-latest
@@ -92,18 +93,18 @@ jobs:
9293
run: |
9394
uv pip install -e ".[dev]"
9495
95-
- name: Run tests (SQLite Unit)
96+
- name: Run tests with coverage
97+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
9698
run: |
97-
just test-unit-sqlite
99+
BASIC_MEMORY_ENV=test uv run coverage run --data-file=.coverage.sqlite-unit --source=basic_memory -m pytest -p pytest_mock -v --no-cov tests
98100
99-
# Collect coverage data on the Python 3.12 ubuntu run for the coverage summary job
100-
- name: Run tests with coverage (SQLite Unit)
101-
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/main'
101+
- name: Run tests
102+
if: "!(matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main')"
102103
run: |
103-
BASIC_MEMORY_ENV=test uv run coverage run --data-file=.coverage.sqlite-unit --source=basic_memory -m pytest -p pytest_mock -v --no-cov tests
104+
just test-unit-sqlite
104105
105106
- name: Upload coverage data
106-
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/main'
107+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
107108
uses: actions/upload-artifact@v4
108109
with:
109110
name: coverage-sqlite-unit
@@ -120,6 +121,7 @@ jobs:
120121
include:
121122
- os: ubuntu-latest
122123
python-version: "3.12"
124+
coverage: true
123125
- os: ubuntu-latest
124126
python-version: "3.13"
125127
- os: ubuntu-latest
@@ -153,17 +155,18 @@ jobs:
153155
run: |
154156
uv pip install -e ".[dev]"
155157
156-
- name: Run tests (SQLite Integration)
158+
- name: Run tests with coverage
159+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
157160
run: |
158-
just test-int-sqlite
161+
BASIC_MEMORY_ENV=test uv run coverage run --data-file=.coverage.sqlite-int --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m "not semantic" test-int
159162
160-
- name: Run tests with coverage (SQLite Integration)
161-
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/main'
163+
- name: Run tests
164+
if: "!(matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main')"
162165
run: |
163-
BASIC_MEMORY_ENV=test uv run coverage run --data-file=.coverage.sqlite-int --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m "not semantic" test-int
166+
just test-int-sqlite
164167
165168
- name: Upload coverage data
166-
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/main'
169+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
167170
uses: actions/upload-artifact@v4
168171
with:
169172
name: coverage-sqlite-int
@@ -177,7 +180,11 @@ jobs:
177180
strategy:
178181
fail-fast: false
179182
matrix:
180-
python-version: [ "3.12", "3.13", "3.14" ]
183+
include:
184+
- python-version: "3.12"
185+
coverage: true
186+
- python-version: "3.13"
187+
- python-version: "3.14"
181188
runs-on: ubuntu-latest
182189

183190
# Note: No services section needed - testcontainers handles Postgres in Docker
@@ -207,17 +214,18 @@ jobs:
207214
run: |
208215
uv pip install -e ".[dev]"
209216
210-
- name: Run tests (Postgres Unit)
217+
- name: Run tests with coverage
218+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
211219
run: |
212-
just test-unit-postgres
220+
timeout --signal=KILL 600 bash -c 'BASIC_MEMORY_ENV=test BASIC_MEMORY_TEST_POSTGRES=1 uv run coverage run --data-file=.coverage.postgres-unit --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m postgres tests' || test $? -eq 137
213221
214-
- name: Run tests with coverage (Postgres Unit)
215-
if: matrix.python-version == '3.12' && github.event_name == 'push' && github.ref == 'refs/heads/main'
222+
- name: Run tests
223+
if: "!(matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main')"
216224
run: |
217-
timeout --signal=KILL 600 bash -c 'BASIC_MEMORY_ENV=test BASIC_MEMORY_TEST_POSTGRES=1 uv run coverage run --data-file=.coverage.postgres-unit --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m postgres tests' || test $? -eq 137
225+
just test-unit-postgres
218226
219227
- name: Upload coverage data
220-
if: matrix.python-version == '3.12' && github.event_name == 'push' && github.ref == 'refs/heads/main'
228+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
221229
uses: actions/upload-artifact@v4
222230
with:
223231
name: coverage-postgres-unit
@@ -232,7 +240,11 @@ jobs:
232240
strategy:
233241
fail-fast: false
234242
matrix:
235-
python-version: [ "3.12", "3.13", "3.14" ]
243+
include:
244+
- python-version: "3.12"
245+
coverage: true
246+
- python-version: "3.13"
247+
- python-version: "3.14"
236248
runs-on: ubuntu-latest
237249

238250
# Note: No services section needed - testcontainers handles Postgres in Docker
@@ -262,17 +274,18 @@ jobs:
262274
run: |
263275
uv pip install -e ".[dev]"
264276
265-
- name: Run tests (Postgres Integration)
277+
- name: Run tests with coverage
278+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
266279
run: |
267-
just test-int-postgres
280+
timeout --signal=KILL 600 bash -c 'BASIC_MEMORY_ENV=test BASIC_MEMORY_TEST_POSTGRES=1 uv run coverage run --data-file=.coverage.postgres-int --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m postgres test-int' || test $? -eq 137
268281
269-
- name: Run tests with coverage (Postgres Integration)
270-
if: matrix.python-version == '3.12' && github.event_name == 'push' && github.ref == 'refs/heads/main'
282+
- name: Run tests
283+
if: "!(matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main')"
271284
run: |
272-
timeout --signal=KILL 600 bash -c 'BASIC_MEMORY_ENV=test BASIC_MEMORY_TEST_POSTGRES=1 uv run coverage run --data-file=.coverage.postgres-int --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m postgres test-int' || test $? -eq 137
285+
just test-int-postgres
273286
274287
- name: Upload coverage data
275-
if: matrix.python-version == '3.12' && github.event_name == 'push' && github.ref == 'refs/heads/main'
288+
if: matrix.coverage && github.event_name == 'push' && github.ref == 'refs/heads/main'
276289
uses: actions/upload-artifact@v4
277290
with:
278291
name: coverage-postgres-int
@@ -311,15 +324,16 @@ jobs:
311324
run: |
312325
uv pip install -e ".[dev]"
313326
314-
- name: Run tests (Semantic)
315-
run: |
316-
just test-semantic
317-
318-
- name: Run tests with coverage (Semantic)
327+
- name: Run tests with coverage
319328
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
320329
run: |
321330
BASIC_MEMORY_ENV=test uv run coverage run --data-file=.coverage.semantic --source=basic_memory -m pytest -p pytest_mock -v --no-cov -m semantic test-int/semantic/
322331
332+
- name: Run tests
333+
if: "!(github.event_name == 'push' && github.ref == 'refs/heads/main')"
334+
run: |
335+
just test-semantic
336+
323337
- name: Upload coverage data
324338
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
325339
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)