Skip to content

Commit db50977

Browse files
committed
add e2e tests pipeline
1 parent 78f5a9b commit db50977

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: End-to-End Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch: # Allow manual triggering
7+
8+
jobs:
9+
e2e:
10+
name: End-to-End Tests
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.24'
22+
check-latest: true
23+
24+
- name: Cache Go modules and build cache
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.cache/go-build
29+
~/go/pkg/mod
30+
key: ${{ runner.os }}-go-e2e-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-e2e-
33+
${{ runner.os }}-go-
34+
35+
- name: Download Go modules
36+
run: go mod download
37+
38+
- name: Build fetchr binary
39+
run: make build
40+
41+
- name: Run end-to-end tests
42+
run: |
43+
echo "🚀 Starting end-to-end tests..."
44+
make e2e
45+
env:
46+
GO_TEST_TIMEOUT: 10m
47+
48+
- name: Upload test results
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: e2e-test-results
53+
path: |
54+
coverage.txt
55+
*.log
56+
retention-days: 30
57+
58+
- name: Comment PR on failure
59+
if: failure() && github.event_name == 'push'
60+
uses: actions/github-script@v7
61+
with:
62+
script: |
63+
const { owner, repo } = context.repo;
64+
const { sha } = context;
65+
66+
// Find recent commits to identify potential related PRs
67+
const commits = await github.rest.repos.listCommits({
68+
owner,
69+
repo,
70+
sha,
71+
per_page: 5
72+
});
73+
74+
const commit = commits.data[0];
75+
const commitMessage = commit.commit.message;
76+
77+
// Create an issue to track the failure
78+
await github.rest.issues.create({
79+
owner,
80+
repo,
81+
title: `🚨 E2E Tests Failed on Main Branch (${sha.substring(0, 7)})`,
82+
body: `
83+
## E2E Test Failure Report
84+
85+
**Commit**: ${sha}
86+
**Commit Message**: ${commitMessage}
87+
**Branch**: main
88+
**Workflow**: [End-to-End Tests](${context.payload.repository.html_url}/actions/runs/${context.runId})
89+
90+
The end-to-end tests failed after merging to the main branch. This indicates that the latest changes may have introduced issues with the core proxy functionality.
91+
92+
### Next Steps
93+
1. Review the [failed workflow logs](${context.payload.repository.html_url}/actions/runs/${context.runId})
94+
2. Check if this is a flaky test or a real issue
95+
3. If it's a real issue, consider creating a hotfix
96+
4. Update tests if the failure is due to intended changes
97+
98+
### Test Results
99+
Check the uploaded artifacts for detailed test results and coverage information.
100+
101+
cc: @${context.actor}
102+
`,
103+
labels: ['bug', 'e2e-failure', 'urgent']
104+
});
105+
106+
notify:
107+
name: Notify on E2E Success
108+
runs-on: ubuntu-latest
109+
needs: e2e
110+
if: success()
111+
steps:
112+
- name: Success notification
113+
run: |
114+
echo "✅ All end-to-end tests passed successfully!"
115+
echo "The main branch is stable and ready for use."

0 commit comments

Comments
 (0)