Skip to content

Commit c9b3071

Browse files
committed
ci: add ivy track for all prs
1 parent 6166c8d commit c9b3071

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

.circleci/config.yml

+7-14
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,17 @@ jobs:
106106
path: /tmp/dist
107107
destination: cli/new-production
108108

109-
e2e-cli-ng-snapshots:
109+
e2e-cli-ivy:
110110
<<: *defaults
111111
environment:
112112
BASH_ENV: ~/.profile
113113
resource_class: xlarge
114114
parallelism: 4
115115
steps:
116-
- run:
117-
name: Don't run expensive e2e tests for forks other than renovate-bot and angular
118-
command: >
119-
if [[ "$CIRCLE_PR_USERNAME" != "renovate-bot" ]] &&
120-
[[ "$CIRCLE_PROJECT_USERNAME" != "angular" || $CIRCLE_BRANCH != "master" ]]; then
121-
circleci step halt
122-
fi
123116
- attach_workspace: *attach_options
124-
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ng-snapshots
117+
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ivy
125118

126-
e2e-cli-ivy-snapshots:
119+
e2e-cli-ng-snapshots:
127120
<<: *defaults
128121
environment:
129122
BASH_ENV: ~/.profile
@@ -138,7 +131,7 @@ jobs:
138131
circleci step halt
139132
fi
140133
- attach_workspace: *attach_options
141-
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ng-snapshots --ivy
134+
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ng-snapshots
142135

143136
build:
144137
<<: *defaults
@@ -210,6 +203,9 @@ workflows:
210203
- e2e-cli:
211204
requires:
212205
- build
206+
- e2e-cli-ivy:
207+
requires:
208+
- build
213209
- snapshot_publish_docs:
214210
requires:
215211
- install
@@ -220,9 +216,6 @@ workflows:
220216
- e2e-cli-ng-snapshots:
221217
requires:
222218
- build
223-
- e2e-cli-ivy-snapshots:
224-
requires:
225-
- build
226219
- snapshot_publish:
227220
requires:
228221
- test

tests/legacy-cli/e2e/tests/basic/rebuild.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import {writeFile, writeMultipleFiles} from '../../utils/fs';
88
import {wait} from '../../utils/utils';
99
import {request} from '../../utils/http';
10+
import {getGlobalVariable} from '../../utils/env';
1011

1112
const validBundleRegEx = /: Compiled successfully./;
1213

@@ -15,7 +16,10 @@ export default function() {
1516
return Promise.resolve();
1617
}
1718

18-
const lazyChunkRegExp = /lazy-module\.js/g;
19+
const argv = getGlobalVariable('argv');
20+
const ivyProject = argv['ivy'];
21+
const lazyImport = ivyProject ? `() => import('./lazy/lazy.module').then(m => m.LazyModule)`
22+
: `'./lazy/lazy.module#LazyModule'`;
1923

2024
return execAndWaitForOutputToMatch('ng', ['serve'], validBundleRegEx)
2125
// Add a lazy module.
@@ -43,7 +47,7 @@ export default function() {
4347
FormsModule,
4448
HttpClientModule,
4549
RouterModule.forRoot([
46-
{ path: 'lazy', loadChildren: './lazy/lazy.module#LazyModule' }
50+
{ path: 'lazy', loadChildren: ${lazyImport} }
4751
])
4852
],
4953
providers: [],
@@ -55,7 +59,7 @@ export default function() {
5559
// Count the bundles.
5660
.then((results) => {
5761
const stdout = results[0].stdout;
58-
if (!lazyChunkRegExp.test(stdout)) {
62+
if (!/(lazy-module|0)\.js/g.test(stdout)) {
5963
throw new Error('Expected webpack to create a new chunk, but did not.');
6064
}
6165
})

tests/legacy-cli/e2e/tests/misc/lazy-module.ts

+21-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ import {readdirSync} from 'fs';
22

33
import {ng, silentNpm} from '../../utils/process';
44
import {appendToFile, writeFile, prependToFile, replaceInFile} from '../../utils/fs';
5+
import {getGlobalVariable} from '../../utils/env';
56

67

78
export default function() {
9+
const argv = getGlobalVariable('argv');
10+
const ivyProject = argv['ivy'];
11+
const lazyImport = ivyProject ? `() => import('src/app/lazy/lazy.module').then(m => m.LazyModule)`
12+
: `'src/app/lazy/lazy.module#LazyModule'`;
13+
const lazyImport1 = ivyProject ? `() => import('./lazy/lazy.module').then(m => m.LazyModule)`
14+
: `'./lazy/lazy.module#LazyModule'`;
15+
const lazyImport2 = ivyProject ? `() => import('./too/lazy/lazy.module').then(m => m.LazyModule)`
16+
: `'./too/lazy/lazy.module#LazyModule'`;
17+
818
let oldNumberOfFiles = 0;
919
return Promise.resolve()
1020
.then(() => ng('build'))
@@ -15,9 +25,9 @@ export default function() {
1525
import { RouterModule } from '@angular/router';
1626
`))
1727
.then(() => replaceInFile('src/app/app.module.ts', 'imports: [', `imports: [
18-
RouterModule.forRoot([{ path: "lazy", loadChildren: "src/app/lazy/lazy.module#LazyModule" }]),
19-
RouterModule.forRoot([{ path: "lazy1", loadChildren: "./lazy/lazy.module#LazyModule" }]),
20-
RouterModule.forRoot([{ path: "lazy2", loadChildren: "./too/lazy/lazy.module#LazyModule" }]),
28+
RouterModule.forRoot([{ path: "lazy", loadChildren: ${lazyImport} }]),
29+
RouterModule.forRoot([{ path: "lazy1", loadChildren: ${lazyImport1} }]),
30+
RouterModule.forRoot([{ path: "lazy2", loadChildren: ${lazyImport2} }]),
2131
`))
2232
.then(() => ng('build', '--named-chunks'))
2333
.then(() => readdirSync('dist/test-project'))
@@ -28,11 +38,14 @@ export default function() {
2838
}
2939
oldNumberOfFiles = currentNumberOfDistFiles;
3040

31-
if (!distFiles.includes('lazy-lazy-module.js')) {
32-
throw new Error('The lazy module chunk did not have a name.');
33-
}
34-
if (!distFiles.includes('too-lazy-lazy-module.js')) {
35-
throw new Error('The lazy module chunk did not use a unique name.');
41+
// Named lazy route chunks are not available with Ivy.
42+
if (!ivyProject) {
43+
if (!distFiles.includes('lazy-lazy-module.js')) {
44+
throw new Error('The lazy module chunk did not have a name.');
45+
}
46+
if (!distFiles.includes('too-lazy-lazy-module.js')) {
47+
throw new Error('The lazy module chunk did not use a unique name.');
48+
}
3649
}
3750
})
3851
// verify System.import still works

tests/legacy-cli/e2e_runner.ts

+2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ if (argv.ivy) {
144144
.filter(name => !name.endsWith('tests/build/aot/aot-i18n.ts'))
145145
// We don't have a library consumption story yet for Ivy.
146146
.filter(name => !name.endsWith('tests/generate/library/library-consumption.ts'))
147+
// The additional lazy modules array does not work with Ivy because it's not needed.
148+
.filter(name => !name.endsWith('tests/build/dynamic-import.ts'))
147149
// We don't have a platform-server usage story yet for Ivy.
148150
// It's contingent on lazy loading and factory shim considerations that are still being
149151
// discussed.

0 commit comments

Comments
 (0)