-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.25 KB
/
test.yml
File metadata and controls
43 lines (35 loc) · 1.25 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
name: Tests
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20, 22]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run smoke tests
run: npm test
- name: Verify all modules import
run: node -e "import('./index.js').then(m => { const n = Object.keys(m).length; console.log(n + ' exports OK'); if (n < 50) process.exit(1); })"
- name: Verify server starts (Windows only)
if: matrix.os == 'windows-latest'
run: |
$job = Start-Job -ScriptBlock { Set-Location $using:PWD; $env:PORT='3098'; node server.js 2>&1 }
Start-Sleep -Seconds 5
$response = Invoke-WebRequest -Uri http://localhost:3098/api/stats -UseBasicParsing
if ($response.StatusCode -ne 200) { exit 1 }
Write-Host "Server API responded: $($response.StatusCode)"
Stop-Job $job
shell: pwsh