ci: always track and check payload size data for angular.io (#33987)

As part of the `payload-size` npm script in `aio/package.json` (which is
run on CI), the sizes of the angular.io app bundles are checked to
ensure they do not exceed certain limits and are also uploaded to
Firebase to be available for later analysis. The uploaded data include
the type of the changes (dependencies only, application only, or both).
The type of changes is inferred by looking at the files that have
changed inside the `aio/` directory.

When the `payload-size.sh` script was first introduced, the only files
that could affect bundle sizes were inside the `aio/` directory.
Therefore, the script would skip uploading the data and checking the
sizes if no changes were detected inside the `aio/` directory.

However, this assumption stopped being valid over time. For example:
- We started tracking/checking bundle sizes when building the angular.io
  app with the locally built Angular packages (which live outside the
  `aio/` directory.
- Due to CircleCI limitations, the `CI_COMMIT_RANGE` environment
  variable (which is used for determining what files have been affected)
  stopped reflecting the whole commit range of the build and only
  included the last commit instead.

Based on the above, there were many cases were size data would not be
uploaded to Firebase, even when they may have been affected (because the
affecting changes were outside `aio/` - e.g. in framework packages).
This makes it harder to analyze size regressions, because important
data-points are missing.

Even worse, in these cases, the sizes were not even checked against the
specified limits, thus making it possible for size regressions to go
unnoticed (unless caught by other similar tests).

This commit fixes the `scripts/ci/payload-size.sh` script to always
track and check payload sizes for angular.io bundles.

NOTE: This change will result in more data being recorded (i.e.
      recording data when it is not possible for the bundle sizes to
      have been affected by the changes). This is still preferable to
      failing to record and/or check when sizes could have been
      affected.

PR Close #33987
This commit is contained in:
George Kalpakas 2019-11-22 13:03:37 +02:00 committed by Matias Niemelä
parent 56f33bc266
commit 9bc8864d03
1 changed files with 3 additions and 2 deletions

View File

@ -103,8 +103,9 @@ addChangeType() {
elif [[ $allChangedFiles -gt 0 ]]; then
change='application'
else
# Nothing changed in aio/
exit 0
# Nothing changed inside $parentDir (but size may still be affected; e.g. when using the locally
# built packages)
change='other'
fi
payloadData="$payloadData\"change\": \"$change\", "
}