fix:scripts #5
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: | |
| node-version: '20' | |
| - name: Install SAPI dependencies | |
| shell: pwsh | |
| run: | | |
| cd scriptsforminecraftserver | |
| npm install --no-audit --no-fund | |
| - name: Run check-ootb | |
| shell: pwsh | |
| run: node tools/check-ootb.js | |
| - 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 | |
| } | |
| $db = Start-Process -FilePath node -ArgumentList "db-server/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.js | |
| } finally { | |
| Stop-Process -Id $db.Id -Force -ErrorAction SilentlyContinue | |
| Remove-Item -Force db-server/_smoke.out,db-server/_smoke.err -ErrorAction SilentlyContinue | |
| } |