Skip to content

feat(frontend): offer a reload when the server serves a newer build #1272

feat(frontend): offer a reload when the server serves a newer build

feat(frontend): offer a reload when the server serves a newer build #1272

Workflow file for this run

name: E2E Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: whatomate_test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Create test config
run: |
cat > config.toml << 'EOF'
[app]
name = "Whatomate"
environment = "test"
debug = true
[server]
host = "0.0.0.0"
port = 8080
read_timeout = 30
write_timeout = 30
base_path = ""
[database]
host = "localhost"
port = 5432
user = "test"
password = "test"
name = "whatomate_test"
ssl_mode = "disable"
max_open_conns = 25
max_idle_conns = 5
conn_max_lifetime = 300
[redis]
host = "localhost"
port = 6379
username = ""
password = ""
db = 0
tls = false
[jwt]
secret = "test-secret-key-for-ci"
access_expiry_mins = 60
refresh_expiry_days = 7
[storage]
type = "local"
local_path = "./uploads"
EOF
# Build frontend FIRST so it can be embedded in the backend
- name: Install frontend dependencies
run: cd frontend && npm ci
- name: Build frontend
run: cd frontend && npm run build
- name: Copy frontend to embed directory
run: |
rm -rf internal/frontend/dist/*
cp -r frontend/dist/* internal/frontend/dist/
- name: Build backend
run: go build -o whatomate ./cmd/whatomate
- name: Start backend with migrations
run: |
./whatomate server -migrate &
sleep 10
# Verify server is running
curl -f http://localhost:8080/health || exit 1
env:
WHATOMATE_CONFIG: config.toml
- name: Install Playwright browsers
run: cd frontend && npx playwright install chromium --with-deps
- name: Run E2E tests
run: cd frontend && npm run test:e2e
env:
BASE_URL: http://localhost:8080
TEST_DATABASE_URL: postgres://test:test@127.0.0.1:5432/whatomate_test
CI: true
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 7
- name: Upload test screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-screenshots
path: frontend/test-results/
retention-days: 7