forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
266 lines (222 loc) · 8.03 KB
/
agent-system-tests.yml
File metadata and controls
266 lines (222 loc) · 8.03 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
name: Agent System Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
NODE_VERSION: "20"
BUN_VERSION: "1.2.0"
jobs:
agent-system-tests:
name: Agent System CI/CD Pipeline
runs-on: ubuntu-latest
strategy:
matrix:
test-suite: ["unit-tests", "integration-tests", "performance-tests", "e2e-tests"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: |
bun install
- name: Cache Bun modules
uses: actions/cache@v3
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ env.BUN_VERSION }}-${{ hashFiles('bun.lock') }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Run TypeScript check
run: |
bun run typecheck
- name: Run linting
run: |
bun run lint
- name: Run unit tests
if: matrix.test-suite == 'unit-tests'
run: |
bun test packages/opencode/src/agent/subagent/__tests__/*.test.ts --reporter=verbose
env:
NODE_ENV: test
- name: Run integration tests
if: matrix.test-suite == 'integration-tests'
run: |
bun test packages/opencode/src/agent/subagent/__tests__/integration.test.ts --reporter=verbose
env:
NODE_ENV: test
- name: Run performance benchmarks
if: matrix.test-suite == 'performance-tests'
run: |
bun test packages/opencode/src/agent/subagent/__tests__/performance.test.ts --reporter=verbose
env:
NODE_ENV: test
PERFORMANCE_TESTING: "true"
- name: Run end-to-end tests
if: matrix.test-suite == 'e2e-tests'
run: |
bun test packages/opencode/src/agent/subagent/__tests__/e2e.test.ts --reporter=verbose
env:
NODE_ENV: test
E2E_TESTING: "true"
- name: Generate test coverage
if: success() && matrix.test-suite == 'unit-tests'
run: |
bun test --coverage
- name: Upload coverage reports
if: success() && matrix.test-suite == 'unit-tests'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: agent-system-tests
files: |
./coverage/lcov.info
./coverage/cobertura.xml
- name: Performance regression analysis
if: matrix.test-suite == 'performance-tests'
run: |
node packages/opencode/scripts/performance-analysis.js
continue-on-error: true
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.test-suite }}
path: |
test-results/
coverage/
retention-days: 30
- name: Test suite summary
if: always()
run: |
echo "Test suite: ${{ matrix.test-suite }}"
echo "Status: ${{ job.status }}"
echo "Timestamp: $(date -u)"
agent-system-integration:
name: Agent System Full Integration
runs-on: ubuntu-latest
needs: [agent-system-tests]
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install
- name: Run complete agent system test suite
run: |
bun test packages/opencode/src/agent/subagent/__tests__/ --reporter=verbose --timeout=300000
env:
NODE_ENV: test
INTEGRATION_TESTING: "true"
- name: Generate integration report
run: |
node packages/opencode/scripts/integration-report.js
continue-on-error: true
- name: Performance baseline comparison
run: |
node packages/opencode/scripts/baseline-comparison.js
continue-on-error: true
- name: Upload integration artifacts
uses: actions/upload-artifact@v4
with:
name: integration-report
path: |
integration-reports/
retention-days: 30
- name: Create performance comment
if: always() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
let comment = '## Agent System Test Results\n\n';
try {
const reportPath = path.join(process.cwd(), 'integration-reports', 'performance-report.json');
if (fs.existsSync(reportPath)) {
const report = JSON.parse(fs.readFileSync(reportPath, 'utf8'));
comment += `### Performance Analysis\n`;
comment += `- Average Response Time: ${report.averageResponseTime}ms\n`;
comment += `- Memory Usage: ${report.memoryUsage.peak}MB\n`;
comment += `- Throughput: ${report.throughput.messagesPerSecond} msgs/sec\n`;
comment += `- Success Rate: ${report.successRate}%\n\n`;
}
} catch (error) {
comment += '### Performance Analysis\n_Report not available_\n\n';
}
try {
const coveragePath = path.join(process.cwd(), 'coverage', 'summary.json');
if (fs.existsSync(coveragePath)) {
const coverage = JSON.parse(fs.readFileSync(coveragePath, 'utf8'));
comment += `### Code Coverage\n`;
comment += `- Statements: ${coverage.statements.pct}%\n`;
comment += `- Branches: ${coverage.branches.pct}%\n`;
comment += `- Functions: ${coverage.functions.pct}%\n`;
comment += `- Lines: ${coverage.lines.pct}%\n\n`;
}
} catch (error) {
comment += '### Code Coverage\n_Report not available_\n\n';
}
comment += '### Test Summary\n';
comment += `- **Status**: ${{ job.status == 'success' ? '✅ Passed' : '❌ Failed' }}\n`;
comment += `- **Test Suite**: Agent System Integration\n`;
comment += `- **Timestamp**: ${new Date().toISOString()}\n`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
agent-system-deployment:
name: Agent System Deployment Verification
runs-on: ubuntu-latest
needs: [agent-system-integration]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install
- name: Build agent system
run: |
bun run build:agent-system
- name: Deploy to staging
run: |
echo "Deploying agent system to staging environment"
# Add deployment commands here
- name: Run deployment smoke tests
run: |
node packages/opencode/scripts/deployment-smoke-tests.js
continue-on-error: true
- name: Verify deployment
run: |
echo "Verifying agent system deployment"
# Add verification commands here
- name: Create deployment report
run: |
node packages/opencode/scripts/deployment-report.js
continue-on-error: true
- name: Upload deployment artifacts
uses: actions/upload-artifact@v4
with:
name: deployment-report
path: |
deployment-reports/
retention-days: 90