66 lines
1.4 KiB
YAML
66 lines
1.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, rewrite, feat]
|
|
pull_request:
|
|
branches: [main, rewrite, feat]
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Run unit tests
|
|
run: npm run test
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
- name: Start dev server
|
|
run: npm run dev &
|
|
env:
|
|
HOST: 0.0.0.0
|
|
PORT: 5173
|
|
|
|
- name: Wait for dev server
|
|
run: |
|
|
echo "Waiting for dev server to start..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:5173 > /dev/null 2>&1; then
|
|
echo "Dev server is ready!"
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
echo "Dev server failed to start"
|
|
exit 1
|
|
|
|
- name: Run E2E tests
|
|
run: npm run test:e2e
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: test-results/
|