-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (110 loc) · 3.61 KB
/
Copy pathe2e.yml
File metadata and controls
128 lines (110 loc) · 3.61 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
name: E2E Tests
# Run E2E tests separately from main CI to avoid blocking PRs with flaky tests
# These tests may be unstable due to timing, process management, or runner environment
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
on:
# Manual trigger
workflow_dispatch:
inputs:
test_filter:
description: 'Test filter pattern (e.g., TestDaemonAutoRestart)'
required: false
default: ''
# Nightly run
schedule:
- cron: '0 2 * * *' # 2 AM UTC daily
# Run after PR merge to main
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]
jobs:
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
# Only run on workflow_run if CI passed
if: |
github.event_name != 'workflow_run' ||
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Build Web UI
working-directory: web
run: |
npm ci
npm run build
- name: Read Go version
id: goversion
run: echo "version=$(grep '^go ' go.mod | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.goversion.outputs.version }}
- name: Build binary
run: go build -o bin/zen .
- name: Run E2E Tests
run: |
if [ -n "${{ github.event.inputs.test_filter }}" ]; then
go test -v -timeout 600s -run "${{ github.event.inputs.test_filter }}" ./tests/...
else
go test -v -timeout 600s ./tests/...
fi
# Note: SKIP_FLAKY_TESTS is not set, so E2E tests will run
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-results
path: |
*.log
/tmp/zen-*
retention-days: 7
- name: Comment on PR (if triggered by workflow_run)
if: github.event_name == 'workflow_run' && failure()
uses: actions/github-script@v7
with:
script: |
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const message = `⚠️ E2E tests failed after merge to main.\n\n[View run](${runUrl})`;
// Find the PR that was merged
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
sort: 'updated',
direction: 'desc',
per_page: 10
});
const mergedPR = prs.find(pr =>
pr.merge_commit_sha === context.payload.workflow_run.head_sha
);
if (mergedPR) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: mergedPR.number,
body: message
});
}
# Summary job for easy status checking
e2e-summary:
name: E2E Summary
runs-on: ubuntu-latest
needs: [e2e-tests]
if: always()
steps:
- name: Check E2E results
run: |
if [ "${{ needs.e2e-tests.result }}" == "success" ]; then
echo "✅ All E2E tests passed"
exit 0
elif [ "${{ needs.e2e-tests.result }}" == "failure" ]; then
echo "❌ E2E tests failed"
exit 1
else
echo "⚠️ E2E tests were skipped or cancelled"
exit 0
fi