1- name : Continuous Integration
1+ name : CI
22
33on :
44 push :
5- branches : [ main, develop, refactoring ]
5+ branches : [ main, refactoring ]
66 pull_request :
7- branches : [ main, develop ]
8- schedule :
9- # Run tests daily at 2 AM UTC to catch dependency issues
10- - cron : ' 0 2 * * *'
7+ branches : [ main ]
118
129jobs :
13- # Job 1: Code Quality and Security Checks
14- quality :
15- name : Code Quality & Security
16- runs-on : ubuntu-latest
10+ test :
11+ name : Test & Build
12+ runs-on : macos-latest
13+
1714 steps :
18- - name : Checkout code
15+ - name : Checkout
1916 uses : actions/checkout@v4
2017
2118 - name : Setup Node.js
@@ -27,92 +24,30 @@ jobs:
2724 - name : Install dependencies
2825 run : npm ci
2926
30- - name : Run ESLint
27+ - name : Lint
3128 run : npm run lint
32- continue-on-error : false
3329
34- - name : Check Prettier formatting
35- run : npm run format:check
36- continue-on-error : false
30+ - name : Type check
31+ run : npm run type-check
3732
38- - name : Run TypeScript compiler check
39- run : npx tsc --noEmit
33+ - name : Test
34+ run : npm test
35+
36+ - name : Build
37+ run : npm run build
4038
4139 - name : Security audit
42- run : npm audit --audit-level high
40+ run : npm audit --audit-level= high
4341 continue-on-error : true
4442
45- - name : Check for outdated dependencies
46- run : npm outdated || true
47-
48- - name : Dependency vulnerability scan
49- uses : actions/setup-node@v4
50- with :
51- node-version : ' 18'
52- - run : |
53- npm install -g npm-check-updates
54- ncu --errorLevel 2 || true
55-
56- # Job 2: Multi-version Testing Matrix
57- test :
58- name : Test Suite
59- runs-on : ${{ matrix.os }}
60- strategy :
61- matrix :
62- os : [ubuntu-latest, macos-latest]
63- node-version : ['18.x', '20.x', '21.x']
64- exclude :
65- # Exclude some combinations to reduce CI time
66- - os : ubuntu-latest
67- node-version : ' 21.x'
43+ release :
44+ name : Release
45+ runs-on : macos-latest
46+ needs : test
47+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
6848
6949 steps :
70- - name : Checkout code
71- uses : actions/checkout@v4
72-
73- - name : Setup Node.js ${{ matrix.node-version }}
74- uses : actions/setup-node@v4
75- with :
76- node-version : ${{ matrix.node-version }}
77- cache : ' npm'
78-
79- - name : Install dependencies
80- run : npm ci
81-
82- - name : Build project
83- run : npm run build
84-
85- - name : Run tests with coverage
86- run : npm run test:coverage
87- env :
88- NODE_ENV : test
89-
90- - name : Upload coverage to Codecov
91- if : matrix.os == 'ubuntu-latest' && matrix.node-version == '18.x'
92- uses : codecov/codecov-action@v3
93- with :
94- file : ./coverage/lcov.info
95- flags : unittests
96- name : codecov-umbrella
97- fail_ci_if_error : false
98-
99- - name : Store test results
100- if : always()
101- uses : actions/upload-artifact@v4
102- with :
103- name : test-results-${{ matrix.os }}-${{ matrix.node-version }}
104- path : |
105- coverage/
106- test-results.xml
107- retention-days : 7
108-
109- # Job 3: Build and Package Testing
110- build :
111- name : Build & Package
112- runs-on : ubuntu-latest
113- needs : [quality, test]
114- steps :
115- - name : Checkout code
50+ - name : Checkout
11651 uses : actions/checkout@v4
11752
11853 - name : Setup Node.js
@@ -124,195 +59,17 @@ jobs:
12459 - name : Install dependencies
12560 run : npm ci
12661
127- - name : Build project
128- run : npm run build
129-
130- - name : Test build output
131- run : |
132- # Verify build artifacts exist
133- test -f dist/index.js || exit 1
134- test -d dist || exit 1
135-
136- # Test that built code can be executed
137- node dist/index.js --version || echo "Version check completed"
62+ - name : Build for release
63+ run : npm run build:advanced
13864
139- - name : Package size analysis
65+ - name : Create release artifacts
14066 run : |
141- echo "## Package Size Analysis" >> $GITHUB_STEP_SUMMARY
142- echo "| File | Size |" >> $GITHUB_STEP_SUMMARY
143- echo "|------|------|" >> $GITHUB_STEP_SUMMARY
144- find dist -name "*.js" -exec sh -c 'echo "| {} | $(du -h {} | cut -f1) |"' \; >> $GITHUB_STEP_SUMMARY
67+ mkdir -p release
68+ cp builds/standalone/bear-mcp-server.js release/
69+ cp README.md LICENSE release/
14570
146- - name : Store build artifacts
71+ - name : Upload artifacts
14772 uses : actions/upload-artifact@v4
14873 with :
149- name : build-artifacts
150- path : |
151- dist/
152- package.json
153- package-lock.json
154- retention-days : 30
155-
156- # Job 4: Performance Testing
157- performance :
158- name : Performance Tests
159- runs-on : ubuntu-latest
160- needs : build
161- if : github.event_name == 'push' || github.event_name == 'schedule'
162- steps :
163- - name : Checkout code
164- uses : actions/checkout@v4
165-
166- - name : Setup Node.js
167- uses : actions/setup-node@v4
168- with :
169- node-version : ' 18'
170- cache : ' npm'
171-
172- - name : Install dependencies
173- run : npm ci
174-
175- - name : Download build artifacts
176- uses : actions/download-artifact@v4
177- with :
178- name : build-artifacts
179- path : .
180-
181- - name : Run performance benchmarks
182- run : |
183- # Create a simple performance test
184- node -e "
185- const { performance } = require('perf_hooks');
186- const start = performance.now();
187- require('./dist/index.js');
188- const end = performance.now();
189- console.log(\`Module load time: \${end - start}ms\`);
190-
191- if (end - start > 1000) {
192- console.error('Module load time exceeds 1000ms threshold');
193- process.exit(1);
194- }
195- "
196-
197- - name : Memory usage check
198- run : |
199- node -e "
200- const used = process.memoryUsage();
201- console.log('Memory usage:');
202- for (let key in used) {
203- console.log(\`\${key}: \${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB\`);
204- }
205-
206- if (used.heapUsed > 100 * 1024 * 1024) {
207- console.error('Heap usage exceeds 100MB threshold');
208- process.exit(1);
209- }
210- "
211-
212- # Job 5: Integration Testing (Conditional)
213- integration :
214- name : Integration Tests
215- runs-on : macos-latest
216- needs : build
217- if : github.event_name == 'push' && contains(github.ref, 'main')
218- steps :
219- - name : Checkout code
220- uses : actions/checkout@v4
221-
222- - name : Setup Node.js
223- uses : actions/setup-node@v4
224- with :
225- node-version : ' 18'
226- cache : ' npm'
227-
228- - name : Install dependencies
229- run : npm ci
230-
231- - name : Download build artifacts
232- uses : actions/download-artifact@v4
233- with :
234- name : build-artifacts
235- path : .
236-
237- - name : Check for Bear app (macOS only)
238- run : |
239- if [ -d "/Applications/Bear.app" ]; then
240- echo "Bear app found - can run full integration tests"
241- echo "BEAR_AVAILABLE=true" >> $GITHUB_ENV
242- else
243- echo "Bear app not found - running limited integration tests"
244- echo "BEAR_AVAILABLE=false" >> $GITHUB_ENV
245- fi
246-
247- - name : Run integration tests
248- run : npm run test:integration
249- env :
250- NODE_ENV : test
251- BEAR_AVAILABLE : ${{ env.BEAR_AVAILABLE }}
252-
253- # Job 6: Documentation Check
254- docs :
255- name : Documentation
256- runs-on : ubuntu-latest
257- steps :
258- - name : Checkout code
259- uses : actions/checkout@v4
260-
261- - name : Setup Node.js
262- uses : actions/setup-node@v4
263- with :
264- node-version : ' 18'
265- cache : ' npm'
266-
267- - name : Install dependencies
268- run : npm ci
269-
270- - name : Check documentation completeness
271- run : |
272- echo "## Documentation Status" >> $GITHUB_STEP_SUMMARY
273-
274- # Check for required documentation files
275- docs_files=("README.md" "docs/architecture.md" "docs/developer-guide.md" "docs/service-reference.md" "docs/api-reference.md")
276-
277- for file in "${docs_files[@]}"; do
278- if [ -f "$file" ]; then
279- lines=$(wc -l < "$file")
280- echo "| $file | β
($lines lines) |" >> $GITHUB_STEP_SUMMARY
281- else
282- echo "| $file | β Missing |" >> $GITHUB_STEP_SUMMARY
283- fi
284- done
285-
286- - name : Validate markdown files
287- run : |
288- # Check for broken links in markdown files
289- find docs -name "*.md" -exec echo "Checking {}" \;
290-
291- - name : Generate API documentation (if needed)
292- run : |
293- # Future: Add TypeDoc generation
294- echo "API documentation check completed"
295-
296- # Job 7: Notification and Reporting
297- notify :
298- name : Results Summary
299- runs-on : ubuntu-latest
300- needs : [quality, test, build, performance, docs]
301- if : always()
302- steps :
303- - name : Generate summary
304- run : |
305- echo "## CI Pipeline Results" >> $GITHUB_STEP_SUMMARY
306- echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
307- echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
308- echo "| Quality Checks | ${{ needs.quality.result == 'success' && 'β
Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
309- echo "| Test Suite | ${{ needs.test.result == 'success' && 'β
Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
310- echo "| Build & Package | ${{ needs.build.result == 'success' && 'β
Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
311- echo "| Performance | ${{ needs.performance.result == 'success' && 'β
Passed' || needs.performance.result == 'skipped' && 'βοΈ Skipped' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
312- echo "| Documentation | ${{ needs.docs.result == 'success' && 'β
Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
313-
314- - name : Report failure
315- if : ${{ needs.quality.result == 'failure' || needs.test.result == 'failure' || needs.build.result == 'failure' }}
316- run : |
317- echo "β CI Pipeline failed - check individual job logs for details"
318- exit 1
74+ name : bear-mcp-server
75+ path : release/
0 commit comments