-
Notifications
You must be signed in to change notification settings - Fork 8
137 lines (115 loc) · 3.96 KB
/
e2e-tests.yml
File metadata and controls
137 lines (115 loc) · 3.96 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: E2E Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
permissions:
contents: read
actions: read
concurrency:
group: e2e-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
e2e:
name: Playwright E2E
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: reqcore
POSTGRES_PASSWORD: reqcore-ci
POSTGRES_DB: reqcore
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U reqcore -d reqcore"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DATABASE_URL: postgresql://reqcore:reqcore-ci@localhost:5432/reqcore
BETTER_AUTH_SECRET: ci-test-secret-that-is-at-least-32-chars-long
BETTER_AUTH_URL: http://localhost:3000
NUXT_PUBLIC_SITE_URL: http://localhost:3000
# MinIO provides S3-compatible file storage for E2E tests
S3_ENDPOINT: http://localhost:9000
S3_ACCESS_KEY: minioadmin
S3_SECRET_KEY: minioadmin
S3_BUCKET: reqcore
S3_REGION: us-east-1
S3_FORCE_PATH_STYLE: "true"
steps:
- name: Start MinIO
run: |
docker run -d \
--name minio-ci \
-p 9000:9000 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
minio/minio:latest server /data
timeout 30 sh -c 'until curl -sf http://localhost:9000/minio/health/live; do sleep 2; done'
AWS_ACCESS_KEY_ID=minioadmin \
AWS_SECRET_ACCESS_KEY=minioadmin \
aws s3 mb s3://reqcore \
--endpoint-url http://localhost:9000 \
--region us-east-1
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Push database schema
run: npx drizzle-kit push
- name: Build Nuxt application
run: npm run build
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Start application server
run: node .output/server/index.mjs &
env:
PORT: 3000
NODE_ENV: production
- name: Wait for server to be ready
run: npx wait-on http://localhost:3000 --timeout 30000
- name: Run Playwright tests
id: playwright
run: npx playwright test
env:
PLAYWRIGHT_BASE_URL: http://localhost:3000
CI: true
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 14
- name: Upload test results
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: test-results
path: test-results/
retention-days: 14
- name: E2E Test Summary
if: ${{ !cancelled() }}
run: |
echo "## E2E Test Results" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
if [ "${{ steps.playwright.outcome }}" = "success" ]; then
echo "✅ **All Playwright tests passed**" >> "$GITHUB_STEP_SUMMARY"
else
echo "❌ **Playwright tests failed**" >> "$GITHUB_STEP_SUMMARY"
fi
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Report | Link |" >> "$GITHUB_STEP_SUMMARY"
echo "|--------|------|" >> "$GITHUB_STEP_SUMMARY"
echo "| Playwright HTML | 📦 Download \`playwright-report\` artifact |" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "_Run: \`${{ github.run_id }}\` · Commit: \`${{ github.sha }}\`_" >> "$GITHUB_STEP_SUMMARY"