Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add size check of new project production build #12328

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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', '/tmp/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