-
Notifications
You must be signed in to change notification settings - Fork 9
205 lines (187 loc) · 5.85 KB
/
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
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
---
name: Test
on:
- pull_request
- push
jobs:
#
# unit testing
#
unit-test:
name: Unit Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# NOTE: we may test on multiple versions here when a future version of go releases, but
# for now we can leave this as a single array.
- go-version: "1.22"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run Test
uses: ./.github/common-actions/unit-test
#
# build and store artifact
#
build:
name: Build
runs-on: ubuntu-latest
needs: unit-test
strategy:
fail-fast: false
matrix:
include:
# NOTE: we may test on multiple versions here when a future version of go releases, but
# for now we can leave this as a single array.
- go-version: "1.22"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build Binary Artifact (operator-builder)
run: make build
- name: Store Artifact
uses: actions/upload-artifact@v4
with:
name: operator-builder-${{ matrix.go-version }}
path: bin/operator-builder
#
# functional test
#
functional-test:
name: Functional Test
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
include:
- name: Standalone Operator (Current Go Version)
artifact: standalone-codebase
test-workload-path: test/cases/standalone
go-version: "1.22"
binary-go-version: "1.22"
- name: Standalone Edge Cases Operator (Current Go Version - 1)
artifact: standalone-edge-codebase
test-workload-path: test/cases/edge-standalone
go-version: "1.21"
binary-go-version: "1.22"
- name: Workload Collection Operator (Current Go Version)
artifact: collection-codebase
test-workload-path: test/cases/collection
go-version: "1.22"
binary-go-version: "1.22"
- name: Workload Collection Edge Cases Operator (Current Go Version - 1)
artifact: collection-edge-codebase
test-workload-path: test/cases/edge-collection
go-version: "1.21"
binary-go-version: "1.22"
env:
TEST_WORKLOAD_PATH: "${{ matrix.test-workload-path }}"
TEST_PATH: "/tmp/operator-builder-func-test"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download operator-builder Binary
uses: actions/download-artifact@v4
with:
name: operator-builder-${{ matrix.binary-go-version }}
path: bin
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Initialize ${{ matrix.name }} Codebase
run: |
chmod +x bin/operator-builder
make func-test-clean
# NOTE: do not rebuild the binary here since we just downloaded above
INIT_BUILD=false make func-test-init
- name: Create ${{ matrix.name }} Codebase
run: make func-test-create
- name: Store ${{ matrix.name }} Codebase
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ env.TEST_PATH }}
#
# e2e test
#
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
needs: functional-test
if: github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
include:
# NOTE: at this time we should only test the standalone CLI as the
# inputs to the collection CLI become much more complicated to test.
- name: Standalone Operator (Current Go Version)
artifact: standalone-codebase
test-build: "true"
test-deploy: "true"
go-version: "1.22"
- name: Standalone Edge Cases Operator (Current Go Version - 1)
artifact: standalone-edge-codebase
test-build: "false"
test-deploy: "false"
go-version: "1.21"
- name: Workload Collection Operator (Current Go Version)
artifact: collection-codebase
test-build: "true"
test-deploy: "false"
go-version: "1.22"
- name: Workload Collection Edge Cases Operator (Current Go Version - 1)
artifact: collection-edge-codebase
test-build: "true"
test-deploy: "false"
go-version: "1.21"
services:
registry:
image: registry:2
ports:
- 5000:5000
defaults:
run:
working-directory: /tmp/operator-builder-test
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Download ${{ matrix.name }} Codebase
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: /tmp/operator-builder-test
- name: Run E2E Tests
uses: ./.github/common-actions/e2e-test
with:
codebase-artifact: ${{ matrix.artifact }}
- name: Run CLI Integration Tests
uses: ./.github/common-actions/e2e-test-cli
with:
test-build: ${{ matrix.test-build }}
test-deploy: ${{ matrix.test-deploy }}