forked from chickenbug/stitch-cli-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.evg.yml
291 lines (282 loc) · 10.2 KB
/
.evg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
cloud_dependent_pkg: &cloud_dependent_pkg "commands"
functions:
"fetch_go113":
- command: shell.exec
params:
shell: "bash"
shell: "bash"
script: |
set -e
wget --quiet ${go_url}
tar xvf ./go1.13*gz
"setup_project":
- command: git.get_project
params:
directory: stitch-cli
"setup_mongod":
- command: shell.exec
params:
shell: "bash"
script: |
set -v
curl --silent ${mongodb_url} | tar xvz
- command: shell.exec
params:
shell: "bash"
background: true
script: |
set -v
cd mongodb-*
echo "starting mongod..."
mkdir db_files
./bin/mongod --dbpath ./db_files --port 26000 --replSet "test" &
echo "waiting for mongod to start up"
- command: shell.exec
params:
shell: "bash"
script: |
set -e
cd mongodb-*
echo "waiting for mongod to start up"
./bin/mongo --nodb --eval 'assert.soon(function(x){try{var d = new Mongo("localhost:26000"); return true}catch(e){return false}}, "timed out connecting")'
./bin/mongo --port 26000 --eval 'rs.initiate()'
echo "mongod is up."
"setup_stitch_server":
- command: shell.exec
params:
shell: "bash"
script: |
wget --quiet "${libmongo_url}"
chmod +x libmongo.so
- command: shell.exec
params:
shell: "bash"
script: |
git clone [email protected]:10gen/stitch.git
- command: shell.exec
params:
shell: "bash"
script: |
set -e
cd stitch
mkdir -p etc/dylib
cd etc/dylib
curl -s "${server_stitch_lib_url}" | tar xvfz - --strip-components=1
- command: shell.exec
params:
shell: "bash"
script: |
set -e
cd stitch/etc/transpiler
curl -OL https://yarnpkg.com/latest.tar.gz
tar zvxf latest.tar.gz
mv yarn-* yarn
export PATH="`pwd`/yarn/bin:$PATH"
yarn install && yarn run build -t ${transpiler_target}
"start_server":
- command: shell.exec
params:
shell: "bash"
background: true
script: |
export ROOT_DIR=`pwd`
export PATH="$ROOT_DIR:$PATH"
export GOROOT=$ROOT_DIR/go
export PATH=$GOROOT/bin:$PATH
cd $ROOT_DIR/stitch
export PATH="$ROOT_DIR/stitch/etc/transpiler/bin:$PATH"
export LD_LIBRARY_PATH="$ROOT_DIR/stitch/etc/dylib/lib"
which transpiler
cat > atlas_config.json <<EOF
{
"admin": {
"authProviders": [
{
"name": "mongodb-cloud",
"type": "mongodb-cloud",
"config": {
"baseUrl": "https://cloud-dev.mongodb.com",
"adminUsername": "${stitch_mongodb_cloud_atlas_admin_username}",
"adminAPIKey": "${stitch_mongodb_cloud_atlas_admin_api_key}"
},
"metadataFields": [{ "name": "name", "required": false}]
}
]
}
}
EOF
go run cmd/server/main.go --configFile $ROOT_DIR/stitch-cli/testdata/configs/stitch_server_test_config.json --configFile ./atlas_config.json
- command: shell.exec
params:
shell: "bash"
script: |
counter=0
until $(curl --output /dev/null --silent --head --fail ${stitchServerURL}); do
echo "checking for API server to be up..."
sleep 1
let counter++
if [ $counter -gt 100 ]; then
exit 1
fi
done
tasks:
- name: test_unit
exec_timeout_secs: 3600
commands:
- func: "fetch_go113"
- func: "setup_project"
- command: shell.exec
params:
shell: "bash"
script: |
set -v
set -e
export ROOT_DIR=`pwd`
export PATH="$ROOT_DIR:$PATH"
export GOROOT=$ROOT_DIR/go
export PATH=$GOROOT/bin:$PATH
cd $ROOT_DIR/stitch-cli
go test -v -covermode=count -coverprofile=$ROOT_DIR/cover.out $(go list github.com/10gen/stitch-cli/...) > $ROOT_DIR/stitch-cli.suite
- command: s3.put
params:
aws_key: ${test_aws_key}
aws_secret: ${test_aws_secret}
local_file: cover.out
remote_file: ${task_id}/cover.out
bucket: stitch-test-artifacts
content_type: text/plain
permissions: public-read
- name: tests-with-cloud
exec_timeout_secs: 3600
commands:
- func: "fetch_go113"
- func: "setup_project"
- func: "setup_mongod"
- func: "setup_stitch_server"
- func: "start_server"
- command: shell.exec
params:
shell: "bash"
script: |
set -v
set -e
export ROOT_DIR=`pwd`
export PATH="$ROOT_DIR:$PATH"
export GOROOT=$ROOT_DIR/go
export PATH=$GOROOT/bin:$PATH
export STITCH_MONGODB_CLOUD_GROUP_ID="${stitch_mongodb_cloud_group_id}"
export STITCH_MONGODB_CLOUD_USERNAME="${stitch_mongodb_cloud_username}"
export STITCH_MONGODB_CLOUD_API_KEY="${stitch_mongodb_cloud_api_key}"
export STITCH_MONGODB_CLOUD_ADMIN_USERNAME="${stitch_mongodb_cloud_admin_username}"
export STITCH_MONGODB_CLOUD_ADMIN_API_KEY="${stitch_mongodb_cloud_admin_api_key}"
export STITCH_MONGODB_CLOUD_API_BASE_URL="${mongoDBCloudURL}"
export STITCH_SERVER_BASE_URL="${stitchServerURL}"
cd $ROOT_DIR/stitch-cli
go test -v -covermode=count -coverprofile=$ROOT_DIR/cover.out $(go list github.com/10gen/stitch-cli/${cloud_dependent_pkg}/...) -timeout 25m -run TestCloud > $ROOT_DIR/stitch-cli.suite
- command: s3.put
params:
aws_key: ${test_aws_key}
aws_secret: ${test_aws_secret}
local_file: cover.out
remote_file: ${task_id}/cover.out
bucket: stitch-test-artifacts
content_type: text/plain
permissions: public-read
- name: lint
commands:
- func: "fetch_go113"
- func: "setup_project"
- command: shell.exec
params:
shell: "bash"
script: |
export ROOT_DIR=`pwd`
export GOROOT=$ROOT_DIR/go
export PATH=$GOROOT/bin:$PATH
cd $ROOT_DIR/stitch-cli
go run github.com/golangci/golangci-lint/cmd/golangci-lint run ./...
- name: build_publish_clis
depends_on:
- name: test_unit
- name: lint
patchable: false
commands:
- func: "fetch_go113"
- func: "setup_project"
- command: shell.exec
params:
shell: "bash"
script: |
set -v
set -e
export ROOT_DIR=`pwd`
export PATH="$ROOT_DIR:$PATH"
export GOROOT=$ROOT_DIR/go
export PATH=$GOROOT/bin:$PATH
cd $ROOT_DIR/stitch-cli
export VERSION="1.7.0"
export GOARCH=amd64
export GOOS=linux
export OSARCH=linux-amd64
echo "Building stitch-cli for $GOOS on $GOARCH"
REPLACE_VARS="-ldflags \"-X github.com/10gen/stitch-cli/utils.CLIVersion=$VERSION -X github.com/10gen/stitch-cli/utils.cliOSArch=$OSARCH\""
eval go build $REPLACE_VARS -o stitch-cli-linux-amd64 main.go
export GOOS=darwin
export OSARCH=macos-amd64
REPLACE_VARS="-ldflags \"-X github.com/10gen/stitch-cli/utils.CLIVersion=$VERSION -X github.com/10gen/stitch-cli/utils.cliOSArch=$OSARCH\""
echo "Building stitch-cli for $GOOS on $GOARCH"
eval go build $REPLACE_VARS -o stitch-cli-macos-amd64 main.go
export GOOS=windows
export OSARCH=windows-amd64
REPLACE_VARS="-ldflags \"-X github.com/10gen/stitch-cli/utils.CLIVersion=$VERSION -X github.com/10gen/stitch-cli/utils.cliOSArch=$OSARCH\""
echo "Building stitch-cli for $GOOS on $GOARCH"
eval go build $REPLACE_VARS -o stitch-cli-windows-amd64 main.go
- command: s3.put
params:
aws_key: ${artifacts_aws_key}
aws_secret: ${artifacts_aws_secret}
local_file: stitch-cli/stitch-cli-linux-amd64
remote_file: ${build_id}/linux-amd64/stitch-cli
bucket: stitch-clis
content_type: application/octet-stream
permissions: public-read
- command: s3.put
params:
aws_key: ${artifacts_aws_key}
aws_secret: ${artifacts_aws_secret}
local_file: stitch-cli/stitch-cli-macos-amd64
remote_file: ${build_id}/macos-amd64/stitch-cli
bucket: stitch-clis
content_type: application/octet-stream
permissions: public-read
- command: s3.put
params:
aws_key: ${artifacts_aws_key}
aws_secret: ${artifacts_aws_secret}
local_file: stitch-cli/stitch-cli-windows-amd64
remote_file: ${build_id}/windows-amd64/stitch-cli.exe
bucket: stitch-clis
content_type: application/octet-stream
permissions: public-read
post:
- command: gotest.parse_files
params:
files: ["*.suite"]
buildvariants:
- name: rhel70
display_name: rhel70
run_on:
- rhel70
expansions:
go_url: "https://dl.google.com/go/go1.13.linux-amd64.tar.gz"
server_stitch_lib_url: 'https://s3.amazonaws.com/mciuploads/mongodb-mongo-master/stitch-support/enterprise-rhel-70-64-bit/18ca0d551818d6c8274358b8e6444640bec93c88/stitch-support-4.3.0-120-g18ca0d5.tgz'
mongodb_url: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.2.tgz
transpiler_target: node8-linux
libmongo_url: 'https://s3.amazonaws.com/stitch-artifacts/stitch-mongo-libs/stitch_mongo_libs_linux_64_patch_f1f04683a9b5612f5a82a2d7f97818ef74a8fb05_5d898ee3306615699f265907_19_09_24_03_35_01/libmongo.so'
mongoDBCloudURL: https://cloud-dev.mongodb.com
stitchServerURL: http://localhost:9090
tasks:
- name: test_unit
- name: tests-with-cloud
- name: lint
- name: build_publish_clis