forked from ganto/pkgproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (120 loc) · 3.94 KB
/
Copy pathe2e.yaml
File metadata and controls
133 lines (120 loc) · 3.94 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
131
132
133
---
name: E2E Tests
# Trigger design (intentional — do not "fix" by running e2e on PR events):
#
# The e2e matrix is slow, so it must not run on every push to a PR. It runs
# once per PR, via manual workflow_dispatch by a maintainer, when the PR is
# ready to merge.
#
# To gate merging on that manual run, every PR event sets the "e2e" commit
# status to pending (set-pending job), and the dispatched run reports the
# result back (report-status job) so the merge check can pass.
#
# pull_request_target is only used because posting a commit status requires
# a write-capable GITHUB_TOKEN, also for fork PRs. Since that token is
# privileged, the set-pending job must never check out or execute PR code.
on:
workflow_dispatch:
pull_request_target:
permissions: {}
jobs:
set-pending:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
name: Set pending e2e status
permissions:
statuses: write # for gh api to set the commit status
steps:
- name: Set pending e2e status
run: |
gh api "repos/${REPO}/statuses/${HEAD_SHA}" \
-f state="pending" \
-f context="e2e" \
-f description="E2E tests must be triggered manually via workflow_dispatch"
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
e2e:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout to fetch code
timeout-minutes: ${{ matrix.timeout || 5 }}
strategy:
fail-fast: false
matrix:
include:
- name: Fedora 43
test: TestFedora
release: "43"
- name: CentOS Stream 10
test: TestCentOSStream
release: "10"
- name: AlmaLinux 10
test: TestAlmaLinux
release: "10"
- name: Rocky Linux 10
test: TestRockyLinux
release: "10"
- name: Debian trixie
test: TestDebian
release: trixie
- name: Ubuntu noble
test: TestUbuntu
release: noble
- name: Arch Linux latest
test: TestArch
release: latest
- name: Gentoo latest
test: TestGentoo
release: latest
timeout: 10
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 'stable'
check-latest: true
- name: Run e2e test
env:
E2E_RELEASE: ${{ matrix.release }}
CONTAINER_RUNTIME: docker
run: go test -tags e2e -v -race -timeout ${{ matrix.timeout || 5 }}m -run ${{ matrix.test }} ./test/e2e/
report-status:
if: always() && github.event_name == 'workflow_dispatch'
needs: [e2e]
runs-on: ubuntu-latest
name: Report e2e status
permissions:
statuses: write # for gh api to set the commit status
steps:
- name: Report e2e status
run: |
case "${{ needs.e2e.result }}" in
success)
state="success"
description="All E2E tests passed"
;;
cancelled)
state="error"
description="E2E tests were cancelled"
;;
skipped)
state="error"
description="E2E tests were skipped"
;;
*)
state="failure"
description="E2E tests failed"
;;
esac
gh api "repos/${{ github.repository }}/statuses/${{ github.sha }}" \
-f state="$state" \
-f context="e2e" \
-f description="$description"
env:
GH_TOKEN: ${{ github.token }}