-
Notifications
You must be signed in to change notification settings - Fork 94
321 lines (275 loc) · 11.3 KB
/
end-to-end-test.yml
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
name: E2E Test
# This workflow executes end-to-end tests and verifies that the binaries are buildable
# The workflow is executed on latest main commits, pull requests which are labeled 'run-e2e-test', and nightly.
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 * * *' # nightly build ensure E2E tests run daily and catch any breaking API changes
pull_request_target:
types: [ labeled ]
defaults:
run:
shell: bash
jobs:
setup:
name: Setup variables
if: github.repository == 'Dynatrace/dynatrace-configuration-as-code'
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
sha: ${{ steps.write.outputs.sha }} # sha contains the correct sha for followup jobs to use
steps:
- name: Fetch base repo sha
if: github.event.action == 'labeled' && (github.event.label.name == 'run-e2e-test' || github.event.label.name == 'run-iam-test')
run: echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Fetch event sha
if: github.event.action != 'labeled'
run: echo "sha=$GITHUB_SHA" >> $GITHUB_ENV
- id: write
name: Store sha
run: echo "sha=$sha" >> $GITHUB_OUTPUT
release-binaries:
name: 🏁 Build release binaries
needs: [setup]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🏁 Build release binaries
run: make build-release
integration-test:
name: 🌎 Integration tests
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🌎 Integration test
run: make integration-test testopts="--junitfile test-result-integration.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration
path: test-result-*.xml
legacy-integration-tests:
name: 🧓 Legacy integration tests
needs: [setup]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🧓 Integration test (legacy)
run: make integration-test-v1 testopts="--junitfile test-result-integration-legacy.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration Legacy
path: test-result-*.xml
download-restore-test:
name: 📥/📤 Download-restore-test
needs: [setup]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 📥/📤 Download/Restore test
run: make download-restore-test testopts="--junitfile test-result-integration-download-restore.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration Download
path: test-result-*.xml
account-management-test:
name: 🗂️ Account Management E2E tests
if: github.event.label.name == 'run-iam-test'
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🗂️ Account Management E2E tests
run: make account-management-test testopts="--junitfile test-result-aim.xml"
env:
ACCOUNT_UUID: ${{ secrets.ACCOUNT_UUID }}
ACCOUNT_OAUTH_CLIENT_ID: ${{ secrets.ACCOUNT_OAUTH_CLIENT_ID }}
ACCOUNT_OAUTH_CLIENT_SECRET: ${{ secrets.ACCOUNT_OAUTH_CLIENT_SECRET }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Account Management
path: test-result-*.xml
windows-unit-tests:
name: 🪟 Windows tests
needs: [ setup ]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🧪 Unit test
run: make test testopts="--junitfile test-result-windows-latest-unit.xml"
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Unit Windows
path: test-result-*.xml
nightly-run:
name: 🌜 Nightly test & 🧹 Cleanup
needs: [setup] # It does not need it strictly, but we filter based on the repository in the setup step
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Check out base repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🌜 Nightly Tests
run: make nightly-test testopts="--junitfile test-result-integration-nightly.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: 🧹 Cleanup
run: make clean-environments
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration Nightly
path: test-result-*.xml
- name: Trigger Dynatrace Workflow on Failure
if: failure()
run: |
curl \
-H 'Authorization: Bearer ${{ secrets.SFM_OAUTH_SECRET }}' \
-X POST https://${{secrets.SFM_TENANT_URL}}/platform/automation/v1/workflows/${{secrets.SFM_WORKFLOW_ID}}/run
upload_event:
name: "Upload Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
with:
name: event_file
path: ${{ github.event_path }}