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

File tree

5 files changed

+10
-1412
lines changed

5 files changed

+10
-1412
lines changed

.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
const currentBuildResults = 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
await git('fetch upstream');
119119
const baseCommit = await git(`merge-base HEAD upstream/${upstreamRef}`);
120120

121-
let resultsResponse = null;
121+
let previousBuildResults = null;
122122
try {
123123
let baseCIBuildId = null;
124124
const statusesResponse = await fetch(
@@ -153,8 +153,9 @@ function git(args) {
153153

154154
for (let i = 0; i < baseArtifactsInfo.length; i++) {
155155
const info = baseArtifactsInfo[i];
156-
if (info.path === 'home/circleci/project/scripts/rollup/results.json') {
157-
resultsResponse = await fetch(info.url);
156+
if (info.path === 'home/circleci/project/build/bundle-sizes.json') {
157+
const resultsResponse = await fetch(info.url);
158+
previousBuildResults = await resultsResponse.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-
const previousBuildResults = await resultsResponse.json();
174174
const results = 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)