Skip to content

Commit 2bf0612

Browse files
josephperrottandrewseguin
authored andcommitted
build: run CI unit tests using bazel (#16379)
1 parent bb66df7 commit 2bf0612

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

.circleci/config.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ version: 2
128128
jobs:
129129

130130
# -----------------------------------
131-
# Build and test job that uses Bazel.
131+
# Job to test that everything builds with Bazel
132132
# -----------------------------------
133-
bazel_build_test:
133+
bazel_build:
134134
<<: *job_defaults
135135
resource_class: xlarge
136136
environment:
@@ -144,7 +144,6 @@ jobs:
144144
- *yarn_install
145145

146146
- run: yarn bazel build src/... --build_tag_filters=-docs-package
147-
- run: yarn bazel test src/... --build_tag_filters=-docs-package --test_tag_filters=-e2e
148147

149148
# --------------------------------------------------------------------------------------------
150149
# Job that runs ts-api-guardian against our API goldens in "tools/public_api_guard".
@@ -185,18 +184,22 @@ jobs:
185184

186185
# ------------------------------------------------------------------------------------------
187186
# Job that runs the unit tests on locally installed browsers (Chrome and Firefox headless).
188-
# The available browsers are installed through the angular/ngcontainer Docker image.
187+
# The available browsers are chromium and firefox
189188
# ------------------------------------------------------------------------------------------
190189
tests_local_browsers:
191-
docker: *docker-firefox-image
190+
<<: *job_defaults
192191
resource_class: xlarge
192+
environment:
193+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
193194
steps:
194-
- *checkout_code
195-
- *restore_cache
196-
- *yarn_download
197-
- *yarn_install
195+
- *checkout_code
196+
- *restore_cache
197+
- *setup_bazel_ci_config
198+
- *setup_bazel_remote_execution
199+
- *yarn_download
200+
- *yarn_install
198201

199-
- run: ./scripts/circleci/run-local-browser-tests.sh
202+
- run: yarn bazel test src/... --build_tag_filters=-e2e --test_tag_filters=-e2e
200203

201204
# ----------------------------------------------------------------------------
202205
# Job that runs the unit tests on Browserstack. The browsers that will be used
@@ -447,17 +450,17 @@ workflows:
447450

448451
bazel_targets:
449452
jobs:
450-
- bazel_build_test:
453+
- bazel_build:
451454
filters: *ignore_presubmit_branch_filter
452455
- ivy_test:
453456
filters: *ignore_presubmit_branch_filter
454457
- api_golden_checks:
455458
filters: *ignore_presubmit_branch_filter
459+
- tests_local_browsers:
460+
filters: *ignore_presubmit_branch_filter
456461

457462
unit_tests:
458463
jobs:
459-
- tests_local_browsers:
460-
filters: *ignore_presubmit_branch_filter
461464
- tests_browserstack:
462465
filters: *ignore_presubmit_branch_filter
463466
- tests_saucelabs:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"bazel:buildifier": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,output-group,package-name,package-on-top,redefined-variable,repository-name,same-origin-load,string-iteration,unused-variable",
1919
"bazel:format-lint": "yarn -s bazel:buildifier --lint=warn --mode=check",
2020
"dev-app": "gulp serve:devapp",
21-
"test": "bazel test //src/... --test_tag_filters=-e2e",
21+
"test": "bazel test //src/... --test_tag_filters=-e2e,-browser:firefox-local --build_tag_filters=-browser:firefox-local --build_tests_only",
22+
"test-firefox": "bazel test //src/... --test_tag_filters=-e2e,-browser:chromium-local --build_tag_filters=-browser:chromium-local --build_tests_only",
2223
"lint": "gulp lint && yarn -s bazel:format-lint",
2324
"e2e": "bazel test //src/... --test_tag_filters=e2e",
2425
"deploy": "gulp deploy:devapp",

tools/defaults.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ def ng_web_test_suite(deps = [], static_css = [], bootstrap = [], **kwargs):
164164
deps = [
165165
"//test:angular_test_init",
166166
] + deps,
167+
browsers = [
168+
"@io_bazel_rules_webtesting//browsers:chromium-local",
169+
"@io_bazel_rules_webtesting//browsers:firefox-local",
170+
],
167171
bootstrap = [
168172
"@npm//node_modules/zone.js:dist/zone-testing-bundle.js",
169173
"@npm//node_modules/reflect-metadata:Reflect.js",

0 commit comments

Comments
 (0)