From 5d2e461c3a7ffebedc2b1087717984556bb18d32 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 15 Dec 2022 18:04:33 +0000 Subject: [PATCH] build: remove components repo unit tests job (#48521) After discussion initiated in the framework team (by kkostadinov), the team has decided to not keeping the `components-repo-unit-tests` job. This commit removes it. PR Close #48521 --- .circleci/config.yml | 71 ++----------------- .circleci/env.sh | 14 ---- docs/DEBUG_COMPONENTS_REPO_IVY.md | 39 ---------- scripts/ci/clone_angular_components_repo.sh | 31 -------- .../ci/run_angular_components_unit_tests.sh | 27 ------- 5 files changed, 5 insertions(+), 177 deletions(-) delete mode 100644 docs/DEBUG_COMPONENTS_REPO_IVY.md delete mode 100755 scripts/ci/clone_angular_components_repo.sh delete mode 100755 scripts/ci/run_angular_components_unit_tests.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 62080b7cbca..1148881e5d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,39 +34,34 @@ var_4: &cache_key_fallback v8-angular-node-16-{{ checksum "month.txt" }}-{{ chec var_3_win: &cache_key_win v10-angular-win-node-16-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }} var_4_win: &cache_key_win_fallback v10-angular-win-node-16-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }} -# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the -# cache keys also update the SHA for the "COMPONENTS_REPO_COMMIT" environment variable. -var_5: &components_repo_unit_tests_cache_key v2-angular-components-{{ checksum "month.txt" }}-87eb708d162e89897e66809c371e3a1e079de962 -var_6: &components_repo_unit_tests_cache_key_fallback v2-angular-components-{{ checksum "month.txt" }} - # Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages`. # https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs # https://circleci.com/blog/deep-diving-into-circleci-workspaces/ -var_7: &workspace_location ~/ +var_5: &workspace_location ~/ # Filter to run a job on builds for pull requests only. -var_8: &only_on_pull_requests +var_6: &only_on_pull_requests filters: branches: only: - /pull\/\d+/ # Filter to skip a job on builds for pull requests. -var_9: &skip_on_pull_requests +var_7: &skip_on_pull_requests filters: branches: ignore: - /pull\/\d+/ # Filter to run a job on builds for the main branch only. -var_10: &only_on_main_branch +var_8: &only_on_main_branch filters: branches: only: - main # Filter to run a job on all releasable branches. -var_11: &only_release_branches +var_9: &only_release_branches filters: branches: only: @@ -551,59 +546,6 @@ jobs: name: Stop Saucelabs tunnel service command: ./tools/saucelabs/sauce-service.sh stop - # Job that runs all unit tests of the `angular/components` repository. - components-repo-unit-tests: - executor: - name: default-executor - resource_class: xlarge - steps: - - custom_attach_workspace - - init_environment - # Restore the cache before cloning the repository because the clone script re-uses - # the restored repository if present. This reduces the amount of times the components - # repository needs to be cloned (this is slow and increases based on commits in the repo). - - restore_cache: - keys: - - *components_repo_unit_tests_cache_key - # Whenever the `angular/components` SHA is updated, the cache key will no longer - # match. The fallback cache will still match, and CircleCI will restore the most - # recently cached repository folder. Without the fallback cache, we'd need to download - # the repository from scratch and it would slow down the job. This is because we can't - # clone the repository with reduced `--depth`, but rather need to clone the whole - # repository to be able to support arbitrary SHAs. - - *components_repo_unit_tests_cache_key_fallback - - run: - name: 'Fetching angular/components repository' - command: ./scripts/ci/clone_angular_components_repo.sh - - run: - # Run yarn install to fetch the Bazel binaries as used in the components repo. - name: Installing dependencies. - command: yarn --cwd ${COMPONENTS_REPO_TMP_DIR} install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn - - save_cache: - key: *components_repo_unit_tests_cache_key - paths: - # Temporary directory must be kept in sync with the `$COMPONENTS_REPO_TMP_DIR` env - # variable. It needs to be hardcoded here, because env variables interpolation is - # not supported. - - '/tmp/angular-components-repo' - - run: - # Copy zone.js package to dist/packages-dist, so `angular/components` can also use the local zone.js build. - name: Setting up zone.js release packages. - command: cp -r dist/zone.js-dist/zone.js dist/packages-dist/ - - run: - # Updates the `angular/components` `package.json` file to refer to the release output - # inside the `packages-dist` directory. - name: Setting up framework release packages. - command: node scripts/ci/update-framework-deps-to-dist-packages.js ${COMPONENTS_REPO_TMP_DIR}/package.json dist/packages-dist/ - - run: - # Run `yarn install` again to install the Angular packages from `packages-dist/` and update the lockfile. - # NOTE: We cannot rely on Bazel to run `yarn install`, because it uses the `--frozen-lockfile` flag and fails. - name: Installing local Angular packages. - command: yarn --cwd ${COMPONENTS_REPO_TMP_DIR} install --non-interactive --cache-folder ~/.cache/yarn - - run: - name: 'Running `angular/components` unit tests' - command: ./scripts/ci/run_angular_components_unit_tests.sh - test_zonejs: executor: name: default-executor @@ -752,9 +694,6 @@ workflows: # since the publishing script expects the legacy outputs layout. - build-npm-packages - legacy-unit-tests-saucelabs - - components-repo-unit-tests: - requires: - - build-npm-packages - test_zonejs: requires: - setup diff --git a/.circleci/env.sh b/.circleci/env.sh index 7775f886925..3bfd556a448 100755 --- a/.circleci/env.sh +++ b/.circleci/env.sh @@ -61,20 +61,6 @@ setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-framework-${CIRCLE_BUILD_NUM}-${CI # acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout. setPublicVar SAUCE_READY_FILE_TIMEOUT 120 - -#################################################################################################### -# Define environment variables for the `angular/components` repo unit tests job. -#################################################################################################### -# We specifically use a directory within "/tmp" here because we want the cloned repo to be -# completely isolated from angular/angular in order to avoid any bad interactions between -# their separate build setups. **NOTE**: When updating the temporary directory, also update -# the `save_cache` path configuration in `config.yml` -setPublicVar COMPONENTS_REPO_TMP_DIR "/tmp/angular-components-repo" -setPublicVar COMPONENTS_REPO_URL "https://github.com/angular/components.git" -setPublicVar COMPONENTS_REPO_BRANCH "main" -# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI `config.yml`. -setPublicVar COMPONENTS_REPO_COMMIT "87eb708d162e89897e66809c371e3a1e079de962" - #################################################################################################### # Create shell script in /tmp for Bazel actions to access CI envs without # busting the cache. Used by payload-size.sh script in integration tests. diff --git a/docs/DEBUG_COMPONENTS_REPO_IVY.md b/docs/DEBUG_COMPONENTS_REPO_IVY.md deleted file mode 100644 index 61df65e70d6..00000000000 --- a/docs/DEBUG_COMPONENTS_REPO_IVY.md +++ /dev/null @@ -1,39 +0,0 @@ -# Debugging the `components-repo-unit-tests` job - -Currently, all changes to Ivy are validated against the test suite of the -`angular/components` repository. In order to debug the `components-repo-unit-tests` CI -job, the following steps can be used: - -1\) Build the Ivy package output by running `yarn build` in the `angular/angular` repo. - -2\) Clone the `angular/components` repository if not done yet ([quick link to repo](https://github.com/angular/components)). - -3\) Set up the package output in the `angular/components` repository by running the following -command in the `angular/angular` repo: - -```bash -node ./scripts/ci/update-framework-deps-to-dist-packages.js {COMPONENTS_REPO}/package.json ./dist/packages-dist -``` - -4\) Switch into the `angular/components` repository and run the tests by using the -following command: - -```bash -yarn test --deleted_packages=//src/dev-app -``` - -### Running tests for individual entry-points - -The `yarn test` script from the `components` repository runs all tests in the project. -This is sometimes not desired because it involves building and testing of all packages -and entry-points. Running tests for an individual entry-point is possible by explicitly -selecting a given test target. - -Here is an example of commands that run individual test targets. Note that it is -**important** to specify the `--config=ivy` flag in order to run tests with Ivy. - -```bash -yarn bazel test --config=ivy src/material/slider:unit_tests -yarn bazel test --config=ivy src/cdk/a11y:unit_tests -yarn bazel test --config=ivy src/material/toolbar:unit_tests -``` diff --git a/scripts/ci/clone_angular_components_repo.sh b/scripts/ci/clone_angular_components_repo.sh deleted file mode 100755 index 4607a386c8f..00000000000 --- a/scripts/ci/clone_angular_components_repo.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -set -u -e -o pipefail - -# Clones the `angular/components` repository if the repository has not been cloned before. -# If the repository has been already cloned, the script refreshes the repository by syncing -# with the upstream remote, and resetting to the commit specified in the `COMPONENTS_REPO_COMMIT` -# environment variable. - -if [[ ! -d "${COMPONENTS_REPO_TMP_DIR}" ]]; then - # Clone the repository if not present through restored cache. - git clone --branch ${COMPONENTS_REPO_BRANCH} ${COMPONENTS_REPO_URL} ${COMPONENTS_REPO_TMP_DIR} - - # Switch into the cloned repository. - cd ${COMPONENTS_REPO_TMP_DIR} - - # Reset branch to the desired commit. - git reset --hard ${COMPONENTS_REPO_COMMIT} -else - # Switch into the cached repository. - cd ${COMPONENTS_REPO_TMP_DIR} - - # Only refresh the repository if the current branch HEAD is not - # matching the desired commit. - if [[ "$(git rev-parse HEAD)" != "${COMPONENTS_REPO_COMMIT}" ]]; then - # Pull the latest changes of the specified branch. - git fetch origin ${COMPONENTS_REPO_BRANCH} - - # Reset the current branch to the desired commit. - git reset --hard ${COMPONENTS_REPO_COMMIT} - fi -fi diff --git a/scripts/ci/run_angular_components_unit_tests.sh b/scripts/ci/run_angular_components_unit_tests.sh deleted file mode 100755 index a152926f87b..00000000000 --- a/scripts/ci/run_angular_components_unit_tests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -u -e -o pipefail - -# Script that runs all unit tests of the `angular/components` repository. - -# Path to the Angular project. -angular_dir=$(pwd) - -# Switch into the temporary directory where the `angular/components` -# repository has been cloned into. -cd ${COMPONENTS_REPO_TMP_DIR} - -# Create a symlink for the Bazel binary installed through NPM, as running through Yarn introduces OOM errors. -./scripts/circleci/setup_bazel_binary.sh - -# Properly wire up the components repo CircleCI Bazel configuration -# Also enable RBE. The credentials are expected to be set up already. -echo "import %workspace%/.circleci/bazel.rc" >> ./.bazelrc.user -echo "build --config=remote" >> ./.bazelrc.user - -# Now actually run the tests. -bazel test \ - --build_tag_filters=-docs-package,-e2e,-browser:firefox \ - --test_tag_filters=-e2e,-browser:firefox \ - --build_tests_only \ - --keep_going \ - -- src/...