Skip to content

Commit 203c8d6

Browse files
devversionandrewseguin
authored andcommitted
build: do not build unnecessary build targets in bazel test jobs (#18158)
Currently in Bazel test jobs we simply use `//src/...`. This results in non-test targets which are simply unnecessary (e.g. npm_packages), being built. Instead, we can specify `--build_tests_only` to instruct bazel to only build targets needed for testing. We verify our build in a separate `bazel_build` job, so building unrelated things in every test job is superfluos.
1 parent 0c26354 commit 203c8d6

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

.circleci/config.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
- *yarn_install
206206
- *setup_bazel_binary
207207

208-
- run: bazel test src/... --build_tag_filters=e2e --test_tag_filters=e2e
208+
- run: bazel test src/... --build_tag_filters=e2e --test_tag_filters=e2e --build_tests_only
209209

210210
# ------------------------------------------------------------------------------------------
211211
# Job that runs the unit tests on locally installed browsers (Chrome and Firefox headless).
@@ -225,7 +225,7 @@ jobs:
225225
- *yarn_install
226226
- *setup_bazel_binary
227227

228-
- run: bazel test src/... --build_tag_filters=-e2e --test_tag_filters=-e2e
228+
- run: bazel test src/... --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only
229229

230230
# ----------------------------------------------------------------------------
231231
# Job that runs the unit tests on Browserstack. The browsers that will be used
@@ -435,7 +435,7 @@ jobs:
435435
- *yarn_install_loose_lockfile
436436
- *setup_bazel_binary
437437

438-
- run: bazel test src/... --build_tag_filters=-e2e --test_tag_filters=-e2e
438+
- run: bazel test src/... --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only
439439

440440
# ----------------------------------------------------------------------------
441441
# Job that runs all Bazel tests against View Engine with the current Angular version
@@ -456,8 +456,7 @@ jobs:
456456
- *setup_bazel_binary
457457

458458
# Run project tests with NGC and View Engine.
459-
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e --config=view-engine
460-
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine
459+
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine --build_tests_only
461460

462461
# ----------------------------------------------------------------------------
463462
# Job that runs all Bazel tests against View Engine from angular/angular#master.
@@ -478,8 +477,7 @@ jobs:
478477
- *setup_bazel_binary
479478

480479
# Run project tests with NGC and View Engine.
481-
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e --config=view-engine
482-
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine
480+
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine --build_tests_only
483481

484482
# ----------------------------------------------------------------------------
485483
# Job that runs all Bazel tests against material-components-web@canary
@@ -503,8 +501,7 @@ jobs:
503501

504502
# Setup the components repository to use the MDC snapshot builds.
505503
# Run project tests with the MDC canary builds.
506-
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e
507-
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e
504+
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --build_tests_only
508505

509506
# ----------------------------------------------------------------------------------------
510507
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if

0 commit comments

Comments
 (0)