4545 uses : actions/checkout@v3
4646 if : github.event.pull_request.head.sha == ''
4747 lint :
48+ concurrency :
49+ group : lint-golangci-${{ github.head_ref || github.ref_name }}
50+ cancel-in-progress : true
4851 needs :
4952 - start-runner
5053 - smart-checkout
6265 with :
6366 version : v1.52.2
6467 code-format-check :
68+ concurrency :
69+ group : lint-autoformat-${{ github.head_ref || github.ref_name }}
70+ cancel-in-progress : true
6571 needs :
6672 - start-runner
6773 - smart-checkout
@@ -82,13 +88,65 @@ jobs:
8288 run : bash ./.github/scripts/format-all-go-code.sh "$PWD"
8389 - name : Check repository diff
8490 run : bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"
85- run-tests :
91+ run-unit-tests :
92+ concurrency :
93+ group : run-unit-tests-${{ github.head_ref || github.ref_name }}
94+ cancel-in-progress : true
8695 needs :
8796 - start-runner
8897 - 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 }}
103+ steps :
104+ - name : set-env-vars
105+ run : |
106+ echo "HOME=/actions-runner" >> $GITHUB_ENV
107+ - name : setup-go
108+ uses : actions/setup-go@v3
109+ with :
110+ go-version : ' 1.20'
111+ - name : setup-medium-test-class-binaries
112+ run : |
113+ # This installs kube-apiserver and etcd binaries for `medium`
114+ # class tests. Refer to the writing tests docs for more info.
115+ make envtest
116+ KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path)
117+ echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV
118+ - name : setup-gotestsum
119+ run : |
120+ go install gotest.tools/[email protected] 121+ - name : run-unit-tests
122+ id : run-unit-tests
123+ run : |
124+ gotestsum --format pkgname --jsonfile log.json -- -v -timeout 900s -p 1 ./internal/... -ginkgo.vv -coverprofile cover.out
125+ - name : convert-to-human-readable
126+ run : jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
127+ - name : artifact-upload-step
128+ uses : actions/upload-artifact@v4
129+ id : artifact-upload-step
130+ if : always()
131+ with :
132+ name : unit-tests-log
133+ path : log.txt
134+ if-no-files-found : error
135+ - name : echo-tests-log-url
136+ run : echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}'
137+ run-e2e-tests :
138+ concurrency :
139+ group : run-e2e-tests-${{ github.head_ref || github.ref_name }}
140+ cancel-in-progress : true
141+ needs :
142+ - start-runner
143+ - smart-checkout
144+ - lint
145+ - code-format-check
146+ - run-unit-tests
89147 runs-on : ${{ needs.start-runner.outputs.runner-label }}
90148 outputs :
91- result : ${{ steps.run-tests.outputs.result }}
149+ result : ${{ steps.run-e2e- tests.outputs.result }}
92150 steps :
93151 - name : set-env-vars
94152 run : |
@@ -128,13 +186,6 @@ jobs:
128186 kind version
129187 kubectl version --client=true
130188 helm version
131- - name : setup-medium-test-class-binaries
132- run : |
133- # This installs kube-apiserver and etcd binaries for `medium`
134- # class tests. Refer to the writing tests docs for more info.
135- make envtest
136- KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path)
137- echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV
138189 - name : setup-k8s-cluster
139190 run : |
140191 kind delete cluster
@@ -153,26 +204,49 @@ jobs:
153204 - name : load-and-deploy-operator
154205 run : |
155206 kind load docker-image kind/ydb-operator:current
156- - name : pull-and-load-other-images
207+ - name : pull-and-load-kube-webhook-certgen-image
208+ uses : nick-fields/retry@v3
209+ with :
210+ timeout_minutes : 5
211+ retry_wait_seconds : 20
212+ max_attempts : 3
213+ command : |
214+ 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
216+ - name : pull-and-load-ydb-image
157217 run : |
158- docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
159- kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
160-
161218 # TODO would be cool to parse YDB image from manifests to avoid duplicating information
162219 docker pull cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
163220 kind load docker-image cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
164- - name : run-tests
221+ - name : setup-gotestsum
165222 run : |
166- go test -v -timeout 3600s -p 1 ./... -args -ginkgo.v
223+ go install gotest.tools/[email protected] 224+ - name : run-e2e-tests
225+ id : run-e2e-tests
226+ run : |
227+ gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./e2e/... -ginkgo.vv
228+ - name : convert-to-human-readable
229+ run : jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
230+ - name : artifact-upload-step
231+ uses : actions/upload-artifact@v4
232+ id : artifact-upload-step
233+ if : always()
234+ with :
235+ name : e2e-tests-log
236+ path : log.txt
237+ if-no-files-found : error
238+ - name : echo-tests-log-url
239+ run : echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}'
167240 - name : teardown-k8s-cluster
168241 run : |
169242 kind delete cluster
170243 stop-runner :
171244 needs :
172245 - start-runner
173- - run-tests
174246 - lint
175247 - code-format-check
248+ - run-unit-tests
249+ - run-e2e-tests
176250 runs-on : ubuntu-latest
177251 if : always()
178252 steps :
0 commit comments