forked from AugurProject/augur
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
369 lines (361 loc) · 12.6 KB
/
azure-pipelines.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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# adding artifact caching: https://github.com/Microsoft/azure-pipelines-artifact-caching-tasks/blob/master/README.md
variables:
SOLC_VERSION: v0.4.24
SOLC_MD5: dc791cd7db87b7df5e47975d222dc5fe
DOCKER_CI_BUILD_TAG: monorepo.$(Build.BuildID)
CORE_IMAGE_BUILD: augurproject/augur-core:$(DOCKER_CI_BUILD_TAG)
CORE_IMAGE_LATEST: augurproject/augur-core:monorepo
trigger:
batch: false
branches:
include:
- master
- azure/*
jobs:
- job: PreFlightCheck
displayName: 'Pre-Flight Check'
pool:
vmImage: 'Ubuntu 16.04'
steps:
- checkout: self
- bash: |
set -euo pipefail
echo "Build Source Branch: $(Build.SourceBranchName)"
if [[ "$(Build.SourceBranchName)" == "master" ]]; then
GIT_COMMAND='git log -m -1 --name-only --pretty="format:" $(Build.SourceVersion)'
else
GIT_COMMAND='git diff --name-only origin/master..HEAD'
fi
echo "running git command: $GIT_COMMAND"
for f in $(eval "$GIT_COMMAND");
do
echo "$f"
if [[ $f =~ .*augur-core/.* ]]
then
echo "found a core change: $f"
echo "##vso[task.setvariable variable=JOB_TRIGGER_CORE;isOutput=true]true"
fi
if [[ $f =~ .*augur-ui.* ]]
then
echo "found a ui change: $f"
echo "##vso[task.setvariable variable=JOB_TRIGGER_UI;isOutput=true]true"
fi
if [[ $f =~ .*augur-sdk.* ]]
then
echo "found a sdk change: $f"
echo "##vso[task.setvariable variable=JOB_TRIGGER_SDK;isOutput=true]true"
fi
done
displayName: check git for changes
name: setVars
- job: TestAndLint
dependsOn:
- PreFlightCheck
condition: |
and
(
succeeded(),
ne(variables['Build.SourceBranch'], 'refs/heads/master')
)
variables:
JOB_TRIGGER_UI: $[dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_UI']]
JOB_TRIGGER_SDK: $[dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_SDK']]
JOB_TRIGGER_CORE: $[dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_CORE']]
pool:
vmImage: 'Ubuntu 16.04'
strategy:
matrix:
node_10_x:
node_version: 10.x
steps:
- checkout: self
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
inputs:
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: npmPackages
- script: |
yarn install
displayName: Install Dependencies
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
inputs:
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: npmPackages
- bash: |
set -euo pipefail
yarn build
displayName: yarn build
- bash: |
set -euo pipefail
yarn test --ci --reporters=default --reporters=jest-junit
displayName: yarn test
- bash: |
set -euo pipefail
yarn workspace @augurproject/sdk test
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: '**/junit.xml'
- job: Augur_build_docker_image
dependsOn:
- TestAndLint
- PreFlightCheck
condition: |
and
(
succeeded(),
eq(dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_CORE'], 'true')
)
pool:
vmImage: 'Ubuntu 16.04'
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- task: NodeTool@0
inputs:
versionSpec: '10.x'
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
inputs:
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: npmPackages
- script: |
yarn install
displayName: Install Dependencies
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
inputs:
keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: npmPackages
- bash: |
set -euo pipefail
yarn build
displayName: yarn build
- bash: |
set -euo pipefail
yarn docker:build:augur
docker images
docker tag augurproject/augur-build:latest augurproject/augur-build:$(DOCKER_CI_BUILD_TAG)
docker push augurproject/augur-build:$(DOCKER_CI_BUILD_TAG)
displayName: docker build
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- job: Build_Core_Docker
dependsOn:
- TestAndLint
- Augur_build_docker_image
- PreFlightCheck
condition: |
and
(
succeeded(),
eq(dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_CORE'], 'true')
)
pool:
vmImage: 'Ubuntu 16.04'
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- task: NodeTool@0
inputs:
versionSpec: '10.x'
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- script: |
docker pull $CORE_IMAGE_LATEST;
displayName: augur-core pull
- script: |
set -euo pipefail
docker images
docker pull augurproject/augur-build:$(DOCKER_CI_BUILD_TAG)
docker tag augurproject/augur-build:$(DOCKER_CI_BUILD_TAG) augurproject/augur-build:latest
docker images
yarn workspace @augurproject/core docker:build;
displayName: augur-core docker image
- script: |
contract_sha=$(cd packages/augur-tools/ && node scripts/get-contract-hashes.js)
docker tag $CORE_IMAGE_LATEST $CORE_IMAGE_BUILD;
docker tag $CORE_IMAGE_LATEST augurproject/augur-core:$contract_sha;
docker push $CORE_IMAGE_BUILD
docker push augurproject/augur-core:$contract_sha
displayName: augur-core push
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- job: Test_Augur_Core
dependsOn:
- TestAndLint
- Build_Core_Docker
- PreFlightCheck
condition: |
and
(
succeeded(),
eq(dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_CORE'], 'true'),
ne(variables['Build.SourceBranch'], 'refs/heads/master')
)
pool:
vmImage: 'Ubuntu 16.04'
timeoutInMinutes: 120
strategy:
maxParallel: 5
matrix:
trading_and_libs:
TESTS: tests/test*.py tests/libraries tests/trading
reporting:
TESTS: tests/reporting
fuzzy:
TESTS: tests/fuzzy
unit:
TESTS: tests/unit
# trading_and_libs_subfork:
# TESTS: tests/test*.py tests/libraries tests/trading --subFork
# reporting_subfork:
# TESTS: tests/reporting --subFork
# fuzzy_subfork:
# TESTS: tests/fuzzy --subFork
# unit_subfork:
# TESTS: tests/unit --subFork
geth_integration:
TESTS: integration:geth
parity_integration:
TESTS: integration:parity
security_mithril:
TESTS: security:mythril
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- task: NodeTool@0
inputs:
versionSpec: '10.15'
- bash: |
set -euo pipefail
which node
node --version
docker pull augurproject/augur-build:$(DOCKER_CI_BUILD_TAG)
docker tag augurproject/augur-build:$(DOCKER_CI_BUILD_TAG) augurproject/augur-build:latest
docker pull $CORE_IMAGE_BUILD
docker tag $CORE_IMAGE_BUILD $CORE_IMAGE_LATEST
docker images
echo "tests: $(TESTS)"
if [[ "$(TESTS)" == "integration:geth" ]]; then
yarn workspace @augurproject/core docker:run:test:integration:geth;
elif [[ "$(TESTS)" == "integration:parity" ]]; then
yarn workspace @augurproject/core docker:run:test:integration:parity;
elif [[ "$(TESTS)" == "security:mythril" ]]; then
yarn workspace @augurproject/core docker:run:test:security:mythril;
cat $(find . -name test-results.log)
elif [[ "$(TESTS)" == "security:maian" ]]; then
yarn workspace @augurproject/core docker:run:test:security:maian;
elif [[ "$(TESTS)" == "security:smt" ]]; then
yarn workspace @augurproject/core docker:run:test:security:smt;
elif [[ "$(TESTS)" == "security:oyente" ]]; then
yarn workspace @augurproject/core docker:run:test:security:oyente;
else
(cd packages/augur-core && yarn docker:run:test:unit -- $(TESTS))
fi
displayName: integration tests
- job: Docker_populated_geth_images
dependsOn:
- Test_Augur_Core
- PreFlightCheck
condition: |
and
(
succeeded(),
eq(dependencies.PreFlightCheck.outputs['setVars.JOB_TRIGGER_CORE'], 'true')
)
pool:
vmImage: 'Ubuntu 16.04'
timeoutInMinutes: 120
steps:
- checkout: self
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- script: |
set -exuo pipefail
sudo modprobe -r overlay && sudo modprobe overlay redirect_dir=off && sudo systemctl restart docker
sudo systemctl status docker
docker pull augurproject/augur-build:$(DOCKER_CI_BUILD_TAG)
docker pull augurproject/augur-core:$(DOCKER_CI_BUILD_TAG)
docker tag augurproject/augur-build:$(DOCKER_CI_BUILD_TAG) augurproject/augur-build:latest
docker tag augurproject/augur-core:$(DOCKER_CI_BUILD_TAG) augurproject/augur-core:monorepo
docker images
yarn
yarn workspace @augurproject/tools docker:build
if [[ "$(Build.SourceBranchName)" == "master" ]]; then
docker push augurproject/augur-core:monorepo
fi
yarn workspace @augurproject/tools docker:push
displayName: 'build and push core images'
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- job: publish_docker_images
dependsOn:
- Augur_build_docker_image
- Build_Core_Docker
- Test_Augur_Core
condition: |
and
(
succeeded(),
eq(variables['Build.SourceBranch'], 'refs/heads/master')
)
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- script: |
set -euo pipefail
docker pull augurproject/augur-build:$(DOCKER_CI_BUILD_TAG)
docker tag augurproject/augur-build:$(DOCKER_CI_BUILD_TAG) augurproject/augur-build:latest
docker images
docker push augurproject/augur-build:latest
displayName: 'publish docker images on merge to master'
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject