File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed
Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 77/coverage
88
99# production
10- /build
1110/dist
1211
1312# misc
Original file line number Diff line number Diff line change @@ -3,6 +3,20 @@ node_js:
33 - 7
44cache :
55 yarn : true
6+ directories :
7+ - node_modules
8+
9+ before_install :
10+ - pip install --user awscli
11+ - export PATH=$PATH:$HOME/.local/bin
12+
613script :
714 - yarn run coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
815 - yarn run build
16+ - yarn run build-storybook
17+ - node ./build/aws-deploy.js
18+
19+ after_script :
20+ # TODO comment on PR with link to PR storybook on S3 and notify slack room
21+ - echo "PR storybook can be found at:"
22+ - echo "http://react-audio-vis-prs.s3-ap-southeast-2.amazonaws.com/$TRAVIS_PULL_REQUEST_BRANCH/index.html"
Original file line number Diff line number Diff line change 1+ const execSync = require ( 'child_process' ) . execSync ;
2+
3+ const isPrBuild = ( prBranch ) => {
4+ return prBranch && prBranch !== "master" ;
5+ } ;
6+
7+ const staticSizeNotTooLarge = ( staticBookSize ) => {
8+ const tenMB = 10 * ( 2 << 9 ) ;
9+ return ! isNaN ( staticBookSize ) && staticBookSize < tenMB ;
10+ } ;
11+
12+ const { TRAVIS_PULL_REQUEST_BRANCH : prBranch } = process . env ;
13+ console . log ( prBranch ) ;
14+ if ( isPrBuild ( prBranch ) ) {
15+ const result = execSync ( `du -sk storybook-static | sed 's/[^0-9]*//g'` ) ;
16+ const staticBookSize = Number . parseInt ( result . toString ( ) ) ;
17+
18+ if ( staticSizeNotTooLarge ( staticBookSize ) ) {
19+ const result = execSync (
20+ `aws s3 cp ${ __dirname } /../storybook-static s3://react-audio-vis-prs/${ prBranch } --recursive` ,
21+ { stdio : [ 0 , 1 , 2 ] }
22+ ) ;
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments