Skip to content

Stop tracking bundle sizes #15404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_STORE
node_modules
scripts/flow/*/.flowconfig
scripts/rollup/results.json
*~
*.pyc
.grunt
Expand Down
14 changes: 7 additions & 7 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ 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.
process.exit(0);
}

const currentBuildResults = JSON.parse(
readFileSync('./scripts/rollup/results.json')
readFileSync('./build/bundle-sizes.json')
);

/**
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions scripts/circleci/test_entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Loading