ci(docs-infra): store JS bundles as CI artifacts to debug size check flakes (#37703)
As reported in #37699, the size of the main angular.io bundle sometimes ends up bigger than expected on CI. This usually goes away after rerunning the job a couple of times. It is unclear what is causing this. In order to help debug the issue, this commit stores the JS files that are checked as part of the aio payload-size check as CI artifacts, where they can be retrieved from and inspected. PR Close #37703
This commit is contained in:

committed by
Andrew Kushnir

parent
638dd15f61
commit
eee2fd22e0
24
aio/scripts/prepare-size-debug-artifacts.js
Normal file
24
aio/scripts/prepare-size-debug-artifacts.js
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
const {cp, ls, mkdir, set} = require('shelljs');
|
||||
const {join, resolve} = require('path');
|
||||
set('-e');
|
||||
|
||||
// Read input arguments.
|
||||
const [sizesTarget, artifactsRelativeDir] = process.argv.slice(2);
|
||||
|
||||
// Compute paths.
|
||||
const projectDir = resolve(__dirname, '../..');
|
||||
const sizesFilePath = join(projectDir, 'goldens/size-tracking/aio-payloads.json');
|
||||
const distDir = join(projectDir, 'aio/dist');
|
||||
const artifactsDir = resolve(projectDir, artifactsRelativeDir);
|
||||
|
||||
// Determine which files need to be copied.
|
||||
const fileNamePrefixes = Object.keys(require(sizesFilePath)[sizesTarget].master.uncompressed);
|
||||
const filesToCopyRe = new RegExp(`^(?:${fileNamePrefixes.join('|')})\\..+\\.js$`);
|
||||
const filesToCopy = ls(distDir)
|
||||
.filter(file => filesToCopyRe.test(file))
|
||||
.map(file => join(distDir, file));
|
||||
|
||||
// Copy files to the specified directory.
|
||||
mkdir('-p', artifactsDir);
|
||||
cp(filesToCopy, artifactsDir);
|
Reference in New Issue
Block a user