-
Notifications
You must be signed in to change notification settings - Fork 0
255 lines (204 loc) · 7.69 KB
/
ci.yml
File metadata and controls
255 lines (204 loc) · 7.69 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
name: 🧶 CommitWeave CI
on:
push:
branches: [ main, develop, "feature/*" ]
pull_request:
branches: [ main, develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Linting and Code Quality
lint:
name: 🔍 Lint & Code Quality
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: 🔧 Install dependencies
run: npm ci
- name: 🔍 Run ESLint
run: npm run lint
continue-on-error: false
- name: 🎨 Check Prettier formatting
run: npx prettier --check "src/**/*.{ts,js,json}" "bin/**/*.{ts,js}" "tests/**/*.{ts,js}"
continue-on-error: false
- name: 🔬 TypeScript type checking
run: npx tsc --noEmit
# Main CLI Testing
test:
name: 🧪 Test CLI (${{ matrix.os }}, Node ${{ matrix.node-version }})
runs-on: ${{ matrix.os }}
needs: lint
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20, 22]
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: 🔧 Install dependencies
run: npm ci
- name: 🏗️ Build package
run: npm run build
- name: 🧪 Run tests
run: npm test
- name: ⚡ Performance benchmark
run: npm run bench
env:
COMMITWEAVE_DEBUG_PERF: true
- name: 🔍 Test CLI functionality
run: |
npx tsx scripts/test-local.ts
npx tsx scripts/test-cli-functions.ts
- name: 📦 Test package structure
run: |
ls -la dist/
test -f dist/index.js
test -f dist/index.d.ts
test -f dist/bin.js
- name: 🎯 Test package installation
run: npm pack --dry-run
# VS Code Extension Testing
test-extension:
name: 🧩 Test VS Code Extension
runs-on: ubuntu-latest
needs: lint
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: 🔧 Install main dependencies
run: npm ci
- name: 🏗️ Build main project
run: npm run build
- name: 📁 Install extension dependencies
working-directory: ./vscode-extension
run: npm ci
- name: 🏗️ Build extension
working-directory: ./vscode-extension
run: npm run build
- name: 🔬 Lint extension code
working-directory: ./vscode-extension
run: npx tsc --noEmit
- name: 🧪 Run extension tests
working-directory: ./vscode-extension
run: xvfb-run -a npm test
- name: 📦 Package VSIX
working-directory: ./vscode-extension
run: npx vsce package --no-yarn
- name: 📤 Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: commitweave-vscode-extension-${{ github.sha }}
path: vscode-extension/*.vsix
retention-days: 90
- name: ✅ Test VSIX structure
working-directory: ./vscode-extension
run: |
ls -la *.vsix
echo "✅ VSIX package created successfully"
# Security and Quality Checks
security:
name: 🔒 Security & Quality
runs-on: ubuntu-latest
needs: lint
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: 🔧 Install dependencies
run: npm ci
- name: 🛡️ Run security audit
run: npm audit --audit-level=moderate
- name: 🔍 Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript
- name: 🏗️ Build for analysis
run: npm run build
- name: 🛡️ Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
# Build and Package
build:
name: 🏗️ Build & Package
runs-on: ubuntu-latest
needs: [test, test-extension, security]
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: 🔧 Install dependencies
run: npm ci
- name: 🏗️ Build project
run: npm run build
- name: 📦 Create npm package
run: npm pack
- name: 📤 Upload CLI package
uses: actions/upload-artifact@v4
with:
name: commitweave-cli-${{ github.sha }}
path: '*.tgz'
retention-days: 90
- name: 📊 Generate build report
run: |
echo "## 🎯 Build Summary" >> $GITHUB_STEP_SUMMARY
echo "- **Node.js Version**: $(node --version)" >> $GITHUB_STEP_SUMMARY
echo "- **npm Version**: $(npm --version)" >> $GITHUB_STEP_SUMMARY
echo "- **Package Size**: $(ls -lh *.tgz | awk '{print $5}')" >> $GITHUB_STEP_SUMMARY
echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "- **Build Status**: ✅ Success" >> $GITHUB_STEP_SUMMARY
# Summary Job
ci-success:
name: ✅ CI Complete
runs-on: ubuntu-latest
needs: [lint, test, test-extension, security, build]
if: always()
steps:
- name: 🎉 All checks passed
if: ${{ needs.lint.result == 'success' && needs.test.result == 'success' && needs.test-extension.result == 'success' && needs.security.result == 'success' && needs.build.result == 'success' }}
run: |
echo "🎉 All CI checks passed successfully!"
echo "## ✅ CI Results" >> $GITHUB_STEP_SUMMARY
echo "- **Linting**: ✅ Passed" >> $GITHUB_STEP_SUMMARY
echo "- **CLI Tests**: ✅ Passed (3 OS × 3 Node versions)" >> $GITHUB_STEP_SUMMARY
echo "- **Extension Tests**: ✅ Passed" >> $GITHUB_STEP_SUMMARY
echo "- **Security**: ✅ Passed" >> $GITHUB_STEP_SUMMARY
echo "- **Build**: ✅ Passed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🚀 Ready for release!" >> $GITHUB_STEP_SUMMARY
- name: ❌ Some checks failed
if: ${{ needs.lint.result != 'success' || needs.test.result != 'success' || needs.test-extension.result != 'success' || needs.security.result != 'success' || needs.build.result != 'success' }}
run: |
echo "❌ Some CI checks failed!"
echo "## ❌ CI Results" >> $GITHUB_STEP_SUMMARY
echo "- **Linting**: ${{ needs.lint.result == 'success' && '✅ Passed' || '❌ Failed' }}" >> $GITHUB_STEP_SUMMARY
echo "- **CLI Tests**: ${{ needs.test.result == 'success' && '✅ Passed' || '❌ Failed' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Extension Tests**: ${{ needs.test-extension.result == 'success' && '✅ Passed' || '❌ Failed' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Security**: ${{ needs.security.result == 'success' && '✅ Passed' || '❌ Failed' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Build**: ${{ needs.build.result == 'success' && '✅ Passed' || '❌ Failed' }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ Please fix failing checks before merging." >> $GITHUB_STEP_SUMMARY
exit 1