4
4
#
5
5
version : 2.1
6
6
7
- parameters :
8
- run_labeled_workflow :
9
- type : boolean
10
- default : false
11
- triggering_label :
12
- type : string
13
- default : " "
14
- vrt_mode :
15
- type : string
16
- default : " "
17
-
18
7
orbs :
19
8
20
9
heroku :
circleci/[email protected]
@@ -107,57 +96,6 @@ commands:
107
96
echo "=============================="
108
97
echo
109
98
110
- prepare-vrt :
111
- description : ' Prepare VRT environment'
112
- steps :
113
- - checkout
114
-
115
- - attach_workspace :
116
- at : workspace
117
-
118
- - node/install-npm
119
- - vrt-set-env-vars
120
- - add-applitools
121
- - node/install-packages
122
- - browser-tools/install-chrome
123
- - browser-tools/install-chromedriver
124
-
125
- - run :
126
- name : ' Prepare Storybook'
127
- command : ' npm run storybook:prepare'
128
-
129
- vrt-set-env-vars :
130
- description : ' Set VRT environment variables'
131
- steps :
132
- - set-github-pr-number
133
- - run : printenv | sort
134
-
135
- - run :
136
- name : ' Set environment variables'
137
- command : |
138
- echo 'export APPLITOOLS_BATCH_ID=${CIRCLE_SHA1}' >> $BASH_ENV
139
- echo 'export APPLITOOLS_BATCH_NAME="PR #${PR_NUMBER} (${CIRCLE_USERNAME})"' >> $BASH_ENV
140
- echo 'export APPLITOOLS_DONT_CLOSE_BATCHES="true"' >> $BASH_ENV
141
- echo 'export APPLITOOLS_BATCH_NOTIFY="true"' >> $BASH_ENV
142
- echo 'export REVIEW_APP_NAME=slds-storybook-pr-${PR_NUMBER}' >> $BASH_ENV
143
-
144
- vrt-close-batch :
145
- description : ' Notify Applitools that tests have completed'
146
- steps :
147
- - run :
148
- name : ' Applitools: close batch'
149
- command : |
150
- export GITHUB_SERVER=github.com
151
- url="https://salesforceuxeyesapi.applitools.com/api/externals/github/servers/${GITHUB_SERVER}/commit/${CIRCLE_SHA1}/complete?apiKey=${APPLITOOLS_API_KEY}"
152
- curl -X POST $url -H "Content-Type: application/json" --data "{'serverId': '${GITHUB_SERVER}', 'commitSha': '${CIRCLE_SHA1}'}" -v -L
153
-
154
- add-applitools :
155
- description : ' Add Applitools eyes-storybook module'
156
- steps :
157
- - run :
158
- name : Add Applitools eyes-storybook module
159
- command : ' npm i @applitools/eyes-storybook@latest --save-dev --package-lock-only'
160
-
161
99
get-pr-number :
162
100
description : ' Get Github pull-request number'
163
101
steps :
@@ -195,23 +133,6 @@ commands:
195
133
fi
196
134
fi
197
135
198
- launch-static-storybook :
199
- description : ' Launch local static Storybook server'
200
- steps :
201
- - attach_workspace :
202
- at : workspace
203
- - run :
204
- name : Decompress Storybook archive
205
- command : ' tar -xvf workspace/storybook.tar.gz'
206
- - run :
207
- name : Start server
208
- command : ' npx http-server .www'
209
- background : true
210
- - run :
211
- name : Poll until server is up
212
- shell : /bin/sh
213
- command : ' curl --connect-timeout 2 --max-time 2 --retry 50 --retry-delay 0 --retry-max-time 300 --retry-connrefused --ipv4 -q "http://localhost:8080"'
214
-
215
136
jobs :
216
137
# Init bits & bobs subsequent jobs require
217
138
init :
@@ -228,6 +149,7 @@ jobs:
228
149
name : Retrieve Github deployments
229
150
command : |
230
151
gh api /repos/salesforce-ux/design-system-internal/deployments --field ref=${CIRCLE_SHA1} --method GET | jq "map({ status: .statuses_url, url: .payload.web_url})" > workspace/gh-deployments.json
152
+ cat workspace/gh-deployments.json
231
153
232
154
- run :
233
155
name : Set Github deployments to "in progress"
@@ -373,86 +295,6 @@ jobs:
373
295
"salesforce_version": "'"$SALESFORCE_VERSION"'"
374
296
}'
375
297
376
- # Build static Storybook
377
- build-storybook :
378
- executor : slds-executor
379
- resource_class : medium+
380
-
381
- steps :
382
- - checkout
383
- - attach_workspace :
384
- at : workspace
385
- - copy-tokens-from-workspace
386
- - node/install-npm
387
- - node/install-packages :
388
- # version cache here to remove conflict between this job and other concurrent jobs (init, prepare, etc).
389
- cache-version : standard
390
-
391
- - run :
392
- name : Build static Storybook
393
- command : ' npm run storybook:build'
394
- environment :
395
- NODE_OPTIONS : --openssl-legacy-provider
396
-
397
- - run :
398
- name : Archive static Storybook
399
- command : ' tar -czvf workspace/storybook.tar.gz .www/ Procfile config/nginx.conf.erb heroku-start.sh app.json'
400
-
401
- - persist_to_workspace :
402
- root : workspace
403
- paths :
404
- - storybook.tar.gz
405
-
406
- # Publish Storybook to Heroku review app
407
- publish-storybook :
408
- executor : slds-executor
409
- resource_class : small
410
-
411
- steps :
412
- - attach_workspace :
413
- at : workspace
414
-
415
- - run :
416
- name : ' Only proceed if we have a Storybook app to update'
417
- command : |
418
- export HEROKU_RELEASE_STORYBOOK_APP_NAME=$(cat workspace/heroku-release-storybook-app-name.txt)
419
- if [[ ${HEROKU_RELEASE_STORYBOOK_APP_NAME} == "false" ]]; then
420
- circleci step halt
421
- fi
422
-
423
- - vrt-set-env-vars
424
-
425
- # Heroku
426
- - heroku/install
427
- - run :
428
- name : ' Install Heroku Build CLI plugin'
429
- command : ' heroku plugins:install heroku-builds'
430
-
431
- - run :
432
- name : ' Deploy to Heroku'
433
- command : |
434
- export HEROKU_RELEASE_STORYBOOK_APP_NAME=$(cat workspace/heroku-release-storybook-app-name.txt)
435
- if [[ ${HEROKU_RELEASE_STORYBOOK_APP_NAME} != "false" && ${PR_NUMBER} == "" ]]; then
436
- export PUBLISH_STORYBOOK_TO=${HEROKU_RELEASE_STORYBOOK_APP_NAME}
437
- else
438
- export PUBLISH_STORYBOOK_TO=${REVIEW_APP_NAME}
439
- fi
440
- echo "=============================="
441
- echo ${PUBLISH_STORYBOOK_TO}
442
- echo "=============================="
443
- heroku buildpacks -a ${PUBLISH_STORYBOOK_TO} | grep "https://github.com/salesforce-ux/heroku-buildpack-nginx.git#dse" || heroku buildpacks:set https://github.com/salesforce-ux/heroku-buildpack-nginx.git#dse -a ${PUBLISH_STORYBOOK_TO}
444
- heroku builds:create --source-tar workspace/storybook.tar.gz -a ${PUBLISH_STORYBOOK_TO}
445
-
446
- - gh/install
447
- - run :
448
- name : Set Github deployments to "success"
449
- command : |
450
- for row in $(jq -r '.[] | select(.url | contains("storybook")) | @base64' workspace/gh-deployments.json); do
451
- export STATUS_URL=$(echo ${row} | base64 --decode | jq -r ".status" | sed 's/https:\/\/api.github.com//')
452
- export SITE_URL=$(echo ${row} | base64 --decode | jq -r ".url")
453
- gh api ${STATUS_URL} -f state=success -f environment_url=${SITE_URL} -H "Accept: application/vnd.github.ant-man-preview+json"
454
- done
455
-
456
298
# Build & publish SLDS site (review app or upcoming/core-main/core-patch)
457
299
publish-site :
458
300
executor : slds-executor
@@ -538,18 +380,6 @@ workflows:
538
380
only : /.*/
539
381
requires :
540
382
- init
541
- - build-storybook :
542
- context : ux-eng-keys
543
- # do not run for future version tags (X.X.X-*)
544
- filters :
545
- tags :
546
- ignore : /^v\d+\.\d+\.\d+-.+$/
547
- requires :
548
- - prepare
549
- - publish-storybook :
550
- context : ux-eng-keys
551
- requires :
552
- - build-storybook
553
383
- framework-build :
554
384
context : ux-eng-keys
555
385
requires :
0 commit comments