-
Notifications
You must be signed in to change notification settings - Fork 10
116 lines (99 loc) · 3.35 KB
/
Copy pathci.yml
File metadata and controls
116 lines (99 loc) · 3.35 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
114
115
116
name: CI
permissions:
contents: read
on:
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# The package advertises Python >= 3.12, but CI only ever ran 3.13, so
# 3.12 was supported on paper and never verified. Test both.
python-version: ["3.12", "3.13"]
# Real services. The durable-storage tests (checkpointer transactions,
# optimistic concurrency, Redis/Postgres consistency) cannot prove anything
# against mocks -- they need a real database to run against.
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test_agentflow
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_DSN: postgresql://test:test@localhost:5432/test_agentflow
REDIS_URL: redis://localhost:6379/1
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Cache Python deps
uses: actions/cache@v5
with:
path: |
~/.cache/pip
.venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-pip-
- name: Cache uv
uses: actions/cache@v5
with:
path: |
~/.local/share/uv
~/.cache/uv
key: ${{ runner.os }}-py${{ matrix.python-version }}-uv-${{ hashFiles('.uv/config.json') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-uv-
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# create venv in repo so it can be cached
python -m venv --clear .venv
source .venv/bin/activate
pip install --upgrade pip
uv sync --dev
- name: Run pre-commit
if: matrix.python-version == '3.13'
run: uv run pre-commit run --all-files
- name: Run unit tests with coverage (line + branch gated)
run: |
source .venv/bin/activate
uv run pytest --cov --cov-branch --cov-report=xml
- name: Run integration tests against real Postgres + Redis
run: |
source .venv/bin/activate
# These exercise the durable paths (SQL, transactions, optimistic
# concurrency, tool ledger, cross-user isolation). They are gated behind
# --integration so they never run without the services above.
uv run pytest tests/integration --integration --no-cov
- name: Upload coverage reports to Codecov
if: matrix.python-version == '3.13'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}