-
-
Notifications
You must be signed in to change notification settings - Fork 753
246 lines (209 loc) · 7.44 KB
/
test.yml
File metadata and controls
246 lines (209 loc) · 7.44 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
name: Test
# Story 6.1: Specialized testing (security, build, integration, performance)
# Cross-platform compatibility testing moved to ci.yml
# NOTE: Only runs on push to main (PRs use ci.yml for validation)
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '*.md'
- '.aiox/**'
- 'squads/**'
workflow_dispatch:
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
NODE_VERSION: '20'
jobs:
# NOTE: Lint job removed (Story 6.1) - handled by ci.yml
security-audit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run security audit
run: |
npm audit --audit-level=moderate || echo "Security audit completed with warnings"
- name: Run penetration test
run: |
if [ -f "security/penetration-test.js" ]; then
cd security
node penetration-test.js
else
echo "Penetration test not found, skipping"
fi
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test workspace package
run: |
echo "Testing workspace package: aiox-core"
# Check if package.json exists
if [ -f "package.json" ]; then
echo "✅ package.json exists"
# Check if entry points exist
if [ -f "index.js" ]; then
echo "✅ index.js exists"
else
echo "ℹ️ index.js not found (CLI-based package)"
fi
# Validate package.json
node -e "
const pkg = require('./package.json');
console.log('✅ Package validation passed:', pkg.name);
"
else
echo "❌ package.json not found"
exit 1
fi
- name: Test installer package
run: |
if [ -d "packages/installer" ]; then
echo "Testing packages/installer"
cd packages/installer
if [ -f "package.json" ]; then
echo "✅ Installer package.json exists"
fi
else
echo "ℹ️ Installer package not found, skipping"
fi
integration-test:
runs-on: ubuntu-latest
needs: [security-audit, build-test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test CLI integration
run: |
# Test that CLI entry point works
node -e "
try {
// Test bin/aiox-init.js exists
const fs = require('fs');
if (fs.existsSync('./bin/aiox-init.js')) {
console.log('✅ aiox-init.js exists');
} else {
console.log('❌ aiox-init.js not found');
process.exit(1);
}
// Test bin/aiox.js exists
if (fs.existsSync('./bin/aiox.js')) {
console.log('✅ aiox.js exists');
} else {
console.log('❌ aiox.js not found');
process.exit(1);
}
console.log('✅ CLI integration test passed');
} catch (error) {
console.error('❌ CLI integration test failed:', error.message);
process.exit(1);
}
"
- name: Test core modules
run: |
# Test core scripts are loadable
for script in health-check greeting-builder agent-parser; do
SCRIPT_PATH=".aiox-core/development/scripts/${script}.js"
if [ -f "$SCRIPT_PATH" ]; then
echo "✅ Found: $SCRIPT_PATH"
else
# Check alternative locations
ALT_PATH=".aiox-core/core/${script}.js"
if [ -f "$ALT_PATH" ]; then
echo "✅ Found: $ALT_PATH"
else
echo "ℹ️ Script not found: $script (may not be required)"
fi
fi
done
echo "✅ Core modules check completed"
performance-test:
runs-on: ubuntu-latest
needs: [build-test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run performance checks
run: |
# Basic performance checks
echo "Running basic performance checks..."
# Check file count in critical directories
AGENT_COUNT=$(find .aiox-core/development/agents -name "*.md" | wc -l)
echo "✅ Agent definitions: $AGENT_COUNT"
TASK_COUNT=$(find .aiox-core/development/tasks -name "*.md" | wc -l)
echo "✅ Task definitions: $TASK_COUNT"
# Check manifest generation time
START_TIME=$(date +%s%N)
node scripts/generate-install-manifest.js > /dev/null 2>&1
END_TIME=$(date +%s%N)
DURATION=$(( (END_TIME - START_TIME) / 1000000 ))
echo "✅ Manifest generation: ${DURATION}ms"
if [ "$DURATION" -gt 10000 ]; then
echo "⚠️ Manifest generation took longer than expected"
fi
echo "✅ Performance checks completed"
# NOTE: Cross-platform compatibility testing removed (Story 6.1)
# Now handled by ci.yml cross-platform job (only on main branch push)
summary:
runs-on: ubuntu-latest
needs: [security-audit, build-test, integration-test, performance-test]
if: always()
steps:
- name: Test Summary
run: |
echo "## 📊 Test Results Summary"
echo ""
echo "| Test Suite | Status |"
echo "|------------|--------|"
echo "| Security Audit | ${{ needs.security-audit.result == 'success' && '✅ Passed' || '❌ Failed' }} |"
echo "| Build Test | ${{ needs.build-test.result == 'success' && '✅ Passed' || '❌ Failed' }} |"
echo "| Integration Test | ${{ needs.integration-test.result == 'success' && '✅ Passed' || '❌ Failed' }} |"
echo "| Performance Test | ${{ needs.performance-test.result == 'success' && '✅ Passed' || '❌ Failed' }} |"
echo ""
echo "Note: Linting handled by ci.yml (Story 6.1)"
echo ""
# Overall status
if [ "${{ needs.security-audit.result }}" = "success" ] && \
[ "${{ needs.build-test.result }}" = "success" ] && \
[ "${{ needs.integration-test.result }}" = "success" ] && \
[ "${{ needs.performance-test.result }}" = "success" ]; then
echo "🎉 All critical tests passed!"
echo "✅ Ready for deployment"
else
echo "❌ Some tests failed - review before deploying"
exit 1
fi