test(bazel): Run Angular test on RBE (#25370)

PR Close #25370
This commit is contained in:
Wei Huang 2018-08-02 00:02:36 -04:00 committed by Ben Lesh
parent cbbad1b791
commit 5241ea086d
5 changed files with 53 additions and 36 deletions

View File

@ -28,3 +28,6 @@ build --local_resources=14336,8.0,1.0
# Retry in the event of flakes, eg. https://circleci.com/gh/angular/angular/31309 # Retry in the event of flakes, eg. https://circleci.com/gh/angular/angular/31309
test --flaky_test_attempts=2 test --flaky_test_attempts=2
# More details on failures
build --verbose_failures=true

View File

@ -26,6 +26,11 @@ var_4: &setup-bazel-remote-cache
command: ~/bazel-remote-proxy -backend circleci:// command: ~/bazel-remote-proxy -backend circleci://
background: true background: true
var_5: &setup_bazel_remote_execution
run:
name: "Setup bazel RBE remote execution"
command: openssl aes-256-cbc -d -in .circleci/gcp_token -k "${CIRCLE_PROJECT_REPONAME}" -out /home/circleci/.gcp_credentials && echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV && sudo bash -c "cat .circleci/rbe-bazel.rc >> /etc/bazel.bazelrc"
# Settings common to each job # Settings common to each job
anchor_1: &job_defaults anchor_1: &job_defaults
working_directory: ~/ng working_directory: ~/ng
@ -69,22 +74,20 @@ jobs:
- *define_env_vars - *define_env_vars
- checkout: - checkout:
<<: *post_checkout <<: *post_checkout
# See remote cache documentation in /docs/BAZEL.md
- run: .circleci/setup_cache.sh
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- *setup-bazel-remote-cache
- restore_cache:
key: *cache_key
- run: ls /home/circleci/bazel_repository_cache || true
- run: bazel info release - run: bazel info release
- run: bazel run @nodejs//:yarn - run: bazel run @nodejs//:yarn
# Use bazel query so that we explicitly ask for all buildable targets to be built as well # Use bazel query so that we explicitly ask for all buildable targets to be built as well
# This avoids waiting for the slowest build target to finish before running the first test # This avoids waiting for the slowest build target to finish before running the first test
# See https://github.com/bazelbuild/bazel/issues/4257 # See https://github.com/bazelbuild/bazel/issues/4257
# NOTE: Angular developers should typically just bazel build //packages/... or bazel test //packages/... # NOTE: Angular developers should typically just bazel build //packages/... or bazel test //packages/...
- run: bazel query --output=label //... | xargs bazel test --build_tag_filters=-ivy-only --test_tag_filters=-manual,-ivy-only # Setup remote execution and run RBE-compatible tests.
- *setup_bazel_remote_execution
- run: bazel query --output=label //... | xargs bazel test --build_tag_filters=-ivy-only --test_tag_filters=-manual,-ivy-only,-local
# Now run RBE incompatible tests locally.
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: bazel query --output=label //... | xargs bazel test --build_tag_filters=-ivy-only,local --test_tag_filters=-manual,-ivy-only,local
# CircleCI will allow us to go back and view/download these artifacts from past builds. # CircleCI will allow us to go back and view/download these artifacts from past builds.
# Also we can use a service like https://buildsize.org/ to automatically track binary size of these artifacts. # Also we can use a service like https://buildsize.org/ to automatically track binary size of these artifacts.
@ -118,15 +121,10 @@ jobs:
- *define_env_vars - *define_env_vars
- checkout: - checkout:
<<: *post_checkout <<: *post_checkout
# See remote cache documentation in /docs/BAZEL.md
- run: .circleci/setup_cache.sh
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- *setup-bazel-remote-cache
- restore_cache:
key: *cache_key
- run: bazel run @yarn//:yarn - run: bazel run @yarn//:yarn
- *setup_bazel_remote_execution
- run: bazel query --output=label //... | xargs bazel test --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=-manual,ivy-jit - run: bazel query --output=label //... | xargs bazel test --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=-manual,ivy-jit
test_ivy_aot: test_ivy_aot:
@ -136,15 +134,10 @@ jobs:
- *define_env_vars - *define_env_vars
- checkout: - checkout:
<<: *post_checkout <<: *post_checkout
# See remote cache documentation in /docs/BAZEL.md
- run: .circleci/setup_cache.sh
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- *setup-bazel-remote-cache
- restore_cache:
key: *cache_key
- run: bazel run @yarn//:yarn - run: bazel run @yarn//:yarn
- *setup_bazel_remote_execution
- run: bazel query --output=label //... | xargs bazel test --define=compile=local --build_tag_filters=ivy-local --test_tag_filters=-manual,ivy-local - run: bazel query --output=label //... | xargs bazel test --define=compile=local --build_tag_filters=ivy-local --test_tag_filters=-manual,ivy-local
aio_preview: aio_preview:
@ -178,21 +171,10 @@ jobs:
- *define_env_vars - *define_env_vars
- checkout: - checkout:
<<: *post_checkout <<: *post_checkout
# See remote cache documentation in /docs/BAZEL.md
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: bazel run @nodejs//:yarn - run: bazel run @nodejs//:yarn
- run: - *setup_bazel_remote_execution
# RBE is enabled by appending rbe-bazel.rc. - run: scripts/build-packages-dist.sh
name: Enable RBE
command: 'sudo bash -c "cat .circleci/rbe-bazel.rc >> /etc/bazel.bazelrc"'
- run:
name: "Setup GCP environment"
command: 'openssl aes-256-cbc -d -in .circleci/gcp_token -k "${CIRCLE_PROJECT_REPONAME}" -out /home/circleci/.gcp_credentials'
- run:
name: build-packages-dist
command: scripts/build-packages-dist.sh
environment:
GOOGLE_APPLICATION_CREDENTIALS: /home/circleci/.gcp_credentials
# Save the npm packages from //packages/... for other workflow jobs to read # Save the npm packages from //packages/... for other workflow jobs to read
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs # https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs

View File

@ -34,9 +34,9 @@ build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# "exec_compatible_with"). # "exec_compatible_with").
# More about platforms: https://docs.bazel.build/versions/master/platforms.html # More about platforms: https://docs.bazel.build/versions/master/platforms.html
build --extra_toolchains=@bazel_toolchains//configs/ubuntu16_04_clang/1.0/bazel_0.15.0/cpp:cc-toolchain-clang-x86_64-default build --extra_toolchains=@bazel_toolchains//configs/ubuntu16_04_clang/1.0/bazel_0.15.0/cpp:cc-toolchain-clang-x86_64-default
build --extra_execution_platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 build --extra_execution_platforms=//tools:rbe_ubuntu1604-angular
build --host_platform=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 build --host_platform=//tools:rbe_ubuntu1604-angular
build --platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 build --platforms=//tools:rbe_ubuntu1604-angular
# Set various strategies so that all actions execute remotely. Mixing remote # Set various strategies so that all actions execute remotely. Mixing remote
# and local execution will lead to errors unless the toolchain and remote # and local execution will lead to errors unless the toolchain and remote

View File

@ -1 +1,32 @@
exports_files(["tsconfig.json"]) exports_files(["tsconfig.json"])
# The toolchain container used for execution is defined in the target indicated
# by "extra_execution_platforms", "host_platform" and "platforms".
# If you are using your own toolchain container, you need to create a platform
# target with "constraint_values" that allow for the toolchain specified with
# "extra_toolchains" to be selected (given constraints defined in
# "exec_compatible_with").
# More about platforms: https://docs.bazel.build/versions/master/platforms.html
platform(
name = "rbe_ubuntu1604-angular",
constraint_values = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:clang",
"@bazel_toolchains//constraints:xenial",
],
# We are currently using the docker container image provided by RBE. Once
# Angular has the billing account setup, we should start using/maintaining
# our own docker container image.
remote_execution_properties = """
properties: {
name: "container-image"
value:"docker://gcr.io/asci-toolchain/nosla-ubuntu16_04-webtest@sha256:55fae2e51ecf38fec9778ab93a9b4edd7d318eeb5f420602450d3b509b52edf9"
}
properties: {
name: "dockerAddCapabilities"
value: "SYS_ADMIN"
}
""",
visibility = ["//visibility:public"],
)

View File

@ -62,4 +62,5 @@ jasmine_node_test(
":ts-api-guardian", ":ts-api-guardian",
], ],
node_modules = "@ts-api-guardian_runtime_deps//:node_modules", node_modules = "@ts-api-guardian_runtime_deps//:node_modules",
tags = ["local"],
) )