forked from clkao/hlsjs-p2p-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
circle.yml
376 lines (315 loc) · 18.6 KB
/
circle.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
370
371
372
373
374
375
machine:
node:
version: 6.2.0
ruby:
version: 2.2.0
dependencies:
pre:
- gem install aws-sdk
- npm install -g webpack
- 'echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc'
# Clone tool
- git config --global user.email $STREAMROOT_EMAIL
- git config --global user.name $STREAMROOT_USERNAME
- git clone [email protected]:streamroot/toolkit.git
# Set peer-agent version
- toolkit/set_dependency_version.rb --exclude_branches master
--dependency_path dependencies.streamroot-p2p
--version beta
- npm prune
override:
- npm update
post:
- npm ls > $CIRCLE_ARTIFACTS/package.lock
test:
override:
- npm test
- npm run karma
- npm run lint
deployment:
features:
branch: /^(?!(?:dev|master)$).+$/
commands:
# Upload dist
- npm run build:bundle
- npm run build:wrapper
- toolkit/add_banner.rb --file dist/bundle/$DIST_BUNDLE
--deploy_env $CIRCLE_BRANCH
--dependencies streamroot-p2p hls.js
--name $BUNDLE_NAME
- toolkit/add_banner.rb --file dist/wrapper/$DIST_WRAPPER
--deploy_env $CIRCLE_BRANCH
--dependencies streamroot-p2p
- cp dist/bundle/$DIST_BUNDLE $CIRCLE_ARTIFACTS/$DIST_BUNDLE
- cp dist/wrapper/$DIST_WRAPPER $CIRCLE_ARTIFACTS/$DIST_WRAPPER
- toolkit/upload_to_s3.rb --bucket $S3_FEATURES_BUCKET
--region eu-west-1
--file $CIRCLE_ARTIFACTS/$DIST_BUNDLE
--destinations $CIRCLE_PROJECT_REPONAME/$CIRCLE_BRANCH/$DIST_BUNDLE
--key $S3_KEY
--secret $S3_SECRET
- toolkit/upload_to_s3.rb --bucket $S3_FEATURES_BUCKET
--region eu-west-1
--file $CIRCLE_ARTIFACTS/$DIST_WRAPPER
--destinations $CIRCLE_PROJECT_REPONAME/$CIRCLE_BRANCH/$DIST_WRAPPER
--key $S3_KEY
--secret $S3_SECRET
staging:
branch: dev
commands:
# Clone tools
- git clone [email protected]:streamroot/bridge.git
# Cleanup
- rm -rf dist
# Set version
- toolkit/set_version.rb --version $(toolkit/current_version.rb --beta ${CIRCLE_BUILD_NUM})
# Generate dist
- npm run build:bundle
- npm run build:wrapper
- toolkit/add_banner.rb --file dist/bundle/$DIST_BUNDLE
--deploy_env staging
--version $(toolkit/current_version.rb)
--dependencies streamroot-p2p hls.js
--name $BUNDLE_NAME
- toolkit/add_banner.rb --file dist/wrapper/$DIST_WRAPPER
--deploy_env staging
--version $(toolkit/current_version.rb)
--dependencies streamroot-p2p
- cp dist/bundle/$DIST_BUNDLE $CIRCLE_ARTIFACTS/$DIST_BUNDLE
- cp dist/wrapper/$DIST_WRAPPER $CIRCLE_ARTIFACTS/$DIST_WRAPPER
# Build package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$DIST_BUNDLE
--name $BUNDLE_NAME
-o dist/bundle/package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$DIST_WRAPPER
--name $WRAPPER_NAME
-o dist/wrapper/package.json
# Copy sources (lib) into wrapper dist folder
# We ship the sources to be able to access private API
# for integration testing usage
- cp -R lib dist/wrapper/
# Publish
- npm publish dist/bundle --tag beta
- npm publish dist/wrapper --tag beta
# Upload version
- toolkit/upload_to_s3.rb --bucket $S3_STAGING_BUCKET
--region eu-west-1
--file $CIRCLE_ARTIFACTS/$DIST_BUNDLE
--destinations $CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb)/$DIST_BUNDLE
$CIRCLE_PROJECT_REPONAME/latest/$DIST_BUNDLE
--key $S3_KEY
--secret $S3_SECRET
- toolkit/upload_to_s3.rb --bucket $S3_STAGING_BUCKET
--region eu-west-1
--file $CIRCLE_ARTIFACTS/$DIST_WRAPPER
--destinations $CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb)/$DIST_WRAPPER
$CIRCLE_PROJECT_REPONAME/latest/$DIST_WRAPPER
--key $S3_KEY
--secret $S3_SECRET
#
## Debug builds
#
# Cleanup
- rm -rf dist
# Install debug peer-agent
- rm -rf node_modules/streamroot-p2p
- npm install @streamroot/peer-agent-debug@beta
- mv node_modules/@streamroot/peer-agent-debug node_modules/streamroot-p2p
# Generate dist
- npm run build:bundle
- npm run build:wrapper
- toolkit/add_banner.rb --file dist/bundle/$DIST_BUNDLE
--deploy_env staging
--version $(toolkit/current_version.rb)
--dependencies @streamroot/peer-agent-debug hls.js
--name $BUNDLE_NAME-debug
- toolkit/add_banner.rb --file dist/wrapper/$DIST_WRAPPER
--deploy_env staging
--version $(toolkit/current_version.rb)
--dependencies @streamroot/peer-agent-debug
- cp dist/bundle/$DIST_BUNDLE $CIRCLE_ARTIFACTS/$BUNDLE_NAME.debug.js
- cp dist/wrapper/$DIST_WRAPPER $CIRCLE_ARTIFACTS/$WRAPPER_NAME.debug.js
# Build package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$BUNDLE_NAME.debug.js
--name @streamroot/hlsjs-p2p-bundle-debug
-o dist/bundle/package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$WRAPPER_NAME.debug.js
--name @streamroot/hlsjs-p2p-wrapper-debug
-o dist/wrapper/package.json
# Copy sources (lib) into wrapper dist folder
# We ship the sources to be able to access private API
# for integration testing usage
- cp -R lib dist/wrapper/
# Publish
- npm publish dist/bundle --tag beta
- npm publish dist/wrapper --tag beta
#
## End Debug builds
#
# Generate manifest
- toolkit/build_manifest.rb --name "Hls.js Wrapper/Bundle"
--version $(toolkit/current_version.rb)
--platform "web"
--artifacts ./$DIST_BUNDLE ./$DIST_WRAPPER
--debug-artifacts "https://circleci.com/api/v1/project/streamroot/hlsjs-p2p-wrapper/$CIRCLE_BUILD_NUM/artifacts/0/\$CIRCLE_ARTIFACTS/$BUNDLE_NAME.debug.js"
"https://circleci.com/api/v1/project/streamroot/hlsjs-p2p-wrapper/$CIRCLE_BUILD_NUM/artifacts/0/\$CIRCLE_ARTIFACTS/$WRAPPER_NAME.debug.js"
--doc "https://github.com/streamroot/hlsjs-p2p-wrapper/tree/dev"
--output $CIRCLE_ARTIFACTS/manifest.yml
- toolkit/upload_to_s3.rb --bucket staging.streamroot.io
--region eu-west-1
--file $CIRCLE_ARTIFACTS/manifest.yml
--destinations $CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb)/manifest.yml
$CIRCLE_PROJECT_REPONAME/latest/manifest.yml
--key $S3_KEY
--secret $S3_SECRET
# Changelog
- toolkit/post_changelog.rb --project $CIRCLE_PROJECT_REPONAME
--env staging
--subtitle $POST_SUBTITLE
--channel $SLACK_CHANNEL
--slack-token $SLACK_TOKEN
--username $POST_USERNAME
--icon-url $POST_PICTURE
# Run bridge
- bridge/run.rb --current_module $CIRCLE_PROJECT_REPONAME --trigger_branch dev --token $BRIDGE_TOKEN
preprod:
branch: master
commands:
# Clone tools
- git clone [email protected]:streamroot/bridge.git
# Update version
- toolkit/update_version.rb
# Changelog
- toolkit/update_changelog_with_parent_dep.rb --module-name $TRIGGERED_FROM_MODULE
- toolkit/bump_current_changelog.rb --version $(toolkit/current_version.rb)
# Keep dev up to date
- toolkit/merge_branch.rb --from_branch master
--to_branch dev
--skip_ci
--avoid_files package.json
--project_name $CIRCLE_PROJECT_REPONAME
--slack_channel $SLACK_CHANNEL
--slack_token $SLACK_TOKEN
--post_username $POST_USERNAME
--post_icon_url $POST_PICTURE
# Cleanup
- rm -rf dist
# Generate dist
- npm run build:bundle
- npm run build:wrapper
- toolkit/add_banner.rb --file dist/bundle/$DIST_BUNDLE
--version $(toolkit/current_version.rb)
--dependencies streamroot-p2p hls.js
--name $BUNDLE_NAME
- toolkit/add_banner.rb --file dist/wrapper/$DIST_WRAPPER
--version $(toolkit/current_version.rb)
--dependencies streamroot-p2p
- cp dist/bundle/$DIST_BUNDLE $CIRCLE_ARTIFACTS/$DIST_BUNDLE
- cp dist/wrapper/$DIST_WRAPPER $CIRCLE_ARTIFACTS/$DIST_WRAPPER
# Build package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$DIST_BUNDLE
--name $BUNDLE_NAME
-o dist/bundle/package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$DIST_WRAPPER
--name $WRAPPER_NAME
-o dist/wrapper/package.json
# Copy sources (lib) into wrapper dist folder
# We ship the sources to be able to access private API
# for integration testing usage
- cp -R lib dist/wrapper/
# Publish
- npm publish dist/bundle --tag rc
- npm publish dist/wrapper --tag rc
# Upload version
- toolkit/upload_to_s3.rb --bucket $S3_PREPROD_BUCKET
--region eu-west-1
--file $CIRCLE_ARTIFACTS/$DIST_BUNDLE
--destinations $CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb --major)/$DIST_BUNDLE
$CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb --no_patch)/$DIST_BUNDLE
$CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb)/$DIST_BUNDLE
$CIRCLE_PROJECT_REPONAME/latest/$DIST_BUNDLE
--key $S3_KEY
--secret $S3_SECRET
- toolkit/upload_to_s3.rb --bucket $S3_PREPROD_BUCKET
--region eu-west-1
--file $CIRCLE_ARTIFACTS/$DIST_WRAPPER
--destinations $CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb --major)/$DIST_WRAPPER
$CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb --no_patch)/$DIST_WRAPPER
$CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb)/$DIST_WRAPPER
$CIRCLE_PROJECT_REPONAME/latest/$DIST_WRAPPER
--key $S3_KEY
--secret $S3_SECRET
#
## Debug builds
#
# Cleanup
- rm -rf dist
# Install debug peer-agent
- rm -rf node_modules/streamroot-p2p
- npm install @streamroot/peer-agent-debug
- mv node_modules/@streamroot/peer-agent-debug node_modules/streamroot-p2p
# Generate dist
- npm run build:bundle
- npm run build:wrapper
- toolkit/add_banner.rb --file dist/bundle/$DIST_BUNDLE
--version $(toolkit/current_version.rb)
--dependencies @streamroot/peer-agent-debug hls.js
--name $BUNDLE_NAME-debug
- toolkit/add_banner.rb --file dist/wrapper/$DIST_WRAPPER
--version $(toolkit/current_version.rb)
--dependencies @streamroot/peer-agent-debug
- cp dist/bundle/$DIST_BUNDLE $CIRCLE_ARTIFACTS/$BUNDLE_NAME.debug.js
- cp dist/wrapper/$DIST_WRAPPER $CIRCLE_ARTIFACTS/$WRAPPER_NAME.debug.js
# Build package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$BUNDLE_NAME.debug.js
--name @streamroot/hlsjs-p2p-bundle-debug
-o dist/bundle/package.json
- toolkit/build_dist_package.rb --version $(toolkit/current_version.rb)
--main ./$WRAPPER_NAME.debug.js
--name @streamroot/hlsjs-p2p-wrapper-debug
-o dist/wrapper/package.json
# Copy sources (lib) into wrapper dist folder
# We ship the sources to be able to access private API
# for integration testing usage
- cp -R lib dist/wrapper/
# Publish
- npm publish dist/bundle --tag rc
- npm publish dist/wrapper --tag rc
#
## End Debug builds
#
# Generate manifest
- toolkit/build_manifest.rb --name "Hls.js Wrapper/Bundle"
--version $(toolkit/current_version.rb)
--platform "web"
--artifacts ./$DIST_BUNDLE ./$DIST_WRAPPER
--debug-artifacts "https://circleci.com/api/v1/project/streamroot/hlsjs-p2p-wrapper/$CIRCLE_BUILD_NUM/artifacts/0/\$CIRCLE_ARTIFACTS/$BUNDLE_NAME.debug.js"
"https://circleci.com/api/v1/project/streamroot/hlsjs-p2p-wrapper/$CIRCLE_BUILD_NUM/artifacts/0/\$CIRCLE_ARTIFACTS/$WRAPPER_NAME.debug.js"
--doc "https://github.com/streamroot/hlsjs-p2p-wrapper"
--output $CIRCLE_ARTIFACTS/manifest.yml
- toolkit/upload_to_s3.rb --bucket preprod.streamroot.io
--region eu-west-1
--file $CIRCLE_ARTIFACTS/manifest.yml
--destinations $CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb --major)/manifest.yml
$CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb --no_patch)/manifest.yml
$CIRCLE_PROJECT_REPONAME/$(toolkit/current_version.rb)/manifest.yml
$CIRCLE_PROJECT_REPONAME/latest/manifest.yml
--key $S3_KEY
--secret $S3_SECRET
# Changelog
- toolkit/post_changelog.rb --project $CIRCLE_PROJECT_REPONAME
--env preprod
--subtitle $POST_SUBTITLE
--channel $PREPROD_SLACK_CHANNEL
--slack-token $SLACK_TOKEN
--username $POST_USERNAME
--icon-url $POST_PICTURE
# Run bridge
- bridge/run.rb --current_module $CIRCLE_PROJECT_REPONAME --trigger_branch master --token $BRIDGE_TOKEN