generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (82 loc) · 2.67 KB
/
ci-e2e-test.yaml
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
name: E2E Workflow
on:
workflow_dispatch:
pull_request:
paths:
- 'pkg/**'
- 'e2e/**'
- 'cmd/**'
- 'Dockerfile*'
- 'go.mod'
- 'go.sum'
jobs:
init:
outputs:
tests: ${{ steps.e2es.outputs.result }}
runs-on: [ default ]
name: "Prepare E2E Scenarios"
steps:
- name: "Checkout"
uses: actions/checkout@v4
# find all e2e scenarios in the e2e directory and generate an array of scenario names
- name: "E2E Detection"
id: e2es
run: |
scenarios=$(find ${GITHUB_WORKSPACE}/e2e -type f -name 'e2e_test.go' -exec dirname {} \; | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')
echo $scenarios
echo "result=$scenarios" >> $GITHUB_OUTPUT
e2e:
name: "Run ${{ matrix.e2es }}(${{ matrix.k8s-version}}) E2E"
if: needs.init.outputs.tests != '[]'
needs: [ init ]
runs-on: [ default ]
strategy:
fail-fast: false
matrix:
k8s-version: [ "v1.29.8", "v1.30.4", "v1.31.0" ]
e2es: ${{fromJson(needs.init.outputs.tests)}}
steps:
# run the e2e tests using composite common/workflows/e2e action
- name: "E2E"
id: e2e
uses: cloudoperators/common/workflows/e2e@main
with:
k8s-version: ${{ matrix.k8s-version }}
scenario: ${{ matrix.e2es }}
# v4 upload-artifact needs unique names for each artifact (see https://github.com/actions/upload-artifact/tree/main?tab=readme-ov-file#not-uploading-to-the-same-artifact)
- name: "Upload E2E Logs"
uses: actions/upload-artifact@v4
if: ${{ steps.e2e.outputs.result != '' }} # skip if nothing needs to be uploaded
with:
name: e2e-logs-${{ matrix.e2es }}-${{ matrix.k8s-version }}
path: ${{steps.e2e.outputs.result}}
retention-days: 7
if-no-files-found: ignore
artifacts:
name: "Merge Artifacts"
runs-on: [ default ]
needs: [ e2e ]
steps:
- name: "Merge Uploads"
continue-on-error: true # If there are no artifacts available, the merge step will fail so we need to continue on error
uses: actions/upload-artifact/merge@v4
with:
name: e2e-logs
pattern: e2e-logs-*
retention-days: 7
delete-merged: true
# check if the e2e tests passed for all scenarios
checksOK:
name: "E2E Check"
needs: [ artifacts, e2e ]
runs-on: [ default ]
if: always()
steps:
- name: "Check if e2e passed"
run: |
if [ "${{ needs.e2e.result }}" == "success" ]; then
echo "✅ E2E passed 🎉"
else
echo "❌ E2E failed 😭"
exit 1
fi