mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: round payload size for comparison (#7174)
In some cases the payload is still showing up in the CI even if there was no change to the library. This seems to be because the file sizes are not rounded and can sometimes be not very exact. Resulting in numbers like: `material_fesm_2014": 1004.1319999999998`. To have a better output in the GitHub statuses, the file size should be rounded
This commit is contained in:
committed by
Jeremy Elbourn
parent
39c7b8124d
commit
3948381d64
@@ -93,10 +93,10 @@ async function calculatePayloadDiff(database: firebaseAdmin.database.Database, c
|
||||
|
||||
// Calculate the payload diffs by subtracting the previous size of the FESM ES2015 bundles.
|
||||
const cdkFullSize = currentPayload.cdk_fesm_2015;
|
||||
const cdkDiff = cdkFullSize - previousPayload.cdk_fesm_2015;
|
||||
const cdkDiff = roundFileSize(cdkFullSize - previousPayload.cdk_fesm_2015);
|
||||
|
||||
const materialFullSize = currentPayload.material_fesm_2015;
|
||||
const materialDiff = materialFullSize - previousPayload.material_fesm_2015;
|
||||
const materialDiff = roundFileSize(materialFullSize - previousPayload.material_fesm_2015);
|
||||
|
||||
// Set the Github statuses for the packages by sending a HTTP request to the dashboard functions.
|
||||
await Promise.all([
|
||||
@@ -174,3 +174,8 @@ function getCommitFromPreviousPayloadUpload(): string {
|
||||
return spawnSync('git', ['rev-parse', process.env['TRAVIS_BRANCH']]).stdout.toString().trim();
|
||||
}
|
||||
}
|
||||
|
||||
/** Rounds the specified file size to two decimal places. */
|
||||
function roundFileSize(fileSize: number) {
|
||||
return Math.round(fileSize * 100) / 100;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user