Skip to content

Commit 38bd570

Browse files
authored
Stop tracking bundle sizes (#15404)
* [sizebot] Fail gracefully if CI returns invalid response Moves the `response.json()` call into the catch block. * Stop tracking bundle sizes
1 parent 3438e5c commit 38bd570

5 files changed

Lines changed: 10 additions & 1412 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
path: ./build.tgz
4848

4949
- store_artifacts:
50-
path: ./scripts/rollup/results.json
50+
path: ./build/bundle-sizes.json
5151

5252
- store_artifacts:
5353
path: ./scripts/error-codes/codes.json

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_STORE
22
node_modules
33
scripts/flow/*/.flowconfig
4+
scripts/rollup/results.json
45
*~
56
*.pyc
67
.grunt

‎dangerfile.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const {generateResultsArray} = require('./scripts/rollup/stats');
3232
const{existsSync, readFileSync}=require('fs');
3333
const{exec}=require('child_process');
3434

35-
if(!existsSync('./scripts/rollup/results.json')){
35+
if(!existsSync('./build/bundle-sizes.json')){
3636
// This indicates the build failed previously.
3737
// In that case, there's nothing for the Dangerfile to do.
3838
// Exit early to avoid leaving a redundant (and potentially confusing) PR comment.
3939
process.exit(0);
4040
}
4141

4242
constcurrentBuildResults=JSON.parse(
43-
readFileSync('./scripts/rollup/results.json')
43+
readFileSync('./build/bundle-sizes.json')
4444
);
4545

4646
/**
@@ -118,7 +118,7 @@ function git(args) {
118118
awaitgit('fetch upstream');
119119
constbaseCommit=awaitgit(`merge-base HEAD upstream/${upstreamRef}`);
120120

121-
letresultsResponse=null;
121+
letpreviousBuildResults=null;
122122
try{
123123
letbaseCIBuildId=null;
124124
conststatusesResponse=awaitfetch(
@@ -153,8 +153,9 @@ function git(args) {
153153

154154
for(leti=0;i<baseArtifactsInfo.length;i++){
155155
constinfo=baseArtifactsInfo[i];
156-
if(info.path==='home/circleci/project/scripts/rollup/results.json'){
157-
resultsResponse=awaitfetch(info.url);
156+
if(info.path==='home/circleci/project/build/bundle-sizes.json'){
157+
constresultsResponse=awaitfetch(info.url);
158+
previousBuildResults=awaitresultsResponse.json();
158159
break;
159160
}
160161
}
@@ -163,14 +164,13 @@ function git(args) {
163164
return;
164165
}
165166

166-
if(resultsResponse===null){
167+
if(previousBuildResults===null){
167168
warn(`Could not find build artifacts for base commit: ${baseCommit}`);
168169
return;
169170
}
170171

171172
// Take the JSON of the build response and
172173
// make an array comparing the results for printing
173-
constpreviousBuildResults=awaitresultsResponse.json();
174174
constresults=generateResultsArray(
175175
currentBuildResults,
176176
previousBuildResults

‎scripts/circleci/test_entry_point.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
3030
COMMANDS_TO_RUN+=('./scripts/circleci/build.sh')
3131
COMMANDS_TO_RUN+=('yarn test-build --maxWorkers=2')
3232
COMMANDS_TO_RUN+=('yarn test-build-prod --maxWorkers=2')
33+
COMMANDS_TO_RUN+=('cp ./scripts/rollup/results.json ./build/bundle-sizes.json')
3334
COMMANDS_TO_RUN+=('node ./scripts/tasks/danger')
3435
COMMANDS_TO_RUN+=('./scripts/circleci/upload_build.sh')
3536
COMMANDS_TO_RUN+=('./scripts/circleci/pack_and_store_artifact.sh')

0 commit comments

Comments
 (0)