1
- # Implicit requirements
2
- # runner must have `docker` and `curl` installed (true on github-runners)
3
-
4
1
name : run-tests
5
2
6
3
on :
7
- workflow_call :
8
- workflow_dispatch :
4
+ - pull_request
5
+ - workflow_dispatch
9
6
10
7
jobs :
11
- start-runner :
12
- runs-on : ubuntu-latest
13
- outputs :
14
- runner-label : ${{ steps.start-yc-runner.outputs.label }}
15
- instance-id : ${{ steps.start-yc-runner.outputs.instance-id }}
16
- steps :
17
- - name : start-yc-runner
18
- id : start-yc-runner
19
- uses : yc-actions/yc-github-runner@v1
20
- with :
21
- mode : start
22
- yc-sa-json-credentials : ${{ secrets.CI_RUNNER_CREATOR_KEY }}
23
- github-token : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
24
- folder-id : b1gmgbhccra2qca8v5g6
25
- image-id : fd80o2eikcn22b229tsa
26
- cores : 16
27
- disk-type : network-ssd-nonreplicated
28
- disk-size : 465GB
29
- memory : 32GB
30
- core-fraction : 100
31
- subnet-id : e9bu12i8ocv6q8kl83ru
32
- user : yc-admin
33
- ssh-public-key : ${{ secrets.CI_RUNNER_DEBUG_SHH_PUBLIC_KEY }}
34
- smart-checkout :
35
- needs :
36
- - start-runner
37
- runs-on : ${{ needs.start-runner.outputs.runner-label }}
38
- steps :
39
- - name : checkout-when-fork-source
40
- uses : actions/checkout@v3
41
- if : github.event.pull_request.head.sha != ''
42
- with :
43
- ref : ${{ github.event.pull_request.head.sha }}
44
- - name : checkout-when-this-repo-source
45
- uses : actions/checkout@v3
46
- if : github.event.pull_request.head.sha == ''
47
8
lint :
48
9
concurrency :
49
10
group : lint-golangci-${{ github.head_ref || github.ref_name }}
50
11
cancel-in-progress : true
51
- needs :
52
- - start-runner
53
- - smart-checkout
54
- runs-on : ${{ needs.start-runner.outputs.runner-label }}
12
+ runs-on : ubuntu-latest
55
13
steps :
56
- - name : set-env-vars
57
- run : |
58
- echo "HOME=/actions-runner" >> $GITHUB_ENV
14
+ - name : checkout
15
+ uses : actions/checkout@v3
59
16
- name : setup-go
60
17
uses : actions/setup-go@v3
61
18
with :
62
19
go-version : ' 1.20'
63
20
- name : golangci-lint
64
21
uses : golangci/golangci-lint-action@v2
65
22
with :
66
- version : v1.52.2
23
+ version : v1.58.1
67
24
code-format-check :
68
25
concurrency :
69
26
group : lint-autoformat-${{ github.head_ref || github.ref_name }}
70
27
cancel-in-progress : true
71
- needs :
72
- - start-runner
73
- - smart-checkout
74
- runs-on : ${{ needs.start-runner.outputs.runner-label }}
28
+ runs-on : ubuntu-latest
75
29
steps :
76
- - name : set-env-vars
77
- run : |
78
- echo "HOME=/actions-runner" >> $GITHUB_ENV
30
+ - name : checkout
31
+ uses : actions/checkout@v3
79
32
- name : setup-go
80
33
uses : actions/setup-go@v3
81
34
with :
82
35
go-version : ' 1.20'
83
- - name : Install utilities
36
+ - name : install- utilities
84
37
run : |
85
38
go install mvdan.cc/gofumpt@v0.5.0
86
39
go install github.com/rinchsan/gosimports/cmd/gosimports@v0.3.8
87
40
- name : format all files with auto-formatter
88
41
run : bash ./.github/scripts/format-all-go-code.sh "$PWD"
89
- - name : Check repository diff
42
+ - name : check- repository- diff
90
43
run : bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"
91
44
run-unit-tests :
92
45
concurrency :
93
46
group : run-unit-tests-${{ github.head_ref || github.ref_name }}
94
47
cancel-in-progress : true
95
- needs :
96
- - start-runner
97
- - smart-checkout
98
- - lint
99
- - code-format-check
100
- runs-on : ${{ needs.start-runner.outputs.runner-label }}
101
- outputs :
102
- result : ${{ steps.run-unit-tests.outputs.result }}
48
+ runs-on : ubuntu-latest
103
49
steps :
104
- - name : set-env-vars
105
- run : |
106
- echo "HOME=/actions-runner" >> $GITHUB_ENV
50
+ - name : checkout
51
+ uses : actions/checkout@v3
107
52
- name : setup-go
108
53
uses : actions/setup-go@v3
109
54
with :
@@ -139,18 +84,19 @@ jobs:
139
84
group : run-e2e-tests-${{ github.head_ref || github.ref_name }}
140
85
cancel-in-progress : true
141
86
needs :
142
- - start-runner
143
- - smart-checkout
144
- - lint
145
- - code-format-check
146
87
- run-unit-tests
147
- runs-on : ${{ needs.start-runner.outputs.runner-label }}
148
- outputs :
149
- result : ${{ steps.run-e2e-tests.outputs.result }}
88
+ runs-on : ubuntu-latest
150
89
steps :
151
- - name : set-env-vars
152
- run : |
153
- echo "HOME=/actions-runner" >> $GITHUB_ENV
90
+ - name : maximize-build-space
91
+ uses : AdityaGarg8/remove-unwanted-software@v4.1
92
+ with :
93
+ remove-android : ' true'
94
+ remove-haskell : ' true'
95
+ remove-codeql : ' true'
96
+ remove-dotnet : ' true'
97
+ remove-swapfile : ' true'
98
+ - name : checkout
99
+ uses : actions/checkout@v3
154
100
- name : setup-go
155
101
uses : actions/setup-go@v3
156
102
with :
@@ -175,10 +121,6 @@ jobs:
175
121
echo "$(pwd)" >> $GITHUB_PATH
176
122
echo "$HOME/ydb/bin" >> $GITHUB_PATH
177
123
echo "$HOME/go/bin" >> $GITHUB_PATH
178
- - name : configure-system
179
- run : |
180
- sudo sysctl fs.inotify.max_user_instances=1280
181
- sudo sysctl fs.inotify.max_user_watches=655360
182
124
- name : check-dependencies
183
125
run : |
184
126
gcc --version
@@ -192,7 +134,12 @@ jobs:
192
134
kind create cluster \
193
135
--image=kindest/node:v1.25.3@sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5 \
194
136
--config=./e2e/kind-cluster-config.yaml
137
+
195
138
kubectl wait --timeout=5m --for=condition=ready node -l worker=true
139
+
140
+ kubectl label --overwrite node kind-worker topology.kubernetes.io/zone=fakeZone1
141
+ kubectl label --overwrite node kind-worker2 topology.kubernetes.io/zone=fakeZone2
142
+ kubectl label --overwrite node kind-worker3 topology.kubernetes.io/zone=fakeZone3
196
143
- name : build-operator-image
197
144
uses : docker/build-push-action@v3
198
145
with :
@@ -203,7 +150,7 @@ jobs:
203
150
tags : kind/ydb-operator:current
204
151
- name : load-and-deploy-operator
205
152
run : |
206
- kind load docker-image kind/ydb-operator:current
153
+ kind load docker-image kind/ydb-operator:current --nodes kind-worker,kind-worker2,kind-worker3
207
154
- name : pull-and-load-kube-webhook-certgen-image
208
155
uses : nick-fields/retry@v3
209
156
with :
@@ -212,20 +159,21 @@ jobs:
212
159
max_attempts : 3
213
160
command : |
214
161
docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
215
- kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
162
+ kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --nodes kind-worker,kind-worker2,kind-worker3
216
163
- name : pull-and-load-ydb-image
217
164
run : |
218
- # TODO would be cool to parse YDB image from manifests to avoid duplicating information
219
- docker pull cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
220
- kind load docker-image cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
165
+ YDB_IMAGE=$(grep "anchor_for_fetching_image_from_workflow" ./e2e/tests/**/*.go | grep -o -E '"cr\.yandex.*"')
166
+ YDB_IMAGE=${YDB_IMAGE:1:-1} # strip ""
167
+ docker pull $YDB_IMAGE
168
+ kind load docker-image $YDB_IMAGE --nodes kind-worker,kind-worker2,kind-worker3
221
169
- name : setup-gotestsum
222
170
run : |
223
171
go install gotest.tools/gotestsum@v1.12.0
224
172
- name : run-e2e-tests
225
173
id : run-e2e-tests
226
174
run : |
227
175
gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./e2e/... -ginkgo.vv
228
- - name : convert-to-human-readable
176
+ - name : convert-json-log- to-human-readable
229
177
run : jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
230
178
- name : artifact-upload-step
231
179
uses : actions/upload-artifact@v4
@@ -240,21 +188,4 @@ jobs:
240
188
- name : teardown-k8s-cluster
241
189
run : |
242
190
kind delete cluster
243
- stop-runner :
244
- needs :
245
- - start-runner
246
- - lint
247
- - code-format-check
248
- - run-unit-tests
249
- - run-e2e-tests
250
- runs-on : ubuntu-latest
251
- if : always()
252
- steps :
253
- - name : stop-yc-runner
254
- uses : yc-actions/yc-github-runner@v1
255
- with :
256
- mode : stop
257
- yc-sa-json-credentials : ${{ secrets.CI_RUNNER_CREATOR_KEY }}
258
- github-token : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
259
- label : ${{ needs.start-runner.outputs.runner-label }}
260
- instance-id : ${{ needs.start-runner.outputs.instance-id }}
191
+
0 commit comments