Repository navigation
111 lines (96 loc) · 3.96 KB
/
Copy pathe2e.yml
File metadata and controls
111 lines (96 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
name: E2E
on:
push:
branches: [main]
paths-ignore:
- "apps/website/**"
- "docs/**"
- "plans/**"
- "**/*.md"
pull_request:
branches: [main]
paths-ignore:
- "apps/website/**"
- "docs/**"
- "plans/**"
- "**/*.md"
workflow_dispatch:
permissions:
contents: read
# Not test.yml's test-db-<ref> group: GitHub keeps one pending run per group,
# so a queued e2e run would cancel a pending Test run, and deploy-api.yml
# deploys only when Test completes. e2e runs on its own Neon branch,
# ci-<sha7>-<run_id>-<run_attempt>, made by the first step below and deleted by
# the last, so it shares no database with a Test run. On the TEST_DATABASE_URL
# fallback it only inserts uniquely named rows (a fresh owner and org per run),
# so it still can't delete a fixture test-web reads.
concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
e2e:
# Forks get no secrets; the setup test needs the database and the model key.
if: github.repository == 'wraps-team/wraps'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Setup Node.js 24.x
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.x
cache: 'pnpm'
# This run's own Neon branch (scripts/test-db/ci-branch.mjs). Before
# install: it needs only Node. It never fails the job; on any problem it
# warns and the tests below fall back to TEST_DATABASE_URL.
- name: Per-run Neon test branch
run: node scripts/test-db/ci-branch.mjs ensure
env:
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }}
TEST_DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Brings the branch to this commit's schema. Skipped when ensure fell
# back, so the shared database is never pushed to from CI.
- name: Push the schema to the per-run branch
run: node scripts/test-db/ci-branch.mjs push
- name: Build web workspace dependencies
run: pnpm --filter "@wraps/web^..." build
- name: Install Chromium
run: pnpm --filter @wraps/e2e exec e2e-web install chromium --with-deps
# Replays the committed recordings in apps/e2e/.e2e/cache (read-only in
# CI). A step whose recording no longer matches the UI falls back to the
# live agent, which is what the model key is for.
- name: Run e2e
run: pnpm test:e2e --reporter list,junit
env:
DATABASE_URL: ${{ env.CI_DATABASE_URL || secrets.TEST_DATABASE_URL }}
BETTER_AUTH_SECRET: test-secret-key-for-testing-only
AI_GATEWAY_API_KEY: ${{ secrets.AI_GATEWAY_API_KEY }}
# Not .e2e/logs: the app log is written unredacted, and artifacts on a
# public repo are downloadable by anyone signed in.
- name: Upload report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: e2e-report
path: |
apps/e2e/.e2e/report.json
apps/e2e/.e2e/junit.xml
apps/e2e/.e2e/results
if-no-files-found: warn
retention-days: 7
# Runs even when the job fails or is cancelled. A failed delete only
# warns; Neon expires the branch 3h after creation regardless.
- name: Delete this run's Neon branch
if: always()
continue-on-error: true
timeout-minutes: 2
run: node scripts/test-db/ci-branch.mjs delete
env:
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }}