name: Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['18', '20', '22']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test basic functionality (Unix)
if: runner.os != 'Windows'
run: |
node dist/index.js --list-scripts
echo "Testing --verbose flag..."
node dist/index.js --verbose &
pid=$!
sleep 5
kill $pid || true
wait $pid || true
shell: bash
- name: Test basic functionality (Windows)
if: runner.os == 'Windows'
run: |
node dist/index.js --list-scripts
Write-Host "Testing --verbose flag..."
$p = Start-Process node -ArgumentList @('dist/index.js', '--verbose') -PassThru
Start-Sleep -Seconds 5
try {
if (-not $p.HasExited) { Stop-Process -Id $p.Id -Force }
} catch {
Write-Host "Process already exited."
}
shell: pwsh