-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (64 loc) · 2.59 KB
/
Copy pathootb.yml
File metadata and controls
73 lines (64 loc) · 2.59 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
name: ootb
on:
push:
branches: [main, refactor/**]
pull_request:
branches: [main, refactor/**]
jobs:
smoke: # 冒烟测试
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
# 默认 CI Node 唯一来源: 仓库根 .node-version(与 npm-publish 共用)。
# db-server 需 ≥22.13(node:sqlite 无 flag)
node-version-file: .node-version
cache: npm
- name: Install root deps
shell: pwsh
run: npm ci --no-audit --no-fund
- name: Build all workspaces
shell: pwsh
run: npm run build --workspaces --if-present
- name: Seed configs via SDK ensure # 测试:播种配置文件
shell: pwsh
env:
SFMC_ROOT: ${{ github.workspace }}
run: |
New-Item -ItemType Directory -Force -Path configs | Out-Null
node tools/seed-configs.mjs
Get-ChildItem configs -Filter *.json | ForEach-Object { Write-Host "seeded $($_.Name)" }
- name: Run check-ootb # 平台自检
shell: pwsh
env:
SFMC_ROOT: ${{ github.workspace }}
run: npm run check-ootb
- name: Run smoke-modules (against temporary db-server)# db-server测试
shell: pwsh
env:
SFMC_ROOT: ${{ github.workspace }}
run: |
$port = if ($env:DB_PORT) { $env:DB_PORT } else { '3001' }
if (Get-NetTCPConnection -LocalPort $port -ErrorAction SilentlyContinue) {
Get-NetTCPConnection -LocalPort $port | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
Start-Sleep -Seconds 2
}
$db = Start-Process -FilePath node -ArgumentList "db-server/dist/index.js" -WorkingDirectory $PWD -WindowStyle Hidden -RedirectStandardOutput "db-server/_smoke.out" -RedirectStandardError "db-server/_smoke.err" -PassThru
try {
$ready = $false
for ($i=0; $i -lt 40; $i++) {
try {
$r = Invoke-WebRequest -UseBasicParsing "http://127.0.0.1:$port/api/health" -TimeoutSec 2
if ($r.StatusCode -eq 200) { $ready = $true; break }
} catch {}
Start-Sleep -Milliseconds 300
}
if (-not $ready) { throw "db-server not ready" }
npm run smoke-modules
} finally {
Stop-Process -Id $db.Id -Force -ErrorAction SilentlyContinue
Remove-Item -Force db-server/_smoke.out,db-server/_smoke.err -ErrorAction SilentlyContinue
}