Skip to content

Commit 816a833

Browse files
devversionjelbourn
authored andcommitted
build: add job to run tests with ivy
Introduces two new CI jobs that run tests with Ivy. Pull requests will now run tests against a pinned Angular/Ivy version. Additionally there is a cronjob that runs the component tests with Ivy every hour against Ivy from `angular/angular#master`. This allows us to detect regressions very quickly.
1 parent 92dc089 commit 816a833

File tree

5 files changed

+268
-143
lines changed

5 files changed

+268
-143
lines changed

.circleci/config.yml

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,63 @@ jobs:
346346
- run: node ./scripts/circleci/setup-angular-snapshots.js
347347
- run: ./scripts/circleci/run-local-browser-tests.sh
348348

349+
350+
# ----------------------------------------------------------------------------
351+
# Job that runs all Bazel tests against Ivy with the current Angular version
352+
# specified in the project dev dependencies.
353+
# ----------------------------------------------------------------------------
354+
ivy_test:
355+
<<: *job_defaults
356+
resource_class: xlarge
357+
environment:
358+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
359+
steps:
360+
- *checkout_code
361+
- *restore_cache
362+
- *copy_bazel_config
363+
- *setup_bazel_remote_execution
364+
- *yarn_install
365+
366+
# Setup Angular ivy snapshots built with ngtsc but locked to a specific tag. We
367+
# cannot determine the tag automatically based on the Angular version specified in
368+
# the "package.json" because the SHA is not known for the given release. Nor can
369+
# we use ngcc to apply the ivy switches because ngcc currently does not handle the
370+
# UMD format which is used by Bazel when running tests. UMD processing is in
371+
# progress and tracked with FW-85.
372+
- run: node ./scripts/circleci/setup-angular-snapshots.js --tag 8.0.0-rc.0-ivy-aot+bd37622
373+
# Disable type checking when building with Ivy. This is necessary because
374+
# type checking is not complete yet and can incorrectly break compilation.
375+
# Issue is tracked with FW-1004.
376+
- run: sed -i "s/\(_ENABLE_NG_TYPE_CHECKING = \)True/\1False/g" tools/defaults.bzl
377+
# Run project tests with ngtsc and the Ivy Angular packages.
378+
- run: bazel build src/... --build_tag_filters=-docs-package --define=compile=aot
379+
- run: bazel test src/... --build_tag_filters=-docs-package --define=compile=aot
380+
381+
# ----------------------------------------------------------------------------
382+
# Job that runs all Bazel tests against Ivy from angular/angular#master.
383+
# ----------------------------------------------------------------------------
384+
ivy_snapshot_test_cronjob:
385+
<<: *job_defaults
386+
resource_class: xlarge
387+
environment:
388+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
389+
steps:
390+
- *checkout_code
391+
- *restore_cache
392+
- *copy_bazel_config
393+
- *setup_bazel_remote_execution
394+
- *yarn_install
395+
396+
# Setup Angular ivy snapshots built with ngtsc.
397+
- run: node ./scripts/circleci/setup-angular-snapshots.js --tag master-ivy-aot
398+
# Disable type checking when building with Ivy. This is necessary because
399+
# type checking is not complete yet and can incorrectly break compilation.
400+
# Issue is tracked with FW-1004.
401+
- run: sed -i "s/\(_ENABLE_NG_TYPE_CHECKING = \)True/\1False/g" tools/defaults.bzl
402+
# Run project tests with ngtsc and the Ivy Angular packages.
403+
- run: bazel build src/... --build_tag_filters=-docs-package --define=compile=aot
404+
- run: bazel test src/... --build_tag_filters=-docs-package --define=compile=aot
405+
349406
# ----------------------------------------------------------------------------------------
350407
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
351408
# one job depends on another.
@@ -360,6 +417,8 @@ workflows:
360417
jobs:
361418
- bazel_build_test:
362419
filters: *ignore_presubmit_branch_filter
420+
- ivy_test:
421+
filters: *ignore_presubmit_branch_filter
363422
- api_golden_checks:
364423
filters: *ignore_presubmit_branch_filter
365424

@@ -398,17 +457,18 @@ workflows:
398457
- lint:
399458
filters: *ignore_presubmit_branch_filter
400459

