fix(ci): ootb@72e24e7 npm install 崩溃 — 清悬空 lock + registry/unzip 契约对齐 #51
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| # db-server imports `node:sqlite` at module scope. That builtin is | |
| # gated behind --experimental-sqlite on 22.5.0-22.12.x and only | |
| # became available unflagged from 22.13.0 onward — pinning to | |
| # '22.5' here made db-server crash on import on every run. | |
| node-version: '22.13' | |
| - name: Install root deps | |
| shell: pwsh | |
| run: npm install --no-audit --no-fund | |
| - name: Build all workspaces | |
| shell: pwsh | |
| run: npm run build --workspaces --if-present | |
| - name: Seed configs/ from configs-default/ | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path configs | Out-Null | |
| Get-ChildItem -Path configs-default -Filter *.json | ForEach-Object { | |
| $dest = Join-Path configs $_.Name | |
| if (-not (Test-Path $dest)) { Copy-Item $_.FullName $dest } | |
| } | |
| - name: Run check-ootb | |
| shell: pwsh | |
| run: node tools/check-ootb.mjs | |
| - name: Run smoke-modules (against temporary db-server) | |
| shell: pwsh | |
| 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 | |
| } | |
| $env:SFMC_ROOT = $PWD.Path | |
| $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" } | |
| node tools/smoke-modules.mjs | |
| } finally { | |
| Stop-Process -Id $db.Id -Force -ErrorAction SilentlyContinue | |
| Remove-Item -Force db-server/_smoke.out,db-server/_smoke.err -ErrorAction SilentlyContinue | |
| } |