@@ -29,29 +29,30 @@ functions:
29
29
<< : *go_options
30
30
command : make build
31
31
" test " :
32
- - command : subprocess .exec
32
+ - command : shell .exec
33
33
type : test
34
34
params :
35
- add_to_path :
36
- - ${go_bin}
37
- - ${workdir}/bin
38
35
working_dir : src/github.com/mongodb/mongocli
39
- env :
40
- GOROOT : ${go_root}
41
- << : *go_options
42
- command : make test
36
+ script : |
37
+ set -o xtrace
38
+ set -o errexit
39
+ set -o verbose
40
+
41
+ export GOROOT="${go_root}"
42
+ export PATH="./bin:$GOROOT/bin:$PATH"
43
+
44
+ gotestsum --junitfile unit-tests.xml -- -race -cover -count=1 -coverprofile coverage.out ./internal...
43
45
" generate html coverage " :
44
46
- command : subprocess.exec
45
47
type : test
46
48
params :
47
49
add_to_path :
48
50
- ${go_bin}
49
- - ${workdir}/bin
50
51
working_dir : src/github.com/mongodb/mongocli
51
52
env :
52
53
GOROOT : ${go_root}
53
54
<< : *go_options
54
- command : make coverage
55
+ command : go tool cover -html= coverage.out -o coverage.html
55
56
" upload html coverage " :
56
57
- command : s3.put
57
58
params :
@@ -71,7 +72,6 @@ functions:
71
72
- ${go_bin}
72
73
working_dir : src/github.com/mongodb/mongocli
73
74
env :
74
- WORKDIR : ${workdir}
75
75
GOROOT : ${go_root}
76
76
MCLI_OPS_MANAGER_URL : ${mcli_ops_manager_url}
77
77
MCLI_ORG_ID : ${atlas_org_id}
@@ -89,7 +89,6 @@ functions:
89
89
- ${go_bin}
90
90
working_dir : src/github.com/mongodb/mongocli
91
91
env :
92
- WORKDIR : ${workdir}
93
92
GOROOT : ${go_root}
94
93
MCLI_OPS_MANAGER_URL : ${mcli_ops_manager_url}
95
94
MCLI_ORG_ID : ${cloud_manager_org_id}
@@ -100,17 +99,18 @@ functions:
100
99
<< : *go_options
101
100
command : make e2e-test-cloud
102
101
" lint " :
103
- - command : subprocess .exec
102
+ - command : shell .exec
104
103
type : test
105
104
params :
106
- add_to_path :
107
- - ${go_bin}
108
105
working_dir : src/github.com/mongodb/mongocli
109
- env :
110
- WORKDIR : ${workdir}
111
- GOROOT : ${go_root}
112
- << : *go_options
113
- command : make lint
106
+ script : |
107
+ set -o xtrace
108
+ set -o errexit
109
+ set -o verbose
110
+
111
+ export GOROOT="${go_root}"
112
+ export PATH="./bin:$GOROOT/bin:$PATH"
113
+ golangci-lint run --out-format junit-xml > lint-tests.xml
114
114
" generate notices " :
115
115
- command : shell.exec
116
116
type : test
@@ -130,18 +130,32 @@ functions:
130
130
popd
131
131
cd src/github.com/mongodb/mongocli
132
132
go-licenses save "github.com/mongodb/mongocli" --save_path=third_party_notices
133
- " install gon " :
133
+ " install gotestsum " :
134
134
- command : shell.exec
135
135
type : setup
136
136
params :
137
- working_dir : src/github.com/mongodb/mongocli
137
+ working_dir : src/github.com/mongodb/mongocli/bin
138
138
script : |
139
139
set -o xtrace
140
140
set -o errexit
141
141
set -o verbose
142
142
143
- mkdir -p bin
144
- cd bin
143
+ curl -sfL https://github.com/gotestyourself/gotestsum/releases/download/v0.4.2/gotestsum_0.4.2_linux_amd64.tar.gz | tar zx
144
+ " install golangci-lint " :
145
+ - command : subprocess.exec
146
+ type : setup
147
+ params :
148
+ working_dir : src/github.com/mongodb/mongocli
149
+ command : make setup
150
+ " install gon " :
151
+ - command : shell.exec
152
+ type : setup
153
+ params :
154
+ working_dir : src/github.com/mongodb/mongocli/bin
155
+ script : |
156
+ set -o xtrace
157
+ set -o errexit
158
+ set -o verbose
145
159
146
160
curl -sL https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip | tar zx
147
161
" install goreleaser " :
@@ -256,7 +270,7 @@ functions:
256
270
257
271
env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X github.com/mongodb/mongocli/internal/version.Version=$VERSION" -o mongocli.exe
258
272
259
- mkdir { build,dist}
273
+ mkdir -p build
260
274
261
275
go-msi make --msi "dist/mongocli_$VERSION.msi" --version $VERSION
262
276
" rename pkg " :
@@ -340,23 +354,40 @@ functions:
340
354
--version ${server_version|1.0.0} \
341
355
--arch x86_64 \
342
356
--packages https://s3.amazonaws.com/mongodb-mongocli-build/${project}/dist/${revision}_${created_at}/${ext}.tgz
357
+
358
+ post :
359
+ - command : attach.xunit_results
360
+ params :
361
+ files : ["src/github.com/mongodb/mongocli/*.xml"]
362
+
343
363
tasks :
344
364
- name : compile
365
+ tags : ["code_health"]
345
366
commands :
346
367
- func : " clone"
347
368
- func : " build"
348
- - name : test
369
+ - name : unit_test
370
+ tags : ["code_health"]
349
371
commands :
350
372
- func : " clone"
373
+ - func : " install gotestsum"
351
374
- func : " test"
352
375
- func : " generate html coverage"
353
376
- func : " upload html coverage"
377
+ - name : lint
378
+ tags : ["code_health"]
379
+ commands :
380
+ - func : " clone"
381
+ - func : " install golangci-lint"
382
+ - func : " lint"
354
383
- name : atlas_e2e
384
+ tags : ["e2e"]
355
385
commands :
356
386
- func : " clone"
357
387
- func : " build"
358
388
- func : " atlas e2e"
359
389
- name : cloud_manager_e2e
390
+ tags : ["e2e"]
360
391
commands :
361
392
- func : " clone"
362
393
- func : " build"
@@ -922,7 +953,8 @@ buildvariants:
922
953
go_bin : " /opt/golang/go1.14/bin"
923
954
tasks :
924
955
- name : compile
925
- - name : test
956
+ - name : unit_test
957
+ - name : lint
926
958
- name : e2e
927
959
display_name : " E2E"
928
960
run_on :
0 commit comments