forked from lobehub/lobehub
-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (108 loc) · 4.3 KB
/
claude-auto-e2e-testing.yml
File metadata and controls
130 lines (108 loc) · 4.3 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
name: Claude Auto E2E Testing
description: Automatically add E2E tests to improve user journey coverage
on:
schedule:
# Run daily at 21:00 UTC (05:00 Beijing Time)
- cron: '0 21 * * *'
workflow_dispatch:
inputs:
target_module:
description: 'Specific module/feature to add E2E tests (e.g., agent/conversation, knowledge/rag)'
required: false
type: string
concurrency:
group: auto-e2e-testing
cancel-in-progress: false
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
DATABASE_DRIVER: node
KEY_VAULTS_SECRET: LA7n9k3JdEcbSgml2sxfw+4TV1AzaaFU5+R176aQz4s=
AUTH_SECRET: e2e-test-secret-key-for-better-auth-32chars!
AUTH_EMAIL_VERIFICATION: '0'
S3_ACCESS_KEY_ID: e2e-mock-access-key
S3_SECRET_ACCESS_KEY: e2e-mock-secret-key
S3_BUCKET: e2e-mock-bucket
S3_ENDPOINT: https://e2e-mock-s3.localhost
jobs:
add-e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
pull-requests: write
id-token: write
services:
postgres:
image: paradedb/paradedb:latest
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright browsers (with system deps)
run: bunx playwright install --with-deps chromium
- name: Run database migrations
run: bun run db:migrate
- name: Build application
run: bun run build
env:
SKIP_LINT: '1'
- name: Configure Git
run: |
git config --global user.name "claude-bot[bot]"
git config --global user.email "claude-bot[bot]@users.noreply.github.com"
- name: Copy prompts
run: |
mkdir -p /tmp/claude-prompts
cp .claude/prompts/auto-e2e-testing.md /tmp/claude-prompts/
cp .claude/prompts/security-rules.md /tmp/claude-prompts/
cp e2e/CLAUDE.md /tmp/claude-prompts/e2e-guide.md
- name: Run Claude Code for Auto E2E Testing
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ secrets.GH_TOKEN }}
allowed_non_write_users: '*'
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: |
--allowedTools "Bash,Read,Edit,Write,Glob,Grep"
--append-system-prompt "$(cat /tmp/claude-prompts/security-rules.md)"
prompt: |
Follow the auto E2E testing guide located at:
```bash
cat /tmp/claude-prompts/auto-e2e-testing.md
```
Also read the E2E testing reference guide:
```bash
cat /tmp/claude-prompts/e2e-guide.md
```
## Task Assignment
${{ inputs.target_module && format('Process the specified module/feature: {0}', inputs.target_module) || 'Automatically select one module/feature from the product modules table that needs E2E coverage' }}
## Environment Information
- Repository: ${{ github.repository }}
- Branch: ${{ github.ref_name }}
- Target Module: ${{ inputs.target_module || 'Auto-select' }}
- Run ID: ${{ github.run_id }}
## E2E Runtime Environment
- PostgreSQL is running at localhost:5432 (user: postgres, password: postgres)
- Application has been built and is ready to start
- Playwright chromium is installed
- To start the server for E2E tests, run: `bunx next start -p 3006 &` from the project root, then wait for it to be ready
- Run E2E tests with: `cd e2e && BASE_URL=http://localhost:3006 pnpm exec cucumber-js --config cucumber.config.js --tags "<your-tags>"`
**Start the auto E2E testing process now.**
- name: Upload E2E test artifacts (on failure)
if: failure()
uses: actions/upload-artifact@v6
with:
name: e2e-artifacts
path: |
e2e/reports
e2e/screenshots
if-no-files-found: ignore