Skip to content

build: run partial compilation tests with linker JIT #23882

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

Merged
merged 1 commit into from
Dec 3, 2021
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
52 changes: 47 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ jobs:
- *yarn_install
- *setup_bazel_binary

- run: yarn integration-tests:partial-ivy
- run: yarn integration-tests
- run:
name: Running size integration tests (failures are reported in Slack only).
Expand All @@ -482,9 +481,47 @@ jobs:
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
# Job that runs all integration tests against Angular snapshot builds.
# Job that runs the AOT linker tests.
# ----------------------------------------------------------------------------
integration_tests_snapshot:
linker_aot_test:
<<: *job_defaults
resource_class: xlarge
environment:
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
steps:
- checkout_and_rebase
- *restore_cache
- *setup_bazel_ci_config
- *setup_bazel_remote_execution
- *yarn_install
- *setup_bazel_binary

- run: yarn test-linker-aot
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
# Job that runs the JIT linker tests.
# ----------------------------------------------------------------------------
linker_jit_test:
<<: *job_defaults
resource_class: xlarge
environment:
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
steps:
- checkout_and_rebase
- *restore_cache
- *setup_bazel_ci_config
- *setup_bazel_remote_execution
- *yarn_install
- *setup_bazel_binary

- run: yarn test-linker-jit
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
# Job that runs both AOT and JIT linker tests against Angular snapshot builds.
# ----------------------------------------------------------------------------
snapshot_linker_tests:
<<: *job_defaults
resource_class: xlarge
environment:
Expand All @@ -498,7 +535,8 @@ jobs:
- *yarn_install_loose_lockfile
- *setup_bazel_binary

- run: yarn integration-tests:partial-ivy
- run: yarn test-linker-aot
- run: yarn test-linker-jit
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -544,6 +582,10 @@ workflows:
filters: *ignore_presubmit_branch_filter
- integration_tests:
filters: *ignore_presubmit_branch_filter
- linker_aot_test:
filters: *ignore_presubmit_branch_filter
- linker_jit_test:
filters: *ignore_presubmit_branch_filter
- tests_local_browsers:
filters: *ignore_presubmit_branch_filter
- tests_browserstack:
Expand Down Expand Up @@ -578,7 +620,7 @@ workflows:
filters: *only_main_branch_filter
- mdc_snapshot_test_cronjob:
filters: *only_main_branch_filter
- integration_tests_snapshot:
- snapshot_linker_tests:
filters: *only_main_branch_filter

triggers:
Expand Down
1 change: 0 additions & 1 deletion integration/linker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ nodejs_test(
"@npm//glob",
],
entry_point = "link-packages-test.mjs",
tags = ["partial-compilation-integration"],
)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
"approve-api": "node ./scripts/approve-api-golden.js",
"approve-size-tests": "node ./scripts/approve-size-golden.js",
"integration-tests": "bazel test --test_tag_filters=-linker-integration-test --build_tests_only -- //integration/... -//integration/size-test/...",
"integration-tests:partial-ivy": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...",
"integration-tests:size-test": "bazel test //integration/size-test/...",
"test-linker-aot": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...",
"test-linker-jit": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only --//tools:force_partial_jit_compilation=True -- //integration/... //src/...",
"check-mdc-tests": "ts-node --project scripts/tsconfig.json scripts/check-mdc-tests.ts",
"check-mdc-exports": "ts-node --project scripts/tsconfig.json scripts/check-mdc-exports.ts",
"check-tooling-setup": "yarn tsc --project tools/tsconfig.json && yarn tsc --project .ng-dev/tsconfig.json",
Expand Down
19 changes: 19 additions & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

package(default_visibility = ["//visibility:public"])

exports_files([
Expand All @@ -13,6 +15,23 @@ config_setting(
},
)

# Command line flag that can be specified to force the JIT compilation to be used for tests
# with partial compilation. By default, tests are processed with the linker at build time.
bool_flag(
name = "force_partial_jit_compilation",
build_setting_default = False,
)

# Config setting that matches if the force JIT compilation build setting is enabled.
# This setting needs to be used in combination of the partial compilation build setting.
config_setting(
name = "force_partial_jit_compilation_enabled",
flag_values = {
"@npm//@angular/bazel/src:partial_compilation": "True",
":force_partial_jit_compilation": "True",
},
)

# Detect if the build is running with stamping enabled.
config_setting(
name = "stamp",
Expand Down
6 changes: 4 additions & 2 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,10 @@ def spec_bundle(name, deps, **kwargs):
deps = ["%s_devmode_deps" % name] + LINKER_PROCESSED_FW_PACKAGES,
workspace_name = "angular_material",
run_angular_linker = select({
# Pass through whether partial compilation is enabled or not. This is helpful
# for our integration tests which run all tests in partial compilation mode.
# Depending on whether partial compilation is enabled, we may want to run the linker
# to test the Angular compiler linker AOT processing. Additionally, a config setting
# can forcibly disable the linker to ensure tests rely on JIT linking at runtime.
"//tools:force_partial_jit_compilation_enabled": False,
"//tools:partial_compilation_enabled": True,
"//conditions:default": False,
}),
Expand Down