Skip to content

Commit

Permalink
[Danger] Minor fixes (#12606)
Browse files Browse the repository at this point in the history
* Don't download bundle stats from master on CI

This was temporarily necessary in the past because we didn't have the logic that downloads actual *merge base* stats.

We do have that now as part of the Danger script. So we can remove this.

* Use absolute threshold for whether to show a change

* Download master stats, but only for other master builds

* Rewrite sizes
  • Loading branch information
gaearon authored Apr 11, 2018
1 parent 915bb53 commit c27a998
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 175 deletions.
6 changes: 2 additions & 4 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,12 @@ function git(args) {
previousBuildResults
);

const percentToWarrentShowing = 1;
const packagesToShow = results
.filter(
r =>
Math.abs(r.prevFileSizeChange) >= percentToWarrentShowing ||
Math.abs(r.prevGzipSizeChange) >= percentToWarrentShowing
Math.abs(r.prevFileSizeAbsoluteChange) >= 300 || // bytes
Math.abs(r.prevGzipSizeAbsoluteChange) >= 100 // bytes
)

.map(r => r.packageName);

if (packagesToShow.length) {
Expand Down
11 changes: 7 additions & 4 deletions scripts/circleci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

set -e

# Update the local size measurements to the master version
# so that the size diff printed at the end of the build is
# accurate.
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
# On master, download the bundle sizes from last master build so that
# the size printed in the CI logs for master commits is accurate.
# We don't do it for pull requests because those are compared against
# the merge base by Dangerfile instead. See https://github.com/facebook/react/pull/12606.
if [ -z "$CI_PULL_REQUEST" ]; then
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
fi

yarn build --extract-errors
# Note: since we run the full build including extracting error codes,
Expand Down
Loading

0 comments on commit c27a998

Please sign in to comment.