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
This commit is contained in:
Andrew Clark
2019-04-12 13:33:27 -07:00
committed by GitHub
parent 3438e5ce87
commit 38bd570d41
5 changed files with 10 additions and 1412 deletions

View File

@@ -47,7 +47,7 @@ jobs:
path: ./build.tgz
- store_artifacts:
path: ./scripts/rollup/results.json
path: ./build/bundle-sizes.json
- store_artifacts:
path: ./scripts/error-codes/codes.json

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
.DS_STORE
node_modules
scripts/flow/*/.flowconfig
scripts/rollup/results.json
*~
*.pyc
.grunt

View File

@@ -32,7 +32,7 @@ const {generateResultsArray} = require('./scripts/rollup/stats');
const {existsSync, readFileSync} = require('fs');
const {exec} = require('child_process');
if (!existsSync('./scripts/rollup/results.json')) {
if (!existsSync('./build/bundle-sizes.json')) {
// This indicates the build failed previously.
// In that case, there's nothing for the Dangerfile to do.
// Exit early to avoid leaving a redundant (and potentially confusing) PR comment.
@@ -40,7 +40,7 @@ if (!existsSync('./scripts/rollup/results.json')) {
}
const currentBuildResults = JSON.parse(
readFileSync('./scripts/rollup/results.json')
readFileSync('./build/bundle-sizes.json')
);
/**
@@ -118,7 +118,7 @@ function git(args) {
await git('fetch upstream');
const baseCommit = await git(`merge-base HEAD upstream/${upstreamRef}`);
let resultsResponse = null;
let previousBuildResults = null;
try {
let baseCIBuildId = null;
const statusesResponse = await fetch(
@@ -153,8 +153,9 @@ function git(args) {
for (let i = 0; i < baseArtifactsInfo.length; i++) {
const info = baseArtifactsInfo[i];
if (info.path === 'home/circleci/project/scripts/rollup/results.json') {
resultsResponse = await fetch(info.url);
if (info.path === 'home/circleci/project/build/bundle-sizes.json') {
const resultsResponse = await fetch(info.url);
previousBuildResults = await resultsResponse.json();
break;
}
}
@@ -163,14 +164,13 @@ function git(args) {
return;
}
if (resultsResponse === null) {
if (previousBuildResults === null) {
warn(`Could not find build artifacts for base commit: ${baseCommit}`);
return;
}
// Take the JSON of the build response and
// make an array comparing the results for printing
const previousBuildResults = await resultsResponse.json();
const results = generateResultsArray(
currentBuildResults,
previousBuildResults

View File

@@ -30,6 +30,7 @@ if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./scripts/circleci/build.sh')
COMMANDS_TO_RUN+=('yarn test-build --maxWorkers=2')
COMMANDS_TO_RUN+=('yarn test-build-prod --maxWorkers=2')
COMMANDS_TO_RUN+=('cp ./scripts/rollup/results.json ./build/bundle-sizes.json')
COMMANDS_TO_RUN+=('node ./scripts/tasks/danger')
COMMANDS_TO_RUN+=('./scripts/circleci/upload_build.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/pack_and_store_artifact.sh')

File diff suppressed because it is too large Load Diff