Skip to content

Commit 28c7da8

Browse files
committed
github-workflows: Ensure e2e workflow can be used as merge checks
1 parent 272365b commit 28c7da8

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/e2e.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,30 @@ name: E2E Tests
33

44
on:
55
workflow_dispatch:
6+
pull_request:
67

78
permissions:
89
contents: read
10+
statuses: write
911

1012
jobs:
1113

14+
set-pending:
15+
if: github.event_name == 'pull_request'
16+
runs-on: ubuntu-latest
17+
name: Set pending e2e status
18+
steps:
19+
- name: Set pending e2e status
20+
run: |
21+
gh api "repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}" \
22+
-f state="pending" \
23+
-f context="e2e" \
24+
-f description="E2E tests must be triggered manually via workflow_dispatch"
25+
env:
26+
GH_TOKEN: ${{ github.token }}
27+
1228
e2e:
29+
if: github.event_name == 'workflow_dispatch'
1330
runs-on: ubuntu-latest
1431
timeout-minutes: 5
1532

@@ -55,3 +72,25 @@ jobs:
5572
E2E_RELEASE: ${{ matrix.release }}
5673
CONTAINER_RUNTIME: docker
5774
run: go test -tags e2e -v -race -timeout 5m -run ${{ matrix.test }} ./test/e2e/
75+
76+
report-status:
77+
if: always() && github.event_name == 'workflow_dispatch'
78+
needs: [e2e]
79+
runs-on: ubuntu-latest
80+
name: Report e2e status
81+
steps:
82+
- name: Report e2e status
83+
run: |
84+
if [ "${{ needs.e2e.result }}" = "success" ]; then
85+
state="success"
86+
description="All E2E tests passed"
87+
else
88+
state="failure"
89+
description="E2E tests failed"
90+
fi
91+
gh api "repos/${{ github.repository }}/statuses/${{ github.sha }}" \
92+
-f state="$state" \
93+
-f context="e2e" \
94+
-f description="$description"
95+
env:
96+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)