Skip to content

Commit 79b8a78

Browse files
committed
chore(taskfile): add tests update other taskfiles
Signed-off-by: Evgeniy Frolov <evgeniy.frolov@flant.com>
1 parent 2a924ed commit 79b8a78

File tree

9 files changed

+89
-94
lines changed

9 files changed

+89
-94
lines changed

.github/actions/set-up-prebuilt-trdl-test-binary/action.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,16 @@ jobs:
4545
run: task ci:install:3p-git-signatures
4646

4747
- name: Install ginkgo
48-
working-directory: server
49-
run: task -p deps:install:ginkgo
48+
run: task deps:install:ginkgo
5049

5150
- name: Test
52-
run: task -p test:unit
53-
env:
54-
TRDL_TEST_COVERAGE_DIR: ${{github.workspace}}/coverage
51+
run: task server:test:unit
5552

5653
- name: Upload coverage artifact
5754
uses: actions/upload-artifact@v4
5855
with:
59-
name: tests_coverage
60-
path: ${{github.workspace}}/coverage
56+
name: test_coverage
57+
path: ${{github.workspace}}/server/test_coverage
6158

6259
e2e_client:
6360
name: End-to-end tests
@@ -76,10 +73,8 @@ jobs:
7673
with:
7774
repo-token: ${{ secrets.GITHUB_TOKEN }}
7875

79-
- name: Set up prebuilt werf test binary
80-
uses: ./.github/actions/set-up-prebuilt-trdl-test-binary
81-
with:
82-
coverage: "true"
76+
- name: Set up prebuilt trdl test binary
77+
run: task client:build-with-coverage
8378

8479
- name: Set up git config
8580
run: task ci:setup:git-config
@@ -93,27 +88,25 @@ jobs:
9388
uses: task ci:install:3p-git-signatures
9489

9590
- name: Install ginkgo
96-
working-directory: e2e
9791
run: task -p deps:install:ginkgo
9892

9993
- name: Test
100-
run: task -p test:e2e
101-
env:
102-
GOCOVERDIR: ${{github.workspace}}/covdata
94+
run: task e2e:test:e2e
10395

10496
- name: Upload coverage artifact
105-
uses: ./.github/actions/upload-coverage-artifact
97+
uses: actions/upload-artifact@v4
10698
with:
107-
coverage: "true"
108-
109-
notification:
110-
name: Notification
111-
if: always()
112-
needs:
113-
- tests
114-
- e2e_tests
115-
uses: werf/common-ci/.github/workflows/notification.yml@main
116-
secrets:
117-
loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }}
118-
webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}
119-
notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}
99+
name: e2e_coverage
100+
path: ${{github.workspace}}/e2e/e2e_coverage
101+
102+
# notification:
103+
# name: Notification
104+
# if: always()
105+
# needs:
106+
# - unit_server
107+
# - e2e_client
108+
# uses: werf/common-ci/.github/workflows/notification.yml@main
109+
# secrets:
110+
# loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }}
111+
# webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}
112+
# notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,3 @@ server/release-build
2727
_includes
2828
pages_en
2929
.task
30-
31-
docs/.prettierignore

Taskfile.dist.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ tasks:
8080
build:dev:all:
8181
desc: "Build all dev binaries."
8282
deps:
83-
- build:client:dev
84-
- build:server:dev
83+
- client:build:dev
84+
- server:build:dev
8585
vars:
8686
version: "{{.version}}"
8787

8888
build:dist:all:
8989
desc: "Build all release binaries."
9090
deps:
91-
- build:client:all
92-
- build:server:all
91+
- client:build:dist
92+
- server:build:dist
9393
vars:
9494
version: "{{.version}}"
9595

client/Taskfile.yaml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ tasks:
7070
cmds:
7171
- docker run --rm -v $(pwd):/work tmknom/prettier -c "**/*.yaml"
7272

73+
build:
74+
desc: "Build client dev binary."
75+
run: once
76+
cmds:
77+
- task: build:dev:{{OS}}:{{ARCH}}
78+
vars:
79+
extraGoBuildArgs: "{{.extraGoBuildArgs}}"
80+
raceDetectorEnabled: '{{.raceDetectorEnabled | default "false"}}'
81+
outputDir: ../bin/trdl
82+
7383
build:all:
7484
desc: "Build all client binaries"
7585
deps:
@@ -147,7 +157,7 @@ tasks:
147157
targetOS: "linux"
148158
targetArch: "amd64"
149159
extraGoBuildArgs: "-tags='dfrunmount dfssh' -ldflags='-s -w -X github.com/werf/trdl/client/pkg/trdl.Version={{.version}}'"
150-
outputDir: "../release-build/{{.version}}/linux-amd64/bin/"
160+
outputDir: "release-build/{{.version}}/linux-amd64/bin/"
151161

