1- # Implicit requirements
2- # runner must have `docker` and `curl` installed (true on github-runners)
3-
41name : run-tests
52
63on :
7- workflow_call :
8- workflow_dispatch :
4+ - pull_request
5+ - workflow_dispatch
96
107jobs :
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 == ''
478 lint :
489 concurrency :
4910 group : lint-golangci-${{ github.head_ref || github.ref_name }}
5011 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
5513 steps :
56- - name : set-env-vars
57- run : |
58- echo "HOME=/actions-runner" >> $GITHUB_ENV
14+ - name : checkout
15+ uses : actions/checkout@v3
5916 - name : setup-go
6017 uses : actions/setup-go@v3
6118 with :
6219 go-version : ' 1.20'
6320 - name : golangci-lint
6421 uses : golangci/golangci-lint-action@v2
6522 with :
66- version : v1.52.2
23+ version : v1.58.1
6724 code-format-check :
6825 concurrency :
6926 group : lint-autoformat-${{ github.head_ref || github.ref_name }}
7027 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
7529 steps :
76- - name : set-env-vars
77- run : |
78- echo "HOME=/actions-runner" >> $GITHUB_ENV
30+ - name : checkout
31+ uses : actions/checkout@v3
7932 - name : setup-go
8033 uses : actions/setup-go@v3
8134 with :
8235 go-version : ' 1.20'
83- - name : Install utilities
36+ - name : install- utilities
8437 run : |
8538 go install mvdan.cc/[email protected] 8639 go install github.com/rinchsan/gosimports/cmd/[email protected] 8740 - name : format all files with auto-formatter
8841 run : bash ./.github/scripts/format-all-go-code.sh "$PWD"
89- - name : Check repository diff
42+ - name : check- repository- diff
9043 run : bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"
9144 run-unit-tests :
9245 concurrency :
9346 group : run-unit-tests-${{ github.head_ref || github.ref_name }}
9447 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
10349 steps :
104- - name : set-env-vars
105- run : |
106- echo "HOME=/actions-runner" >> $GITHUB_ENV
50+ - name : checkout
51+ uses : actions/checkout@v3
10752 - name : setup-go
10853 uses : actions/setup-go@v3
10954 with :
@@ -139,18 +84,19 @@ jobs:
13984 group : run-e2e-tests-${{ github.head_ref || github.ref_name }}
14085 cancel-in-progress : true
14186 needs :
142- - start-runner
143- - smart-checkout
144- - lint
145- - code-format-check
14687 - 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
15089 steps :
151- - name : set-env-vars
152- run : |
153- echo "HOME=/actions-runner" >> $GITHUB_ENV
90+ - name : maximize-build-space
91+ uses :
AdityaGarg8/[email protected] 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
154100 - name : setup-go
155101 uses : actions/setup-go@v3
156102 with :
@@ -175,10 +121,6 @@ jobs:
175121 echo "$(pwd)" >> $GITHUB_PATH
176122 echo "$HOME/ydb/bin" >> $GITHUB_PATH
177123 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
182124 - name : check-dependencies
183125 run : |
184126 gcc --version
@@ -192,7 +134,12 @@ jobs:
192134 kind create cluster \
193135 --image=kindest/node:v1.25.3@sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5 \
194136 --config=./e2e/kind-cluster-config.yaml
137+
195138 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
196143 - name : build-operator-image
197144 uses : docker/build-push-action@v3
198145 with :
@@ -203,7 +150,7 @@ jobs:
203150 tags : kind/ydb-operator:current
204151 - name : load-and-deploy-operator
205152 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
207154 - name : pull-and-load-kube-webhook-certgen-image
208155 uses : nick-fields/retry@v3
209156 with :
@@ -212,20 +159,21 @@ jobs:
212159 max_attempts : 3
213160 command : |
214161 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
216163 - name : pull-and-load-ydb-image
217164 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
221169 - name : setup-gotestsum
222170 run : |
223171 go install gotest.tools/[email protected] 224172 - name : run-e2e-tests
225173 id : run-e2e-tests
226174 run : |
227175 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
229177 run : jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
230178 - name : artifact-upload-step
231179 uses : actions/upload-artifact@v4
@@ -240,21 +188,4 @@ jobs:
240188 - name : teardown-k8s-cluster
241189 run : |
242190 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