Skip to content

Commit

Permalink
ci: add size check of new project production build
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin committed Sep 20, 2018
1 parent c3cffc3 commit f3ebac6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ jobs:
steps:
- attach_workspace: *attach_options
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
- store_artifacts:
path: ~/tmp-dist
destination: cli/new-production

e2e-node-8:
<<: *defaults
Expand Down
5 changes: 5 additions & 0 deletions .github/angular-robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ triage:
-
- "type: docs"
- "comp: *"

# Size checking
size:
circleCiStatusName: "ci/circleci: e2e-cli"
maxSizeIncrease: 10000
27 changes: 19 additions & 8 deletions tests/legacy-cli/e2e/tests/basic/build.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import {ng} from '../../utils/process';
import {expectFileToMatch} from '../../utils/fs';

export default function() {
return ng('build')
.then(() => expectFileToMatch('dist/test-project/index.html', 'main.js'))
.then(() => ng('build', '--prod'))
.then(() => expectFileToMatch('dist/test-project/index.html', /main\.[a-zA-Z0-9]{20}\.js/));
import { expectFileToMatch, moveDirectory } from '../../utils/fs';
import { ng } from '../../utils/process';


export default async function() {
// Development build
await ng('build');
await expectFileToMatch('dist/test-project/index.html', 'main.js');


// Production build
await ng('build', '--prod');
await expectFileToMatch('dist/test-project/index.html', /main\.[a-zA-Z0-9]{20}\.js/);

// Store the production build for artifact storage on CircleCI
if (process.env['CIRCLECI']) {
await ng('build', '--prod', '--output-hashing=none');
await moveDirectory('dist', '~/temp-dist');
}
}
4 changes: 4 additions & 0 deletions tests/legacy-cli/e2e/utils/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ export function copyFile(from: string, to: string) {
}));
}

export function moveDirectory(from: string, to: string) {
return fs.move(from, to, { overwrite: true });
}


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

0 comments on commit f3ebac6

Please sign in to comment.