forked from crossplane-contrib/provider-upjet-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (137 loc) · 5.13 KB
/
uptest-all.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
name: Uptest All
on:
workflow_dispatch: {}
env:
# Common versions
GO_VERSION: '1.21'
DOCKER_BUILDX_VERSION: 'v0.8.2'
jobs:
detect-api-groups:
runs-on: ubuntu-22.04
outputs:
api_groups: ${{ steps.api-groups.outputs.list }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
submodules: true
- name: Detect Api Groups
id: api-groups
run: |
export API_GROUPS=""
for i in $(ls -d examples/*/); do API_GROUPS="${API_GROUPS},${i}"; done
OUTPUT=$(python3 -c "\
import os, sys; \
value = os.getenv('API_GROUPS'); \
list = value.split(','); \
print(list[1:]); \
")
echo "Api Groups: $OUTPUT"
echo "list=${OUTPUT}" >> $GITHUB_OUTPUT
uptest:
runs-on: ubuntu-22.04
needs: detect-api-groups
strategy:
fail-fast: false
matrix:
api-groups: ${{ fromJson(needs.detect-api-groups.outputs.api_groups) }}
exclude:
- api-groups: examples/providerconfig/
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-uptest-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-uptest-
- name: Cache Go Dependencies
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Build Artifacts
run: make -j2 build.all
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
- name: Prepare The Example List
id: prepare-example-list
run: |
cd ..
EXAMPLE_LIST=""
EXAMPLE_LIST="${EXAMPLE_LIST},$(find ${{ matrix.api-groups }} -name '*.yaml' | tr '\n' ',')"
echo "example-list=${EXAMPLE_LIST:1}" >> $GITHUB_OUTPUT
echo "Examples: ${EXAMPLE_LIST:1}"
- name: Run Uptest
id: run-uptest
env:
UPTEST_AWS_CREDS: ${{ secrets.UPTEST_AWS_CREDS }}
EXAMPLE_LIST: ${{ needs.get-example-list.outputs.example_list }}
UPTEST_EXAMPLE_VALUE_REPLACEMENTS: ${{ secrets.UPTEST_EXAMPLE_VALUE_REPLACEMENTS }}
DUMP_DIRECTORY: "./_output/cluster-dump"
run: make uptest
- name: Collect Cluster Dump
if: always()
run: |
export DUMP_DIRECTORY=./_output/cluster-dump
make cluster_dump
- name: Upload Cluster Dump
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
with:
name: cluster-dump-aws
path: ./_output/cluster-dump
- name: Cleanup
if: always()
run: |
kubectl delete managed --all
report:
runs-on: ubuntu-22.04
needs: uptest
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
submodules: true
- name: Manual Intervention Report
run: |
echo "Total Resources for AWS: $(cat examples/*/* | grep -o "kind: " | wc -l)"
echo "Number of Skipped Resources: $(grep -r -o "upjet.upbound.io/manual-intervention" examples/* | wc -l)"
echo "Skipped Manifests (Manual Intervention): $(grep -r -o "upjet.upbound.io/manual-intervention" examples/*)"
- name: Coverage Report
run: |
OUTPUT=$(gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq '.jobs | .[] | select(.name!="detect-api-groups" and .name!="report") | .name + " -> " + .conclusion')
FAILURE=$(echo ${OUTPUT} | grep -o 'failure' | wc -l)
SUCCESS=$(echo ${OUTPUT} | grep -o 'success' | wc -l)
echo "Success: ${SUCCESS}"
echo "Failure: ${FAILURE}"
echo "${OUTPUT}"