152162
build:dist:linux:arm64:
153163
desc: "Build client release binary for linux/arm64"
@@ -157,7 +167,7 @@ tasks:
157167
targetOS: "linux"
158168
targetArch: "arm64"
159169
extraGoBuildArgs: "-tags='dfrunmount dfssh' -ldflags='-s -w -X github.com/werf/trdl/client/pkg/trdl.Version={{.version}}'"
160-
outputDir: "../release-build/{{.version}}/linux-arm64/bin/"
170+
outputDir: "release-build/{{.version}}/linux-arm64/bin/"
161171

162172
build:dist:darwin:amd64:
163173
desc: "Build client release binary for darwin/amd64"
@@ -167,7 +177,7 @@ tasks:
167177
targetOS: "darwin"
168178
targetArch: "amd64"
169179
extraGoBuildArgs: "-tags='dfrunmount dfssh' -ldflags='-s -w -X github.com/werf/trdl/client/pkg/trdl.Version={{.version}}'"
170-
outputDir: "../release-build/{{.version}}/darwin-amd64/bin/"
180+
outputDir: "release-build/{{.version}}/darwin-amd64/bin/"
171181

172182
build:dist:darwin:arm64:
173183
desc: "Build client release binary for darwin/arm64"
@@ -177,7 +187,7 @@ tasks:
177187
targetOS: "darwin"
178188
targetArch: "arm64"
179189
extraGoBuildArgs: "-tags='dfrunmount dfssh' -ldflags='-s -w -X github.com/werf/trdl/client/pkg/trdl.Version={{.version}}'"
180-
outputDir: "../release-build/{{.version}}/darwin-arm64/bin/"
190+
outputDir: "release-build/{{.version}}/darwin-arm64/bin/"
181191

182192
build:dist:windows:amd64:
183193
desc: "Build client release binary for windows/amd64"
@@ -187,13 +197,13 @@ tasks:
187197
targetOS: "windows"
188198
targetArch: "amd64"
189199
extraGoBuildArgs: "-tags='dfrunmount dfssh' -ldflags='-s -w -X github.com/werf/trdl/client/pkg/trdl.Version={{.version}}'"
190-
outputDir: "../release-build/{{.version}}/windows-amd64/bin/"
200+
outputDir: "release-build/{{.version}}/windows-amd64/bin/"
191201

192202
_build:go:
193203
internal: true
194204
cmds:
195205
- |
196-
go build -o {{.outputDir | default (printf "../build/%s/%s-%s/bin" .version .targetOS .targetArch)}}/trdl{{if (eq .targetOS "windows")}}.exe{{end}} \
206+
go build -o {{.outputDir | default (printf "../bin/%s/%s-%s" .version .targetOS .targetArch)}}/trdl{{if (eq .targetOS "windows")}}.exe{{end}} \
197207
{{.extraGoBuildArgs}} {{.CLI_ARGS}} github.com/werf/trdl/client/cmd/trdl
198208
env:
199209
GOOS: "{{.targetOS}}"

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ _site/
44
.jekyll-cache/
55
.jekyll-bundle/
66
docs/
7+
.prettierignore

e2e/Taskfile.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ tasks:
4444
- task: _lint:golangci-lint:go
4545
vars:
4646
paths: "{{.paths}}"
47+
48+
test:e2e:
49+
desc: "Run client e2e test."
50+
cmd: ginkgo -p --keep-going --cover --coverpkg=../client/... --output-dir={{.outputDir}} ./...
51+
vars:
52+
outputDir: '{{.outputDir | default "e2e_coverage" }}'

server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/publisher
44
/.minio_data
55
/.run
6+
tests_coverage

server/Taskfile.yaml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ tasks:
153153
git_trdl_path={{.git_trdl_path}} \
154154
git_trdl_channels_path={{.git_trdl_channels_path}}
155155
156-
tail:
157-
desc: "Tail Vault logs"
156+
logs:
157+
desc: "Get Vault logs"
158158
cmds:
159159
- docker logs -f {{.vault_container}}
160160

@@ -166,6 +166,16 @@ tasks:
166166
- docker rm -f {{.vault_container}} || true
167167
- docker run --rm --volume ./:/wrk alpine rm -rf /wrk/{{.minio_data_dir}}
168168

