-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcircle.yml
235 lines (198 loc) · 11.1 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
machine:
node:
version: 6.2.0
ruby:
version: 2.2.0
dependencies:
pre:
- gem install aws-sdk
- npm install -g grunt-cli
- '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 --depth=0 > $CIRCLE_ARTIFACTS/package.lock
test:
override:
- npm test
- npm run karma
- npm run lint
deployment:
features:
branch: /^(?!(?:dev|master)$).+$/
commands:
# Upload dist
- grunt browserify:bundle
- grunt browserify: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
- grunt browserify:bundle
- grunt browserify: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
# 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/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
- grunt browserify:bundle
- grunt browserify: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
# 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