-
Notifications
You must be signed in to change notification settings - Fork 851
343 lines (308 loc) · 9.69 KB
/
run-tests.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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
name: All Tests
on:
pull_request:
push:
branches:
- main
- release/**
- cloud/**
workflow_dispatch:
inputs:
commit:
description: "Commit SHA"
required: true
concurrency: # Auto-cancel existing runs in the PR when a new commit is pushed
group: run-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# For workflow_dispatch: use the given commit.
# For pull_request: use the head of the PR branch (not the merge branch which is the default!)
# For push: use the pushed commit.
COMMIT: ${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
PR_BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
DOCKER_COMPOSE_FILE: ./develop/github/docker-compose.yml
TEMPORAL_VERSION_CHECK_DISABLED: 1
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
jobs:
misc-checks:
name: Misc checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}
# buf-breaking tries to compare HEAD against merge base so we need to be able to find it
fetch-depth: 100
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- uses: arduino/setup-protoc@v3
- run: GOOS=windows GOARCH=amd64 make clean-bins bins
- run: GOOS=darwin GOARCH=arm64 make clean-bins bins
- run: make clean-bins ci-build-misc
- run: make build-tests
unit-test:
name: Unit test
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- name: Run unit test
timeout-minutes: 15
run: make unit-test-coverage
- name: Upload test results
if: ${{ !cancelled() }}
run: make upload-test-results
integration-test:
name: Integration test
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- name: Start containerized dependencies
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ${{ env.DOCKER_COMPOSE_FILE }}
services: |
cassandra
mysql
postgresql
down-flags: -v
- name: Run integration test
timeout-minutes: 15
run: make integration-test-coverage
- name: Upload test results
if: ${{ !cancelled() }}
run: make upload-test-results
functional-test:
name: Functional test
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
name:
- cass_es
- cass_es8
- sqlite
- mysql8
- postgres12
- postgres12_pgx
shard_index: [0, 1, 2]
include:
- name: cass_es
persistence_type: nosql
persistence_driver: cassandra
containers: [cassandra, elasticsearch]
es_version: v7
- name: cass_es8
persistence_type: nosql
persistence_driver: cassandra
containers: [cassandra, elasticsearch8]
es_version: v8
- name: sqlite
persistence_type: sql
persistence_driver: sqlite
containers: []
- name: mysql8
persistence_type: sql
persistence_driver: mysql8
containers: [mysql]
- name: postgres12
persistence_type: sql
persistence_driver: postgres12
containers: [postgresql]
- name: postgres12_pgx
persistence_type: sql
persistence_driver: postgres12_pgx
containers: [postgresql]
runs-on: ${{ matrix.runs-on }}
env:
TEST_TOTAL_SHARDS: 3
TEST_SHARD_INDEX: ${{ matrix.shard_index }}
PERSISTENCE_TYPE: ${{ matrix.persistence_type }}
PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- name: Start containerized dependencies
if: ${{ toJson(matrix.containers) != '[]' }}
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ${{ env.DOCKER_COMPOSE_FILE }}
services: "${{ join(matrix.containers, '\n') }}"
down-flags: -v
- name: Run functional test
timeout-minutes: 30 # make sure this is larger than the test timeout in the Makefile
run: make functional-test-coverage
- name: Upload test results
if: ${{ !cancelled() }}
run: make upload-test-results
functional-test-xdc:
name: Functional test xdc
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
name: [cass_es]
# name: [cass_es, cass_es8, mysql8, postgres12, postgres12_pgx]
include:
- name: cass_es
persistence_type: nosql
persistence_driver: elasticsearch
containers: [cassandra, elasticsearch]
# - name: cass_es8
# persistence_type: nosql
# persistence_driver: elasticsearch
# containers: [cassandra, elasticsearch8]
# - name: mysql8
# persistence_type: sql
# persistence_driver: mysql8
# containers: [mysql]
# - name: postgres12
# persistence_type: sql
# persistence_driver: postgres12
# containers: [postgresql]
# - name: postgres12_pgx
# persistence_type: sql
# persistence_driver: postgres12_pgx
# containers: [postgresql]
runs-on: ${{ matrix.runs-on }}
env:
PERSISTENCE_TYPE: ${{ matrix.persistence_type }}
PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- name: Start containerized dependencies
if: ${{ toJson(matrix.containers) != '[]' }}
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ${{ env.DOCKER_COMPOSE_FILE }}
services: "${{ join(matrix.containers, '\n') }}"
down-flags: -v
- name: Run functional test xdc
timeout-minutes: 15
run: make functional-test-xdc-coverage
- name: Upload test results
if: ${{ !cancelled() }}
run: make upload-test-results
functional-test-ndc:
name: Functional test ndc
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
name:
- cass_es
- cass_es8
- mysql8
- postgres12
- postgres12_pgx
include:
- name: cass_es
persistence_type: nosql
persistence_driver: elasticsearch
containers: [cassandra, elasticsearch]
es_version: v7
- name: cass_es8
persistence_type: nosql
persistence_driver: elasticsearch
containers: [cassandra, elasticsearch8]
es_version: v8
- name: mysql8
persistence_type: sql
persistence_driver: mysql8
containers: [mysql]
- name: postgres12
persistence_type: sql
persistence_driver: postgres12
containers: [postgresql]
- name: postgres12_pgx
persistence_type: sql
persistence_driver: postgres12_pgx
containers: [postgresql]
runs-on: ${{ matrix.runs-on }}
env:
PERSISTENCE_TYPE: ${{ matrix.persistence_type }}
PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }}
ES_VERSION: ${{ matrix.es_version }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- name: Start containerized dependencies
if: ${{ toJson(matrix.containers) != '[]' }}
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ${{ env.DOCKER_COMPOSE_FILE }}
services: "${{ join(matrix.containers, '\n') }}"
down-flags: -v
- name: Run functional test ndc
timeout-minutes: 15
run: make functional-test-ndc-coverage
test-status:
name: Test Status
needs:
- unit-test
- integration-test
- functional-test
- functional-test-xdc
- functional-test-ndc
runs-on: ubuntu-20.04
if: always()
env:
RESULTS: ${{ toJSON(needs.*.result) }}
steps:
- name: Check results
run: |
if [[ -n $(echo "$RESULTS" | jq '.[] | select (. != "success")') ]]; then
exit 1
fi