forked from plastic-labs/honcho
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (137 loc) · 4.54 KB
/
unittest.yml
File metadata and controls
150 lines (137 loc) · 4.54 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
139
140
141
142
143
144
145
146
147
148
149
150
name: FastAPI Tests with PostgreSQL and uv
on:
push:
branches: [main]
paths:
- '**.py'
- '**.ts'
- '**.js'
- '**.tsx'
- '**.jsx'
- 'pyproject.toml'
- 'uv.lock'
- 'sdks/typescript/package.json'
- 'sdks/typescript/bun.lock'
- '.github/workflows/unittest.yml'
pull_request:
branches: [main]
paths:
- '**.py'
- '**.ts'
- '**.js'
- '**.tsx'
- '**.jsx'
- 'pyproject.toml'
- 'uv.lock'
- 'sdks/typescript/package.json'
- 'sdks/typescript/bun.lock'
- '.github/workflows/unittest.yml'
permissions:
contents: read
pull-requests: read
jobs:
# Determine which tests to run based on changed files
changes:
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python:
- '**.py'
- 'pyproject.toml'
- 'uv.lock'
- 'migrations/**'
- 'sdks/typescript/**'
- '.github/workflows/unittest.yml'
test-python:
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
services:
database:
image: pgvector/pgvector:pg15
env:
POSTGRES_DB: test_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install TypeScript SDK dependencies
run: bun install
working-directory: sdks/typescript
- name: Install the project
run: uv sync --all-extras --dev
- name: Run Tests
run: uv run pytest -x
env:
DB_CONNECTION_URI: postgresql+psycopg://postgres:postgres@localhost:5432/test_db
AUTH_USE_AUTH: false
SENTRY_ENABLED: false
LLM_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LLM_ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
LLM_OPENAI_COMPATIBLE_API_KEY: test-key
LLM_OPENAI_COMPATIBLE_BASE_URL: http://localhost:8000
DERIVER_PROVIDER: openai
DERIVER_MODEL: test
DIALECTIC_LEVELS__minimal__PROVIDER: openai
DIALECTIC_LEVELS__minimal__MODEL: test
DIALECTIC_LEVELS__minimal__THINKING_BUDGET_TOKENS: 0
DIALECTIC_LEVELS__minimal__MAX_TOOL_ITERATIONS: 2
DIALECTIC_LEVELS__low__PROVIDER: openai
DIALECTIC_LEVELS__low__MODEL: test
DIALECTIC_LEVELS__low__THINKING_BUDGET_TOKENS: 0
DIALECTIC_LEVELS__low__MAX_TOOL_ITERATIONS: 5
DIALECTIC_LEVELS__medium__PROVIDER: openai
DIALECTIC_LEVELS__medium__MODEL: test
DIALECTIC_LEVELS__medium__THINKING_BUDGET_TOKENS: 0
DIALECTIC_LEVELS__medium__MAX_TOOL_ITERATIONS: 4
DIALECTIC_LEVELS__high__PROVIDER: openai
DIALECTIC_LEVELS__high__MODEL: test
DIALECTIC_LEVELS__high__THINKING_BUDGET_TOKENS: 0
DIALECTIC_LEVELS__high__MAX_TOOL_ITERATIONS: 4
DIALECTIC_LEVELS__max__PROVIDER: openai
DIALECTIC_LEVELS__max__MODEL: test
DIALECTIC_LEVELS__max__THINKING_BUDGET_TOKENS: 0
DIALECTIC_LEVELS__max__MAX_TOOL_ITERATIONS: 10
DIALECTIC_QUERY_GENERATION_PROVIDER: openai
DIALECTIC_QUERY_GENERATION_MODEL: test
SUMMARY_PROVIDER: openai
SUMMARY_MODEL: test
# Status check for branch protection rules
# This job always runs and reports success only if all required jobs pass
test-status:
runs-on: ubuntu-latest
needs: [changes, test-python]
if: always()
steps:
- name: Check test results
run: |
if [[ "${{ needs.changes.outputs.python }}" == "true" && "${{ needs.test-python.result }}" != "success" && "${{ needs.test-python.result }}" != "skipped" ]]; then
echo "Python tests failed or were cancelled"
exit 1
fi
echo "All required tests passed!"