Skip to content

build: run CI unit tests using bazel #16379

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
Jun 26, 2019
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
29 changes: 16 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ version: 2
jobs:

# -----------------------------------
# Build and test job that uses Bazel.
# Job to test that everything builds with Bazel
# -----------------------------------
bazel_build_test:
bazel_build:
<<: *job_defaults
resource_class: xlarge
environment:
Expand All @@ -144,7 +144,6 @@ jobs:
- *yarn_install

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

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

# ------------------------------------------------------------------------------------------
# Job that runs the unit tests on locally installed browsers (Chrome and Firefox headless).
# The available browsers are installed through the angular/ngcontainer Docker image.
# The available browsers are chromium and firefox
# ------------------------------------------------------------------------------------------
tests_local_browsers:
docker: *docker-firefox-image
<<: *job_defaults
resource_class: xlarge
environment:
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
steps:
- *checkout_code
- *restore_cache
- *yarn_download
- *yarn_install
- *checkout_code
- *restore_cache
- *setup_bazel_ci_config
- *setup_bazel_remote_execution
- *yarn_download
- *yarn_install

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

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

bazel_targets:
jobs:
- bazel_build_test:
- bazel_build:
filters: *ignore_presubmit_branch_filter
- ivy_test:
filters: *ignore_presubmit_branch_filter
- api_golden_checks:
filters: *ignore_presubmit_branch_filter
- tests_local_browsers:
filters: *ignore_presubmit_branch_filter

unit_tests:
jobs:
- tests_local_browsers:
filters: *ignore_presubmit_branch_filter
- tests_browserstack:
filters: *ignore_presubmit_branch_filter
- tests_saucelabs:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"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",
"bazel:format-lint": "yarn -s bazel:buildifier --lint=warn --mode=check",
"dev-app": "gulp serve:devapp",
"test": "bazel test //src/... --test_tag_filters=-e2e",
"test": "bazel test //src/... --test_tag_filters=-e2e,-browser:firefox-local --build_tag_filters=-browser:firefox-local --build_tests_only",
"test-firefox": "bazel test //src/... --test_tag_filters=-e2e,-browser:chromium-local --build_tag_filters=-browser:chromium-local --build_tests_only",
"lint": "gulp lint && yarn -s bazel:format-lint",
"e2e": "bazel test //src/... --test_tag_filters=e2e",
"deploy": "gulp deploy:devapp",
Expand Down
4 changes: 4 additions & 0 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ def ng_web_test_suite(deps = [], static_css = [], bootstrap = [], **kwargs):
deps = [
"//test:angular_test_init",
] + deps,
browsers = [
"@io_bazel_rules_webtesting//browsers:chromium-local",
"@io_bazel_rules_webtesting//browsers:firefox-local",
],
bootstrap = [
"@npm//node_modules/zone.js:dist/zone-testing-bundle.js",
"@npm//node_modules/reflect-metadata:Reflect.js",
Expand Down