-
Notifications
You must be signed in to change notification settings - Fork 100
/
azure-pipelines.yml
174 lines (169 loc) · 4.98 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
variables:
NODE_JS_VERSION: 10.15.0
trigger:
branches:
include:
- master
- sneakpeak
- azure/*
tags:
include:
- v*
jobs:
- job: test_ui
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- bash: |
yarn
yarn lint
yarn test
# This is here to confirm the build works.
# Nothing is done with the resulting artifacts.
yarn build --dev
displayName: 'lint, test, and build'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'junit.xml'
- job: deploy_ui_on_master
dependsOn:
- test_ui
strategy:
maxParallel: 3
matrix:
dev:
RELEASE_ENV: dev
kovan:
RELEASE_ENV: kovan
dev-optimized:
RELEASE_ENV: dev-optimized
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euxo pipefail
npm run docker:release -- $(RELEASE_ENV)
displayName: docker release $(RELEASE_ENV)
env:
AWS_ACCESS_KEY_ID: $(AWS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_KEY)
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
condition: |
and
(
succeeded(),
eq(variables['Build.SourceBranch'], 'refs/heads/master')
)
- job: deploy_ui_on_sneakpreview
dependsOn:
- test_ui
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euxo pipefail
npm run docker:release -- sneakpeak
displayName: docker release sneakpeak
env:
AWS_ACCESS_KEY_ID: $(AWS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_KEY)
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
condition: |
and
(
succeeded(),
eq(variables['Build.SourceBranch'], 'refs/heads/sneakpeak')
)
- job: tag_build
displayName: build tag
dependsOn:
- test_ui
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euo pipefail
current_tag=$(git describe --exact-match --tags)
if [[ -n $current_tag ]]; then
echo "${current_tag}"
LATEST_VERSION_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
DEV_VERSION_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
if [[ $current_tag =~ $LATEST_VERSION_REGEX ]]; then
echo "##vso[task.setvariable variable=npm_tag]latest"
npm run docker:release -- latest
elif [[ $current_tag =~ $DEV_VERSION_REGEX ]]; then
echo "##vso[task.setvariable variable=npm_tag]dev"
else
# we should never get here
echo "tag ${current_tag} doesn't match semver"
echo "##vso[task.setvariable variable=npm_tag]random"
fi
fi
displayName: set npm tag
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euo pipefail
yarn
yarn build
- task: Npm@1
inputs:
command: 'custom' # Options: install, publish, custom
verbose: true
customCommand: publish --tag $(npm_tag)
customRegistry: 'useNpmrc'
customEndpoint: npmjs-augur-integration
condition: |
and
(
succeeded(),
startsWith(variables['build.sourceBranch'], 'refs/tags/v')
)