Repository navigation
138 lines (121 loc) · 3.77 KB
/
Copy pathci.yml
File metadata and controls
138 lines (121 loc) · 3.77 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run Ruff check
run: ruff check .
- name: Run Ruff format check
run: ruff format --check .
- name: Run Mypy
run: mypy agentkit tests
test:
name: Test Hermetic (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: [lint]
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
env:
ENVIRONMENT: test
DATABASE_URL: postgresql+asyncpg://agentkit:agentkit_password@localhost:5432/agentkit_test
REDIS_URL: redis://localhost:6379/0
GEMINI_API_KEY: fake_gemini_key_for_testing
OPENAI_API_KEY: fake_openai_key_for_testing
SEARCH_API_KEY: fake_search_key_for_testing
API_KEYS: test_api_key_1,test_api_key_2
PYTHONPATH: .
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run pytest with coverage
run: |
pytest -v --cov=agentkit --cov-report=term-missing --cov-report=xml --cov-fail-under=85
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.12'
with:
name: coverage-report
path: coverage.xml
test-real-infra:
name: Test Against Live PostgreSQL and Redis
runs-on: ubuntu-latest
needs: [lint]
# Serialises this suite because every run truncates shared service containers.
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: agentkit
POSTGRES_PASSWORD: agentkit_password
POSTGRES_DB: agentkit_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
ENVIRONMENT: test
AGENTKIT_REAL_INFRA: "1"
DATABASE_TEST_URL: postgresql+asyncpg://agentkit:agentkit_password@localhost:5432/agentkit_test
REDIS_TEST_URL: redis://localhost:6379/15
API_KEYS: test_api_key_1,test_api_key_2
PYTHONPATH: .
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
# The suite exercises native UUID/JSON/timestamptz columns, FK cascade deletes
# and Lua-backed rate limiting, none of which the SQLite and fakeredis based
# unit tests can validate.
- name: Run real infrastructure tests
run: pytest -v -m real_infra tests/real