forked from traefik/traefik
-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (166 loc) · 6.07 KB
/
Copy pathtest-integration.yaml
File metadata and controls
196 lines (166 loc) · 6.07 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Test Integration
on:
push:
branches:
- master
- v*
pull_request:
branches:
- '*'
paths-ignore:
- 'docs/**'
- '**.md'
- 'script/release/**'
env:
CGO_ENABLED: 0
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: '.go-version'
check-latest: true
cache: false
- name: Go modules cache
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Go build cache
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.mod', '**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-build-
- name: Avoid generating webui
run: |
touch webui/static/index.html
- name: Build binary
run: make binary-linux-amd64
- name: Pre-compile integration test binaries
run: go test -c -o /dev/null ./integration
- name: Artifact traefik binary
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: traefik
path: ./dist/linux/amd64/traefik
retention-days: 1
test-integration:
runs-on: ubuntu-latest
timeout-minutes: 90
needs:
- build
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix:
parallel: [12]
index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
steps:
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: '.go-version'
check-latest: true
cache: false
- name: Download traefik binary
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: traefik
path: ./dist/linux/amd64/
- name: Make binary executable
run: chmod +x ./dist/linux/amd64/traefik
- name: Restore go modules cache
uses: actions/cache/restore@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Restore go build cache
uses: actions/cache/restore@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.mod', '**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-build-
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Find latest timing artifact run
id: latest_run
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
RUN_ID=$(gh api \
"/repos/${{ github.repository }}/actions/artifacts?name=integration-test-summary&per_page=1" \
--jq '.artifacts[0].workflow_run.id // ""')
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
- name: Download previous test timing data
if: steps.latest_run.outputs.run_id != ''
continue-on-error: true
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: integration-test-summary
run-id: ${{ steps.latest_run.outputs.run_id }}
github-token: ${{ github.token }}
- name: Ensure timing data exists
run: |
[ -f integration-test-summary.xml ] || echo '<?xml version="1.0" encoding="UTF-8"?><testsuites></testsuites>' > integration-test-summary.xml
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/go-test-split-action@3b2b67379b94f6bea96556b2e4e15929b57c10cf # v2.0.3
with:
packages: ./integration
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
junit-summary: ${{ github.workspace }}/integration-test-summary.xml
- name: Run Integration tests
run: |
TESTS=$(echo "${{ steps.test_split.outputs.run}}" | sed 's/\$/\$\$/g')
gotestsum --junitfile shard-${{ matrix.index }}-results.xml --packages ./integration -- -test.timeout=20m -v -run "${TESTS}"
- name: Upload shard test results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: integration-shard-${{ matrix.index }}-results
path: shard-${{ matrix.index }}-results.xml
retention-days: 7
merge-test-results:
runs-on: ubuntu-latest
needs:
- test-integration
if: ${{ !cancelled() && needs.test-integration.result != 'skipped' }}
steps:
- name: Download all shard results
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
pattern: integration-shard-*-results
merge-multiple: true
- name: Merge JUnit XML results
run: npx --yes junit-report-merger@9.0.3 integration-test-summary.xml shard-*-results.xml
- name: Upload merged test summary
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: integration-test-summary
path: integration-test-summary.xml
retention-days: 30