401-
# Snapshot tests workflow that is scheduled to run all specified jobs at midnight everyday.
460+
# Snapshot tests workflow that is scheduled to run all specified jobs every hour.
402461
# This workflow runs various jobs against the Angular snapshot builds from Github.
403462
snapshot_tests:
404463
jobs:
405-
# Note that we need additional jobs for the nightly snapshot tests because there is no
406-
# easy way to detect whether a job runs inside of a cronjob or specific workflow.
407-
# See: https://circleci.com/ideas/?idea=CCI-I-295
464+
# Note that we need additional jobs for the cronjob snapshot tests because there
465+
# is no easy way to detect whether a job runs inside of a cronjob or specific
466+
# workflow. See: https://circleci.com/ideas/?idea=CCI-I-295
408467
- snapshot_tests_local_browsers
468+
- ivy_snapshot_test_cronjob
409469
triggers:
410470
- schedule:
411-
cron: "0 0 * * *"
471+
cron: "0 * * * *"
412472
filters:
413473
branches:
414474
only:

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@
3232
"requiredAngularVersion": ">=8.0.0-rc.1",
3333
"requiredMDCVersion": "^1.1.0",
3434
"dependencies": {
35-
"@angular/animations": "^8.0.0-rc.1",
36-
"@angular/common": "^8.0.0-rc.1",
37-
"@angular/compiler": "^8.0.0-rc.1",
38-
"@angular/core": "^8.0.0-rc.1",
39-
"@angular/elements": "^8.0.0-rc.1",
40-
"@angular/forms": "^8.0.0-rc.1",
41-
"@angular/platform-browser": "^8.0.0-rc.1",
35+
"@angular/animations": "^8.0.0-rc.3",
36+
"@angular/common": "^8.0.0-rc.3",
37+
"@angular/compiler": "^8.0.0-rc.3",
38+
"@angular/core": "^8.0.0-rc.3",
39+
"@angular/elements": "^8.0.0-rc.3",
40+
"@angular/forms": "^8.0.0-rc.3",
41+
"@angular/platform-browser": "^8.0.0-rc.3",
4242
"@webcomponents/custom-elements": "^1.1.0",
4343
"core-js": "^2.6.1",
4444
"material-components-web": "^1.1.0",
4545
"rxjs": "^6.4.0",
4646
"systemjs": "0.19.43",
4747
"tsickle": "^0.35.0",
4848
"tslib": "^1.9.3",
49-
"zone.js": "^0.9.0"
49+
"zone.js": "~0.9.1"
5050
},
5151
"devDependencies": {
52-
"@angular-devkit/core": "^8.0.0-rc.1",
53-
"@angular-devkit/schematics": "^8.0.0-rc.1",
54-
"@angular/bazel": "^8.0.0-rc.1",
55-
"@angular/compiler-cli": "^8.0.0-rc.1",
56-
"@angular/platform-browser-dynamic": "^8.0.0-rc.1",
57-
"@angular/platform-server": "^8.0.0-rc.1",
58-
"@angular/router": "^8.0.0-rc.1",
59-
"@angular/upgrade": "^8.0.0-rc.1",
52+
"@angular-devkit/core": "^8.0.0-rc.2",
53+
"@angular-devkit/schematics": "^8.0.0-rc.2",
54+
"@angular/bazel": "^8.0.0-rc.3",
55+
"@angular/compiler-cli": "^8.0.0-rc.3",
56+
"@angular/platform-browser-dynamic": "^8.0.0-rc.3",
57+
"@angular/platform-server": "^8.0.0-rc.3",
58+
"@angular/router": "^8.0.0-rc.3",
59+
"@angular/upgrade": "^8.0.0-rc.3",
6060
"@bazel/bazel": "^0.24.1",
6161
"@bazel/ibazel": "^0.9.0",
6262
"@bazel/jasmine": "0.27.8",

scripts/circleci/setup-angular-snapshots.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const {writeFileSync} = require('fs');
1919
const {join} = require('path');
2020
const {execSync} = require('child_process');
2121

22+
const {tag} = require('minimist')(process.argv.slice(2), {string: ['tag']});
2223
const projectDir = join(__dirname, '../../');
2324
const packageJsonPath = join(projectDir, 'package.json');
2425
const packageJson = require(packageJsonPath);
@@ -30,13 +31,15 @@ packageJson['resolutions'] = packageJson['resolutions'] || {};
3031
// List that contains the names of all installed Angular packages (e.g. "@angular/core")
3132
const angularPackages = Object.keys({...packageJson.dependencies, ...packageJson.devDependencies})
3233
.filter(packageName => packageName.startsWith('@angular/'));
34+
const packageSuffix = tag ? ` (${tag})` : '';
3335

3436
console.log(green('Setting up snapshot builds for:\n'));
35-
console.log(yellow(` ${angularPackages.join('\n ')}\n`));
37+
console.log(yellow(` ${angularPackages.map(n => `${n}${packageSuffix}`).join('\n ')}\n`));
3638

3739
// Setup the snapshot version for each Angular package specified in the "package.json" file.
3840
angularPackages.forEach(packageName => {
39-
const buildsUrl = `github:angular/${packageName.split('/')[1]}-builds`;
41+
let buildsUrl = `github:angular/${packageName.split('/')[1]}-builds${tag ? `#${tag}` : ''}`;
42+
4043
// Add resolutions for each package in the format "**/{PACKAGE}" so that all
4144
// nested versions of that specific Angular package will have the same version.
4245
packageJson.resolutions[`**/${packageName}`] = buildsUrl;

tools/defaults.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ _DEFAULT_TSCONFIG_BUILD = "//src:bazel-tsconfig-build.json"
1111
_DEFAULT_TSCONFIG_TEST = "//src:bazel-tsconfig-test.json"
1212
_DEFAULT_TS_TYPINGS = "@npm//typescript:typescript__typings"
1313

14+
# Whether Angular type checking should be enabled or not. Enabled by
15+
# default but will be overwritten when running snapshots tests with Ivy
16+
# since type-checking is not complete yet. See FW-1004.
17+
_ENABLE_NG_TYPE_CHECKING = True
18+
1419
# Re-exports to simplify build file load statements
1520
markdown_to_html = _markdown_to_html
1621

@@ -55,6 +60,7 @@ def ng_module(deps = [], tsconfig = None, testonly = False, **kwargs):
5560
local_deps = local_deps + [d]
5661

5762
_ng_module(
63+
type_check = _ENABLE_NG_TYPE_CHECKING,
5864
deps = local_deps,
5965
tsconfig = tsconfig,
6066
testonly = testonly,

0 commit comments

Comments
 (0)