Skip to content

Commit 38194b6

Browse files
clydinvikerman
authored andcommitted
ci: add size check of new project production build (#12328)
1 parent 43fff13 commit 38194b6

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

.circleci/config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ jobs:
8686
steps:
8787
- attach_workspace: *attach_options
8888
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
89+
- store_artifacts:
90+
path: /tmp/dist
91+
destination: cli/new-production
8992

9093
e2e-node-8:
9194
<<: *defaults

.github/angular-robot.yml

+5
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,8 @@ triage:
9191
-
9292
- "type: docs"
9393
- "comp: *"
94+
95+
# Size checking
96+
size:
97+
circleCiStatusName: "ci/circleci: e2e-cli"
98+
maxSizeIncrease: 10000
+19-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
import {ng} from '../../utils/process';
2-
import {expectFileToMatch} from '../../utils/fs';
3-
4-
export default function() {
5-
return ng('build')
6-
.then(() => expectFileToMatch('dist/test-project/index.html', 'main.js'))
7-
.then(() => ng('build', '--prod'))
8-
.then(() => expectFileToMatch('dist/test-project/index.html', /main\.[a-zA-Z0-9]{20}\.js/));
1+
import { expectFileToMatch, moveDirectory } from '../../utils/fs';
2+
import { ng } from '../../utils/process';
3+
4+
5+
export default async function() {
6+
// Development build
7+
await ng('build');
8+
await expectFileToMatch('dist/test-project/index.html', 'main.js');
9+
10+
11+
// Production build
12+
await ng('build', '--prod');
13+
await expectFileToMatch('dist/test-project/index.html', /main\.[a-zA-Z0-9]{20}\.js/);
14+
15+
// Store the production build for artifact storage on CircleCI
16+
if (process.env['CIRCLECI']) {
17+
await ng('build', '--prod', '--output-hashing=none');
18+
await moveDirectory('dist', '/tmp/dist');
19+
}
920
}

tests/legacy-cli/e2e/utils/fs.ts

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ export function copyFile(from: string, to: string) {
107107
}));
108108
}
109109

110+
export function moveDirectory(from: string, to: string) {
111+
return fs.move(from, to, { overwrite: true });
112+
}
113+
110114

111115
export function writeMultipleFiles(fs: { [path: string]: string }) {
112116
return Promise.all(Object.keys(fs).map(fileName => writeFile(fileName, fs[fileName])));

0 commit comments

Comments
 (0)