-
Notifications
You must be signed in to change notification settings - Fork 3
466 lines (405 loc) · 15.4 KB
/
ci.yml
File metadata and controls
466 lines (405 loc) · 15.4 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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
name: CI
on:
push:
branches: [main, 'epic/*', 'feature/*']
pull_request:
branches: [main]
# Path filters for conditional job execution
# Note: GitHub Actions doesn't support per-job path filters natively,
# so we use dorny/paths-filter action within jobs that need it
jobs:
# ============================================================================
# Core Checks - Run on every commit (fast: ~2 min)
# ============================================================================
check-all:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
timeout-minutes: 2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
timeout-minutes: 3
- name: Install dependencies
run: npm ci
timeout-minutes: 5
- name: Run lint
run: npm run lint
timeout-minutes: 2
- name: Run typecheck
run: npm run typecheck
timeout-minutes: 3
- name: Run tests
run: npm run test
timeout-minutes: 5
# ============================================================================
# Path Filter - Determine which jobs need to run
# ============================================================================
changes:
runs-on: ubuntu-latest
outputs:
install-scripts: ${{ steps.filter.outputs.install-scripts }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
install-scripts:
- 'install.sh'
- 'install.ps1'
- '.github/workflows/ci.yml'
# ============================================================================
# Install Script Syntax Validation (only when install scripts change)
# ============================================================================
install-script-syntax:
needs: changes
if: ${{ needs.changes.outputs.install-scripts == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Verify install.sh syntax
run: bash -n install.sh
- name: Verify install.ps1 syntax
run: |
# Use pwsh to check PowerShell syntax
pwsh -Command "[System.Management.Automation.Language.Parser]::ParseFile('install.ps1', [ref]\$null, [ref]\$null)" > /dev/null
echo "install.ps1 syntax OK"
- name: Test --ci flag is recognized
run: |
# Test that --ci flag prevents the non-interactive exit
output=$(timeout 5 bash install.sh --ci 2>&1 || true)
if echo "$output" | grep -q "NON-INTERACTIVE MODE NOT SUPPORTED"; then
echo "ERROR: --ci flag not working - script still requires interactive mode"
exit 1
fi
if echo "$output" | grep -q "Running in CI mode"; then
echo "SUCCESS: --ci flag recognized"
else
echo "WARNING: CI mode message not found, but non-interactive error also not present"
fi
echo "Output preview:"
echo "$output" | head -20
# ============================================================================
# Group A: Installation & Tool Verification (only when install scripts change)
# ============================================================================
install-verify-linux:
needs: changes
if: ${{ needs.changes.outputs.install-scripts == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 25
outputs:
rad-version: ${{ steps.verify.outputs.rad-version }}
steps:
- uses: actions/checkout@v4
- name: Cache Radicle
id: cache-radicle
uses: actions/cache@v4
with:
path: ~/.radicle
key: radicle-linux-${{ hashFiles('install.sh') }}-v2
restore-keys: radicle-linux-
- name: Cache Ollama models
id: cache-ollama
uses: actions/cache@v4
with:
path: ~/.ollama/models
key: ollama-nomic-embed-text-v1
- name: Run install script
run: |
bash install.sh --ci --alias "CI-Linux-${{ github.run_id }}" --passphrase "ci-test-pass"
env:
RAD_PASSPHRASE: ci-test-pass
- name: Verify installed tools
id: verify
run: |
echo "=== Group A: Tool Verification ==="
# A.1: Git
echo "A.1 Git:"
git --version || { echo "FAIL: Git not found"; exit 1; }
# A.2: GitHub CLI (check presence, auth tested separately)
echo "A.2 GitHub CLI:"
gh --version || { echo "FAIL: GitHub CLI not found"; exit 1; }
# A.3: Radicle CLI
echo "A.3 Radicle CLI:"
export PATH="$HOME/.radicle/bin:$PATH"
RAD_VERSION=$(rad --version 2>/dev/null || echo "NOT FOUND")
echo "rad-version=$RAD_VERSION" >> $GITHUB_OUTPUT
if [ "$RAD_VERSION" = "NOT FOUND" ]; then
echo "FAIL: Radicle CLI not found"
exit 1
fi
echo "Radicle: $RAD_VERSION"
# A.4: Radicle Identity
echo "A.4 Radicle Identity:"
RAD_DID=$(rad self --did 2>/dev/null || echo "NOT FOUND")
if [ "$RAD_DID" = "NOT FOUND" ]; then
echo "FAIL: Radicle identity not found"
exit 1
fi
echo "Identity: $RAD_DID"
# A.5: Ollama
echo "A.5 Ollama:"
if command -v ollama &> /dev/null; then
ollama --version || true
echo "Ollama installed"
else
echo "WARNING: Ollama not installed (optional)"
fi
# A.6: Obsidian (Linux - check Flatpak/Snap)
echo "A.6 Obsidian:"
if flatpak list 2>/dev/null | grep -q "md.obsidian.Obsidian"; then
echo "Obsidian installed via Flatpak"
elif snap list 2>/dev/null | grep -q "obsidian"; then
echo "Obsidian installed via Snap"
elif command -v obsidian &> /dev/null; then
echo "Obsidian found in PATH"
else
echo "FAIL: Obsidian not found"
exit 1
fi
echo ""
echo "=== All required tools verified ==="
install-verify-macos:
needs: changes
if: ${{ needs.changes.outputs.install-scripts == 'true' }}
runs-on: macos-latest
timeout-minutes: 30
outputs:
rad-version: ${{ steps.verify.outputs.rad-version }}
steps:
- uses: actions/checkout@v4
- name: Cache Radicle
id: cache-radicle
uses: actions/cache@v4
with:
path: ~/.radicle
key: radicle-macos-${{ hashFiles('install.sh') }}-v2
restore-keys: radicle-macos-
- name: Cache Ollama models
id: cache-ollama
uses: actions/cache@v4
with:
path: ~/.ollama/models
key: ollama-nomic-embed-text-v1
- name: Run install script
run: |
bash install.sh --ci --alias "CI-macOS-${{ github.run_id }}" --passphrase "ci-test-pass"
env:
RAD_PASSPHRASE: ci-test-pass
- name: Verify installed tools
id: verify
run: |
echo "=== Group A: Tool Verification ==="
# A.1: Git
echo "A.1 Git:"
git --version || { echo "FAIL: Git not found"; exit 1; }
# A.2: GitHub CLI
echo "A.2 GitHub CLI:"
gh --version || { echo "FAIL: GitHub CLI not found"; exit 1; }
# A.3: Radicle CLI
echo "A.3 Radicle CLI:"
export PATH="$HOME/.radicle/bin:$PATH"
RAD_VERSION=$(rad --version 2>/dev/null || echo "NOT FOUND")
echo "rad-version=$RAD_VERSION" >> $GITHUB_OUTPUT
if [ "$RAD_VERSION" = "NOT FOUND" ]; then
echo "FAIL: Radicle CLI not found"
exit 1
fi
echo "Radicle: $RAD_VERSION"
# A.4: Radicle Identity
echo "A.4 Radicle Identity:"
RAD_DID=$(rad self --did 2>/dev/null || echo "NOT FOUND")
if [ "$RAD_DID" = "NOT FOUND" ]; then
echo "FAIL: Radicle identity not found"
exit 1
fi
echo "Identity: $RAD_DID"
# A.5: Ollama
echo "A.5 Ollama:"
if command -v ollama &> /dev/null; then
ollama --version || true
echo "Ollama installed"
else
echo "WARNING: Ollama not installed (optional)"
fi
# A.6: Obsidian (macOS - check /Applications)
echo "A.6 Obsidian:"
if [ -d "/Applications/Obsidian.app" ]; then
echo "Obsidian installed at /Applications/Obsidian.app"
else
echo "FAIL: Obsidian not found"
exit 1
fi
echo ""
echo "=== All required tools verified ==="
install-verify-windows:
needs: changes
if: ${{ needs.changes.outputs.install-scripts == 'true' }}
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Cache Ollama models
id: cache-ollama
uses: actions/cache@v4
with:
path: ~\.ollama\models
key: ollama-nomic-embed-text-windows-v1
- name: Run install script
shell: pwsh
run: |
.\install.ps1 -CI
- name: Verify installed tools
shell: pwsh
run: |
$ErrorActionPreference = "Continue"
Write-Host "=== Group A: Tool Verification (Windows) ==="
# A.1: Git
Write-Host "A.1 Git:"
try {
git --version
} catch {
Write-Host "FAIL: Git not found"
exit 1
}
# A.2: GitHub CLI
Write-Host "A.2 GitHub CLI:"
try {
gh --version | Select-Object -First 1
} catch {
Write-Host "FAIL: GitHub CLI not found"
exit 1
}
# A.3: Radicle CLI (Windows has CLI but not node)
Write-Host "A.3 Radicle CLI:"
# Check if rad is in PATH or common locations
$radPaths = @(
"$env:USERPROFILE\.radicle\bin\rad.exe",
"$env:LOCALAPPDATA\Programs\Radicle\rad.exe"
)
$radFound = $false
foreach ($radPath in $radPaths) {
if (Test-Path $radPath) {
$radVersion = & $radPath --version 2>&1
Write-Host "Radicle: $radVersion"
$radFound = $true
break
}
}
if (-not $radFound) {
# Try PATH
try {
$radVersion = rad --version 2>&1
Write-Host "Radicle: $radVersion"
$radFound = $true
} catch {
Write-Host "INFO: Radicle CLI not found (expected - Windows native build optional)"
}
}
# A.4: Radicle Identity (only if rad found)
if ($radFound) {
Write-Host "A.4 Radicle Identity:"
try {
$radDid = rad self --did 2>&1
Write-Host "Identity: $radDid"
} catch {
Write-Host "INFO: No Radicle identity (expected if rad not fully set up)"
}
}
# A.5: Ollama
Write-Host "A.5 Ollama:"
try {
ollama --version
Write-Host "Ollama installed"
} catch {
Write-Host "INFO: Ollama not installed (optional)"
}
# A.6: Obsidian (Windows - check common locations)
Write-Host "A.6 Obsidian:"
$obsidianPaths = @(
"$env:LOCALAPPDATA\Obsidian\Obsidian.exe",
"$env:LOCALAPPDATA\Programs\Obsidian\Obsidian.exe",
"$env:PROGRAMFILES\Obsidian\Obsidian.exe"
)
$obsidianFound = $false
foreach ($path in $obsidianPaths) {
if (Test-Path $path) {
Write-Host "Obsidian installed at $path"
$obsidianFound = $true
break
}
}
if (-not $obsidianFound) {
Write-Host "FAIL: Obsidian not found"
exit 1
}
Write-Host ""
Write-Host "=== Windows tool verification complete ==="
Write-Host "NOTE: P2P features not available on Windows (pending Radicle support)"
# ============================================================================
# Group B: DreamNode Operations (placeholder - needs Node.js test harness)
# ============================================================================
# TODO: Create scripts/ci/test-dreamnode-ops.ts
# - Test DreamNodeConversionService.convertToDreamNode()
# - Test SubmoduleManagerService.importSubmodule()
# - Verify platform-specific submodule URL handling
# ============================================================================
# DROPPED GROUPS (December 2025)
# ============================================================================
# Group C (GitHub Publishing) - Dropped: gh CLI is straightforward, manual testing sufficient
# Group D (Semantic Search) - Dropped: Vitest covers logic, Ollama is install-script concern
# See p2p-collaboration.yml for Group E (P2P tests with Tailscale)
# ============================================================================
# Summary Job
# ============================================================================
ci-summary:
if: always()
needs: [check-all, changes, install-script-syntax, install-verify-linux, install-verify-macos, install-verify-windows]
runs-on: ubuntu-latest
steps:
- name: CI Summary
run: |
echo "=== CI Summary ==="
echo ""
echo "Core Checks: ${{ needs.check-all.result }}"
echo ""
echo "Install Script Tests (run when install.sh/install.ps1 change):"
echo " Path filter: ${{ needs.changes.outputs.install-scripts == 'true' && 'triggered' || 'skipped (no changes)' }}"
echo " Syntax Check: ${{ needs.install-script-syntax.result }}"
echo " Linux Install: ${{ needs.install-verify-linux.result }}"
echo " macOS Install: ${{ needs.install-verify-macos.result }}"
echo " Windows Install: ${{ needs.install-verify-windows.result }}"
echo ""
# Only show Radicle versions if install jobs ran
if [ "${{ needs.changes.outputs.install-scripts }}" == "true" ]; then
echo "Radicle Versions:"
echo " Linux: ${{ needs.install-verify-linux.outputs.rad-version || 'N/A' }}"
echo " macOS: ${{ needs.install-verify-macos.outputs.rad-version || 'N/A' }}"
echo ""
fi
# Fail if check-all failed (always required)
if [ "${{ needs.check-all.result }}" != "success" ]; then
echo "FAIL: Core checks failed"
exit 1
fi
# Fail if install jobs ran and failed (skipped is OK)
if [ "${{ needs.changes.outputs.install-scripts }}" == "true" ]; then
if [ "${{ needs.install-script-syntax.result }}" == "failure" ] || \
[ "${{ needs.install-verify-linux.result }}" == "failure" ] || \
[ "${{ needs.install-verify-macos.result }}" == "failure" ] || \
[ "${{ needs.install-verify-windows.result }}" == "failure" ]; then
echo "FAIL: Install verification failed"
exit 1
fi
fi
echo "SUCCESS: All CI checks passed"