build: fix integration test size trackings not running after recent refactoring (#44430)

Fixes that the integration test size trackings stopped working due to
the recent refactorings (switch to the rule from `@angular/dev-infra-private`).

The size-tracking does not integrate very-well into Bazel and needs
a better solution in the future, allowing for RBE and Windows support,
but currently with the new rule/setup/structure the tracking does not
validate sizes because:

* The `dist/*.js` argument to the tracking script got expanded and
  messed up the indices. It should be passed as a literal. This now
  surfaced because the new rule runs commands in a shell.

* The name for the size goldens were not computed properly because they
  were based on `ctx.attr.name`, but given the new structure, the test
  targets are always named `test`.

PR Close #44430
This commit is contained in:
Paul Gschwendtner
2021-12-09 22:45:07 +01:00
committed by Alex Rickabaugh
parent a7c117ab44
commit f51b00916e
8 changed files with 13 additions and 14 deletions
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
commands = "payload_size_tracking",
setup_chromium = True,
track_payload_size = "cli-hello-world-ivy-compat",
)
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
commands = "payload_size_tracking",
setup_chromium = True,
track_payload_size = "cli-hello-world-ivy-i18n",
)
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
commands = "payload_size_tracking",
setup_chromium = True,
track_payload_size = "cli-hello-world-ivy-minimal",
)
+1 -1
View File
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
commands = "payload_size_tracking",
setup_chromium = True,
track_payload_size = "cli-hello-world-lazy",
)
+1 -1
View File
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
commands = "payload_size_tracking",
setup_chromium = True,
track_payload_size = "cli-hello-world",
)
+1 -1
View File
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
commands = "payload_size_tracking",
setup_chromium = True,
track_payload_size = "forms",
)
+2 -2
View File
@@ -2,10 +2,10 @@ load("//integration:index.bzl", "ng_integration_test")
ng_integration_test(
name = "test",
# TODO: Re-enable the payload_size_tracking command:
# TODO: Re-enable size-tracking:
# We should define ngDevMode to false in Closure, but --define only works in the global scope.
# With ngDevMode not being set to false, this size tracking test provides little value but a lot of
# headache to continue updating the size.
# commands = "payload_size_tracking",
# track_payload_size = "hello_world_closure",
setup_chromium = True,
)
+5 -6
View File
@@ -38,6 +38,7 @@ def _ng_integration_test(name, setup_chromium = False, **kwargs):
use_view_engine_packages = kwargs.pop("use_view_engine_packages", [])
toolchains = kwargs.pop("toolchains", [])
environment = kwargs.pop("environment", {})
track_payload_size = kwargs.pop("track_payload_size", None)
data = kwargs.pop("data", [])
data += [
@@ -56,18 +57,16 @@ def _ng_integration_test(name, setup_chromium = False, **kwargs):
# By default run `yarn install` followed by `yarn test` using the tools linked
# into the integration tests (using the `tool_mappings` attribute).
commands = [
commands = kwargs.pop("commands", [
"yarn install --cache-folder ./.yarn_local_cache",
"yarn test",
]
])
command_type = kwargs.pop("commands", "default")
if command_type == "payload_size_tracking":
if track_payload_size:
commands += [
"yarn build",
# TODO: Replace the track payload-size script with a RBE and Windows-compatible script.
"$(rootpath //:scripts/ci/track-payload-size.sh) %s dist/*.js true $${RUNFILES}/angular/$(rootpath //goldens:size-tracking/integration-payloads.json)" % name,
"$(rootpath //:scripts/ci/track-payload-size.sh) %s 'dist/*.js' true $${RUNFILES}/angular/$(rootpath //goldens:size-tracking/integration-payloads.json)" % track_payload_size,
]
data += [
"//goldens:size-tracking/integration-payloads.json",