169+
build:
170+
desc: "Build server dev binary."
171+
run: once
172+
cmds:
173+
- task: build:dev:{{OS}}:{{ARCH}}
174+
vars:
175+
extraGoBuildArgs: "{{.extraGoBuildArgs}}"
176+
raceDetectorEnabled: '{{.raceDetectorEnabled | default "false"}}'
177+
outputDir: vault/plugins
178+
169179
build:all:
170180
desc: "Build all server binaries"
171181
deps:
@@ -197,7 +207,7 @@ tasks:
197207
vars:
198208
targetOS: "linux"
199209
targetArch: "amd64"
200-
outputDir: "{{.outputDir}}"
210+
outputDir: vault/plugins
201211

202212
build:dev:linux:arm64:
203213
desc: "Build server dev binary for linux/arm64"
@@ -242,8 +252,8 @@ tasks:
242252
vars:
243253
targetOS: "linux"
244254
targetArch: "amd64"
245-
extraGoBuildArgs: "-s -w"
246-
outputDir: "../release-build/{{.version}}/linux-amd64/bin/"
255+
extraGoBuildArgs: -ldflags="-s -w"
256+
outputDir: "release-build/{{.version}}/linux-amd64/bin/"
247257

248258
build:dist:linux:arm64:
249259
desc: "Build server release binary for linux/arm64"
@@ -252,8 +262,8 @@ tasks:
252262
vars:
253263
targetOS: "linux"
254264
targetArch: "arm64"
255-
extraGoBuildArgs: "-s -w"
256-
outputDir: "../release-build/{{.version}}/linux-arm64/bin/"
265+
extraGoBuildArgs: -ldflags="-s -w"
266+
outputDir: "release-build/{{.version}}/linux-arm64/bin/"
257267

258268
build:dist:darwin:amd64:
259269
desc: "Build server release binary for darwin/amd64"
@@ -262,8 +272,8 @@ tasks:
262272
vars:
263273
targetOS: "darwin"
264274
targetArch: "amd64"
265-
extraGoBuildArgs: "-s -w"
266-
outputDir: "../release-build/{{.version}}/darwin-amd64/bin/"
275+
extraGoBuildArgs: -ldflags="-s -w"
276+
outputDir: "release-build/{{.version}}/darwin-amd64/bin/"
267277

268278
build:dist:darwin:arm64:
269279
desc: "Build server release binary for darwin/arm64"
@@ -272,8 +282,8 @@ tasks:
272282
vars:
273283
targetOS: "darwin"
274284
targetArch: "arm64"
275-
extraGoBuildArgs: "-s -w"
276-
outputDir: "../release-build/{{.version}}/darwin-arm64/bin/"
285+
extraGoBuildArgs: -ldflags="-s -w"
286+
outputDir: "release-build/{{.version}}/darwin-arm64/bin/"
277287

278288
build:dist:windows:amd64:
279289
desc: "Build server release binary for windows/amd64"
@@ -282,15 +292,30 @@ tasks:
282292
vars:
283293
targetOS: "windows"
284294
targetArch: "amd64"
285-
extraGoBuildArgs: "-s -w"
286-
outputDir: "../release-build/{{.version}}/windows-amd64/bin/"
295+
extraGoBuildArgs: -ldflags="-s -w"
296+
outputDir: "release-build/{{.version}}/windows-amd64/bin/"
287297

288298
_build:go:
289299
internal: true
290300
cmds:
291301
- |
292-
go build -o {{.outputDir | default (printf "../build/%s/%s-%s/bin" .version .targetOS .targetArch)}}/vault-plugin-secrets-trdl{{if (eq .targetOS "windows")}}.exe{{end}} \
302+
go build -o {{.outputDir | default (printf "vault/plugins/%s/%s-%s/bin" .version .targetOS .targetArch)}}/vault-plugin-secrets-trdl{{if (eq .targetOS "windows")}}.exe{{end}} \
293303
{{.extraGoBuildArgs}} {{.CLI_ARGS}} github.com/werf/trdl/server/cmd/vault-plugin-secrets-trdl
294304
env:
295305
GOOS: "{{.targetOS}}"
296306
GOARCH: "{{.targetArch}}"
307+
308+
build-with-coverage:
309+
desc: "Build server binary to run E2E tests with coverage."
310+
cmds:
311+
- task: build:dev:{{OS}}:{{ARCH}}
312+
vars:
313+
outputDir: ../bin/trdl
314+
extraGoBuildArgs: "-cover -covermode=atomic -coverpkg=./... "
315+
goTags: test_coverage
316+
317+
test:unit:
318+
desc: "Run server unit tests."
319+
cmd: ginkgo --vet=off --race --keep-going --cover --coverpkg=./... --output-dir={{.outputDir}} ./...
320+
vars:
321+
outputDir: '{{.outputDir | default "tests_coverage"}}'

0 commit comments

Comments
 (0)