@@ -16,14 +16,14 @@ jobs:
16
16
strategy :
17
17
matrix :
18
18
golang-version :
19
- - " 1.21 "
19
+ - " 1.22 "
20
20
steps :
21
21
- name : Checkout project
22
- uses : actions/checkout@v3
22
+ uses : actions/checkout@v4
23
23
24
24
- name : Setup golang
25
25
id : setup-go
26
- uses : actions/setup-go@v3
26
+ uses : actions/setup-go@v5
27
27
with :
28
28
go-version : ' ^${{ matrix.golang-version }}'
29
29
@@ -32,24 +32,24 @@ jobs:
32
32
run : |
33
33
sudo apt-get install -y musl-tools musl-dev
34
34
35
- - name : Cache golang
36
- id : cache-golang
37
- uses : actions/cache@v3
38
- with :
39
- path : |
40
- ~/go/pkg/mod
41
- ~/.cache/go-build
42
- key : clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }}
35
+ # - name: Cache golang
36
+ # id: cache-golang
37
+ # uses: actions/cache@v4
38
+ # with:
39
+ # path: |
40
+ # ~/go/pkg/mod
41
+ # ~/.cache/go-build
42
+ # key: clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }}
43
43
44
44
- name : Install golang dependencies
45
45
run : go mod download -x
46
- if : |
47
- steps.cache-golang.outputs.cache-hit != 'true'
46
+ # if: |
47
+ # steps.cache-golang.outputs.cache-hit != 'true'
48
48
49
49
- name : Build clickhouse-backup binary
50
50
id : make-race
51
51
env :
52
- GOROOT : ${{ env.GOROOT_1_20_X64 }}
52
+ GOROOT : ${{ env.GOROOT_1_22_X64 }}
53
53
run : |
54
54
make build/linux/amd64/clickhouse-backup build/linux/arm64/clickhouse-backup
55
55
make build/linux/amd64/clickhouse-backup-fips build/linux/arm64/clickhouse-backup-fips
76
76
fi
77
77
echo "GCS_TESTS=$(if [ -z "${{ secrets.VAULT_PASSWORD }}" ]; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
78
78
79
- - uses : actions/upload-artifact@v3
79
+ - uses : actions/upload-artifact@v4
80
80
with :
81
81
name : build-gcp-credentials
82
82
path : |
86
86
if : |
87
87
steps.secrets.outputs.GCS_TESTS == 'true'
88
88
89
- - uses : actions/upload-artifact@v3
89
+ - uses : actions/upload-artifact@v4
90
90
with :
91
91
name : build-artifacts
92
92
path : |
97
97
if-no-files-found : error
98
98
retention-days : 1
99
99
100
- - uses : actions/upload-artifact@v3
100
+ - uses : actions/upload-artifact@v4
101
101
with :
102
102
name : build-test-artifacts
103
103
path : |
@@ -114,15 +114,25 @@ jobs:
114
114
runs-on : ubuntu-22.04
115
115
strategy :
116
116
matrix :
117
+ golang-version :
118
+ - " 1.22"
117
119
clickhouse :
118
120
- ' 22.3'
119
121
- ' 22.8'
120
122
- ' 23.3'
123
+ - ' 23.8'
124
+ - ' 24.3'
121
125
steps :
122
126
- name : Checkout project
123
- uses : actions/checkout@v3
127
+ uses : actions/checkout@v4
124
128
125
- - uses : actions/download-artifact@v3
129
+ - name : Setup golang
130
+ id : setup-go
131
+ uses : actions/setup-go@v5
132
+ with :
133
+ go-version : ' ^${{ matrix.golang-version }}'
134
+
135
+ - uses : actions/download-artifact@v4
126
136
with :
127
137
name : build-test-artifacts
128
138
path : ./clickhouse-backup/
@@ -134,7 +144,7 @@ jobs:
134
144
python3 -m venv ~/venv/qa
135
145
136
146
- name : Cache python
137
- uses : actions/cache@v3
147
+ uses : actions/cache@v4
138
148
id : cache-python
139
149
with :
140
150
path : ~/venv/qa
@@ -159,30 +169,26 @@ jobs:
159
169
# don't change it to avoid not working CI/CD
160
170
RUN_TESTS : " *"
161
171
run : |
162
- set -x
172
+ set -xe
163
173
export CLICKHOUSE_TESTS_DIR=$(pwd)/test/testflows/clickhouse_backup
164
174
165
- command -v docker-compose || (sudo apt-get update && sudo apt-get install -y python3-pip && pip3 install -U docker-compose)
166
- docker-compose -f ${CLICKHOUSE_TESTS_DIR}/docker-compose/docker-compose.yml pull
175
+ docker compose -f ${CLICKHOUSE_TESTS_DIR}/docker-compose/docker-compose.yml pull
167
176
168
177
chmod +x $(pwd)/clickhouse-backup/clickhouse-backup*
169
178
source ~/venv/qa/bin/activate
170
- set +e
171
179
~/venv/qa/bin/python3 ./test/testflows/clickhouse_backup/regression.py --debug --only="${RUN_TESTS:-*}" --log ./test/testflows/raw.log
172
- if [[ "0" != "$?" ]]; then
173
- docker-compose -f ${CLICKHOUSE_TESTS_DIR}/docker-compose/docker-compose.yml logs clickhouse_backup
174
- exit 1
175
- fi
176
- set -e
177
180
tfs --debug --no-colors transform compact ./test/testflows/raw.log ./test/testflows/compact.log
178
181
tfs --debug --no-colors transform nice ./test/testflows/raw.log ./test/testflows/nice.log.txt
179
182
tfs --debug --no-colors transform short ./test/testflows/raw.log ./test/testflows/short.log.txt
180
183
tfs --debug --no-colors report results -a "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/" ./test/testflows/raw.log - --confidential --copyright "Altinity LTD" --logo ./test/testflows/altinity.png | ~/venv/qa/bin/tfs --debug --no-colors document convert > ./test/testflows/report.html
181
184
sudo chmod -Rv +rx test/testflows/clickhouse_backup/_instances
182
185
- name : Format testflows coverage
186
+ env :
187
+ GOROOT : ${{ env.GOROOT_1_22_X64 }}
183
188
run : |
184
189
sudo chmod -Rv a+rw test/testflows/_coverage_/
185
- ls -la test/testflows/_coverage_
190
+ ls -la test/testflows/_coverage_
191
+ go env
186
192
go tool covdata textfmt -i test/testflows/_coverage_/ -o test/testflows/_coverage_/coverage.out
187
193
- name : Report testflows coverage
188
194
uses : coverallsapp/github-action@v2
@@ -191,17 +197,17 @@ jobs:
191
197
parallel : true
192
198
format : golang
193
199
flag-name : testflows-${{ matrix.clickhouse }}
194
- # todo wait when resolve https://github.com/actions/upload-artifact/issues/270 and uncomment
195
- # - name: Upload testflows logs
196
- # uses: actions/upload-artifact@v3
197
- # with:
198
- # name: testflows-logs-and-reports-${{ matrix.clickhouse }}-${{ github.run_id }}
199
- # path: |
200
- # test/testflows/*.log
201
- # test/testflows/*.log.txt
202
- # test/testflows/clickhouse_backup/_instances/**/*.log
203
- # test/testflows/*.html
204
- # retention-days: 7
200
+ # todo possible failures https://github.com/actions/upload-artifact/issues/270
201
+ - name : Upload testflows logs
202
+ uses : actions/upload-artifact@v4
203
+ with :
204
+ name : testflows-logs-and-reports-${{ matrix.clickhouse }}-${{ github.run_id }}
205
+ path : |
206
+ test/testflows/*.log
207
+ test/testflows/*.log.txt
208
+ test/testflows/clickhouse_backup/_instances/**/*.log
209
+ test/testflows/*.html
210
+ retention-days : 7
205
211
206
212
test :
207
213
needs : build
@@ -210,7 +216,7 @@ jobs:
210
216
strategy :
211
217
matrix :
212
218
golang-version :
213
- - " 1.21 "
219
+ - " 1.22 "
214
220
clickhouse :
215
221
- ' 1.1.54394'
216
222
- ' 19.17'
@@ -221,31 +227,33 @@ jobs:
221
227
- ' 22.3'
222
228
- ' 22.8'
223
229
- ' 23.3'
230
+ - ' 23.8'
231
+ - ' 24.3'
224
232
steps :
225
233
- name : Checkout project
226
- uses : actions/checkout@v3
234
+ uses : actions/checkout@v4
227
235
228
236
- name : Setup golang
229
237
id : setup-go
230
- uses : actions/setup-go@v3
238
+ uses : actions/setup-go@v5
231
239
with :
232
240
go-version : ' ^${{ matrix.golang-version }}'
233
241
234
- - name : Cache golang
235
- id : cache-golang
236
- uses : actions/cache@v3
237
- with :
238
- path : |
239
- ~/go/pkg/mod
240
- ~/.cache/go-build
241
- key : clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }}
242
+ # - name: Cache golang
243
+ # id: cache-golang
244
+ # uses: actions/cache@v4
245
+ # with:
246
+ # path: |
247
+ # ~/go/pkg/mod
248
+ # ~/.cache/go-build
249
+ # key: clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }}
242
250
243
- - uses : actions/download-artifact@v3
251
+ - uses : actions/download-artifact@v4
244
252
with :
245
253
name : build-test-artifacts
246
254
path : ./clickhouse-backup/
247
255
248
- - uses : actions/download-artifact@v3
256
+ - uses : actions/download-artifact@v4
249
257
with :
250
258
name : build-gcp-credentials
251
259
path : ./test/integration/
@@ -254,10 +262,16 @@ jobs:
254
262
255
263
- name : Running integration tests
256
264
env :
265
+ RUN_PARALLEL : 3
266
+ GOROOT : ${{ env.GOROOT_1_22_X64 }}
257
267
CLICKHOUSE_VERSION : ${{ matrix.clickhouse }}
258
- # don't change it to avoid broken CI/CD!!!
259
- # RUN_TESTS: "TestFIPS "
268
+ # options for advanced debug CI/CD
269
+ # RUN_TESTS: "TestLongListRemote "
260
270
# LOG_LEVEL: "debug"
271
+ # TEST_LOG_LEVEL: "debug"
272
+ # GCS_DEBUG: "true"
273
+ # SFTP_DEBUG: "true"
274
+ # AZBLOB_DEBUG: "true"
261
275
# FTP_DEBUG: "true"
262
276
# S3_DEBUG: "true"
263
277
CGO_ENABLED : 0
@@ -274,7 +288,7 @@ jobs:
274
288
QA_GCS_OVER_S3_SECRET_KEY : ${{ secrets.QA_GCS_OVER_S3_SECRET_KEY }}
275
289
QA_GCS_OVER_S3_BUCKET : ${{ secrets.QA_GCS_OVER_S3_BUCKET }}
276
290
run : |
277
- set -x
291
+ set -xe
278
292
echo "CLICKHOUSE_VERSION=${CLICKHOUSE_VERSION}"
279
293
echo "GCS_TESTS=${GCS_TESTS}"
280
294
@@ -292,13 +306,30 @@ jobs:
292
306
export COMPOSE_FILE=docker-compose.yml
293
307
fi
294
308
295
- command -v docker-compose || (apt-get update && apt-get install -y python3-pip && pip3 install -U docker-compose)
296
-
309
+ export CUR_DIR="$(pwd)/test/integration"
297
310
export CLICKHOUSE_BACKUP_BIN="$(pwd)/clickhouse-backup/clickhouse-backup-race"
298
- docker-compose -f test/integration/${COMPOSE_FILE} up -d || ( docker-compose -f test/integration/${COMPOSE_FILE} ps -a && docker-compose -f test/integration/${COMPOSE_FILE} logs clickhouse && exit 1 )
299
- docker-compose -f test/integration/${COMPOSE_FILE} ps -a
300
- go test -timeout 30m -failfast -tags=integration -run "${RUN_TESTS:-.+}" -v test/integration/integration_test.go
311
+ docker compose -f "${CUR_DIR}/${COMPOSE_FILE}" --progress=quiet pull
312
+
313
+ pids=()
314
+ for ((i = 0; i < RUN_PARALLEL; i++)); do
315
+ docker compose -f ${CUR_DIR}/${COMPOSE_FILE} --project-name project${i} --progress plain up -d &
316
+ pids+=($!)
317
+ done
318
+
319
+
320
+ for pid in "${pids[@]}"; do
321
+ if wait "$pid"; then
322
+ echo "$pid docker compose up successful"
323
+ else
324
+ echo "$pid the docker compose up failed. Exiting."
325
+ exit 1 # Exit with an error code if any command fails
326
+ fi
327
+ done
328
+
329
+ go test -parallel ${RUN_PARALLEL} -timeout 60m -failfast -tags=integration -run "${RUN_TESTS:-.+}" -v test/integration/integration_test.go
301
330
- name : Format integration coverage
331
+ env :
332
+ GOROOT : ${{ env.GOROOT_1_22_X64 }}
302
333
run : |
303
334
sudo chmod -Rv a+rw test/integration/_coverage_/
304
335
ls -la test/integration/_coverage_
@@ -329,9 +360,9 @@ jobs:
329
360
runs-on : ubuntu-22.04
330
361
steps :
331
362
- name : Checkout project
332
- uses : actions/checkout@v3
363
+ uses : actions/checkout@v4
333
364
334
- - uses : actions/download-artifact@v3
365
+ - uses : actions/download-artifact@v4
335
366
with :
336
367
name : build-artifacts
337
368
path : ./build/linux/
@@ -344,9 +375,9 @@ jobs:
344
375
echo "docker_tag=${DOCKER_TAG:-dev}" >> $GITHUB_OUTPUT
345
376
346
377
- name : Set up QEMU
347
- uses : docker/setup-qemu-action@v2
378
+ uses : docker/setup-qemu-action@v3
348
379
- name : Set up Docker Buildx
349
- uses : docker/setup-buildx-action@v2
380
+ uses : docker/setup-buildx-action@v3
350
381
351
382
- name : Building docker image
352
383
env :
@@ -360,9 +391,11 @@ jobs:
360
391
if [[ "${DOCKER_TOKEN}" != "" ]]; then
361
392
export DOCKER_REGISTRY=${DOCKER_REGISTRY:-docker.io}
362
393
echo ${DOCKER_TOKEN} | docker login -u ${DOCKER_USER} --password-stdin ${DOCKER_REGISTRY}
363
- docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG} --target=image_short --pull --push .
364
- docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}-fips --target=image_fips --pull --push .
365
- docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:${DOCKER_TAG} --target=image_full --pull --push .
394
+ export VERSION=$(git describe --always --tags --abbrev=0 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/c\1/;s/-/./g')
395
+
396
+ docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG} --build-arg VERSION=$VERSION --target=image_short --pull --push .
397
+ docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}-fips --build-arg VERSION=$VERSION --target=image_fips --pull --push .
398
+ docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:${DOCKER_TAG} --build-arg VERSION=$VERSION --target=image_full --pull --push .
366
399
fi
367
400
368
401
cleanup :
@@ -374,13 +407,13 @@ jobs:
374
407
if : always()
375
408
steps :
376
409
- name : delete build-artifacts
377
- uses : geekyeggo/delete-artifact@v2
410
+ uses : geekyeggo/delete-artifact@v5
378
411
with :
379
412
name : build-artifacts
380
413
failOnError : false
381
414
382
415
- name : delete build-gcp-credentials
383
- uses : geekyeggo/delete-artifact@v2
416
+ uses : geekyeggo/delete-artifact@v5
384
417
with :
385
418
name : build-gcp-credentials
386
419
failOnError : false
0 commit comments