-
Notifications
You must be signed in to change notification settings - Fork 114
334 lines (290 loc) · 12.1 KB
/
Copy pathvalidate.yml
File metadata and controls
334 lines (290 loc) · 12.1 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
name: Validate
on:
workflow_call:
permissions:
contents: read
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
lint:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: ESLint
run: npx eslint "src/**/*.ts"
typecheck:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: TypeScript type-check
run: npx tsc --noEmit
circular-deps:
needs: install
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Build package
run: npm run build:dev
- name: Test circular dependency checker
run: npm run test:circular-deps
- name: Check circular dependencies
run: npm run check:circular-deps
unit-tests:
name: 'unit tests (shard ${{ matrix.shard }}/4)'
needs: install
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Run unit tests (shard ${{ matrix.shard }}/4)
run: npx jest --shard=${{ matrix.shard }}/4 --maxWorkers=50% --testPathIgnorePatterns=title.memory-leak.test.ts --testPathIgnorePatterns=llm.spec.ts --testPathIgnorePatterns=integration.test.ts --testPathIgnorePatterns=specs/summarization.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
AZURE_MODEL_NAME: ${{ secrets.AZURE_MODEL_NAME }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
AZURE_OPENAI_API_INSTANCE: ${{ secrets.AZURE_OPENAI_API_INSTANCE }}
AZURE_OPENAI_API_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_API_DEPLOYMENT }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
BEDROCK_AWS_ACCESS_KEY_ID: ${{ secrets.BEDROCK_AWS_ACCESS_KEY_ID }}
BEDROCK_AWS_SECRET_ACCESS_KEY: ${{ secrets.BEDROCK_AWS_SECRET_ACCESS_KEY }}
summarization-tests:
name: 'summarization tests (${{ matrix.group }})'
needs: install
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- group: anthropic
pattern: 'Anthropic Summarization E2E|Token accounting audit'
- group: openai
pattern: 'OpenAI Summarization E2E'
- group: bedrock
pattern: 'Bedrock Summarization E2E'
- group: local
pattern: 'no API keys'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Run summarization tests (${{ matrix.group }})
run: npx jest src/specs/summarization.test.ts -t "${{ matrix.pattern }}" --maxWorkers=50%
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
AZURE_MODEL_NAME: ${{ secrets.AZURE_MODEL_NAME }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
AZURE_OPENAI_API_INSTANCE: ${{ secrets.AZURE_OPENAI_API_INSTANCE }}
AZURE_OPENAI_API_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_API_DEPLOYMENT }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
BEDROCK_AWS_ACCESS_KEY_ID: ${{ secrets.BEDROCK_AWS_ACCESS_KEY_ID }}
BEDROCK_AWS_SECRET_ACCESS_KEY: ${{ secrets.BEDROCK_AWS_SECRET_ACCESS_KEY }}
integration-tests:
name: 'integration tests (change-gated)'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Resolve diff range
run: |
# Pull requests compare against the merge base of the target branch.
# Other events (e.g. push to main during publish) compare against the
# previous release commit so version bumps still gate correctly.
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "DIFF_RANGE=origin/${{ github.base_ref }}...HEAD" >> "$GITHUB_ENV"
else
PREV_VERSION=$(git log --grep="^v[0-9]" --skip=1 --max-count=1 --format="%H" 2>/dev/null || echo "")
if [ -z "$PREV_VERSION" ]; then
echo "DIFF_RANGE=HEAD~10 HEAD" >> "$GITHUB_ENV"
else
echo "DIFF_RANGE=$PREV_VERSION HEAD" >> "$GITHUB_ENV"
fi
fi
- name: Check for Google LLM changes
id: google_changes
run: |
if git diff --name-only $DIFF_RANGE 2>/dev/null | grep -q "^src/llm/google/"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Run Google LLM tests (flaky - timeouts allowed)
id: google_llm_tests
if: steps.google_changes.outputs.changed == 'true'
continue-on-error: true
timeout-minutes: 6
run: npx jest src/llm/google/llm.spec.ts --runInBand
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_TEST_CALL_GAP_MS: '1000'
GOOGLE_TEST_MAX_RETRIES: '2'
GOOGLE_TEST_MAX_RETRY_DELAY_MS: '50000'
- name: Surface Google LLM soft failure
if: always() && steps.google_changes.outputs.changed == 'true' && steps.google_llm_tests.outcome == 'failure'
run: |
echo "::warning title=Soft-failed Google LLM tests::The Google LLM integration suite failed, but this workflow allows provider API failures. Inspect the test job logs before merging."
{
echo "### Soft-failed Google LLM tests"
echo ""
echo "The Google LLM integration suite failed, but this job intentionally allows provider API failures."
echo ""
echo "- Suite: \`npx jest src/llm/google/llm.spec.ts --runInBand\`"
echo "- Active Gemini quotas: https://ai.dev/rate-limit"
echo "- Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} >> "$GITHUB_STEP_SUMMARY"
- name: Check for Anthropic LLM changes
id: anthropic_changes
run: |
if git diff --name-only $DIFF_RANGE 2>/dev/null | grep -q "^src/llm/anthropic/"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Run Anthropic LLM tests (flaky - timeouts allowed)
id: anthropic_llm_tests
if: steps.anthropic_changes.outputs.changed == 'true'
continue-on-error: true
timeout-minutes: 6
run: npx jest src/llm/anthropic/llm.spec.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
- name: Surface Anthropic LLM soft failure
if: always() && steps.anthropic_changes.outputs.changed == 'true' && steps.anthropic_llm_tests.outcome == 'failure'
run: |
echo "::warning title=Soft-failed Anthropic LLM tests::The Anthropic LLM integration suite failed, but this workflow allows provider API failures. Inspect the test job logs before merging."
{
echo "### Soft-failed Anthropic LLM tests"
echo ""
echo "The Anthropic LLM integration suite failed, but this job intentionally allows provider API failures."
echo ""
echo "- Suite: \`npx jest src/llm/anthropic/llm.spec.ts\`"
echo "- Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} >> "$GITHUB_STEP_SUMMARY"
- name: Check for PTC changes
id: ptc_changes
run: |
if git diff --name-only $DIFF_RANGE 2>/dev/null | grep -qE "^src/tools/ProgrammaticToolCalling\.ts|^src/tools/ToolNode\.ts|^src/agents/AgentContext\.ts|^src/test/mockTools\.ts"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Run PTC unit tests
if: steps.ptc_changes.outputs.changed == 'true'
timeout-minutes: 6
run: npx jest src/tools/__tests__/ProgrammaticToolCalling.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
LIBRECHAT_CODE_BASEURL: ${{ secrets.LIBRECHAT_CODE_BASEURL }}
- name: Check for Tool Search changes
id: tool_search_changes
run: |
if git diff --name-only $DIFF_RANGE 2>/dev/null | grep -qE "^src/tools/ToolSearch\.ts|^src/tools/ToolNode\.ts|^src/agents/AgentContext\.ts|^src/test/mockTools\.ts"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Run Tool Search unit tests
if: steps.tool_search_changes.outputs.changed == 'true'
timeout-minutes: 6
run: npx jest src/tools/__tests__/ToolSearch.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
LIBRECHAT_CODE_BASEURL: ${{ secrets.LIBRECHAT_CODE_BASEURL }}
- name: Check for durability changes
id: durability_changes
run: |
if git diff --name-only $DIFF_RANGE 2>/dev/null | grep -qE "^src/run\.ts|^src/types/run\.ts|^src/specs/durability-checkpoint\.integration\.test\.ts"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Run durability checkpoint integration test (downloads a mongod binary)
if: steps.durability_changes.outputs.changed == 'true'
timeout-minutes: 6
run: npx jest src/specs/durability-checkpoint.integration.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test