Repository navigation
132 lines (109 loc) · 3.67 KB
/
Copy pathclient-e2e-tests.yml
File metadata and controls
132 lines (109 loc) · 3.67 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
name: Client E2E Tests
on:
push:
branches: [develop]
paths:
- "client/**"
- ".github/workflows/client-e2e-tests.yml"
pull_request:
paths:
- "client/**"
- ".github/workflows/client-e2e-tests.yml"
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: client
jobs:
e2e-tests:
name: Playwright E2E Tests
runs-on: ubuntu-24.04
timeout-minutes: 30
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: amazonia360_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/amazonia360_test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
- name: Install API dependencies
working-directory: api
run: uv sync --frozen
- name: Create minimal grid data
run: |
mkdir -p /tmp/grid-tiles
echo '{"datasets":[],"h3_grid_info":[]}' > /tmp/grid-tiles/meta.json
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "client/.nvmrc"
- name: Setup pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('client/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Cache Next.js build
uses: actions/cache@v4
with:
path: client/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('client/pnpm-lock.yaml') }}-${{ hashFiles('client/src/**/*.ts', 'client/src/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('client/pnpm-lock.yaml') }}-
- name: Install client dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm exec playwright install chromium --with-deps
- name: Run Payload migrations
run: |
set -a; . ./.env.test; set +a
export DATABASE_URL="${{ env.DATABASE_URL }}"
pnpm db:migrate
# db:migrate already refuses to report a no-op as success. This stays as the
# independent check: it reads the database rather than the CLI's own output.
- name: Verify schema was created
run: psql "$DATABASE_URL" -c "SELECT 1 FROM payload_migrations LIMIT 1" -c "SELECT 1 FROM users LIMIT 1" || { echo "::error::payload migrate did not apply migrations"; exit 1; }
- name: Seed the catalogue
run: |
set -a; . ./.env.test; set +a
export DATABASE_URL="${{ env.DATABASE_URL }}"
pnpm db:seed
- name: Run E2E tests
run: pnpm test:e2e
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: client/e2e/playwright-report/
retention-days: 14
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-test-results
path: client/e2e/test-results/
retention-days: 7