-
-
Notifications
You must be signed in to change notification settings - Fork 50
113 lines (97 loc) · 3.05 KB
/
Copy pathtests.yaml
File metadata and controls
113 lines (97 loc) · 3.05 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
name: Tests & Coverage
on:
push:
branches: ["**"]
paths:
- "**.py"
- "pyproject.toml"
- "uv.lock"
- "requirements.txt"
- ".github/workflows/tests.yaml"
# No paths or base filter on PRs: these checks are required by branch
# protection and a workflow that never reports leaves a PR stuck at
# "Expected" forever. Stacked PRs target feature branches, so filtering
# on main made every stack permanently unmergeable.
pull_request:
branches: ["**"]
workflow_dispatch:
permissions:
contents: read
jobs:
spec-drift:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync --group dev
- name: Regenerate openapi.json and diff against the committed file
run: |
make openapi
git diff --exit-code openapi.json || {
echo "::error::openapi.json is stale — run 'make openapi' and commit the result."
exit 1
}
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
# Real MongoDB for tests/db — that suite fails loudly (never skips)
# when CI is set, so this container is load-bearing.
services:
mongo:
image: mongo:8
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --quiet --eval 'db.runCommand({ping: 1})'"
--health-interval 5s
--health-timeout 5s
--health-retries 12
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync --group dev
- name: Run tests with coverage
env:
MONGODB_URI: "mongodb://localhost:27017/"
MONGO_TEST_URI: "mongodb://localhost:27017/?directConnection=true"
run: |
uv run python -m pytest \
-n auto \
--cov=. \
--cov-report=term-missing:skip-covered \
--cov-report=xml:coverage.xml \
--cov-config=pyproject.toml \
--junitxml=junit.xml \
-q
- name: Upload coverage to Codecov
if: matrix.python-version == '3.14' && github.event_name != 'pull_request'
uses: codecov/codecov-action@v7
with:
files: coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-py${{ matrix.python-version }}
path: |
junit.xml
coverage.xml
retention-days: 30