ci: rename `material-unit-tests` job to `components-repo-unit-tests` (#34898)

We rename the `material-unit-tests` job to `components-repo-unit-tests`
because the job runs all unit tests found in the Angular Components repository.
This includes the Angular CDK, Angular Material and more. Also the repository has
been renamed from `angular/material2` to `angular/components` in the past.

PR Close #34898
This commit is contained in:
Paul Gschwendtner 2020-01-22 21:54:16 +01:00 committed by Andrew Kushnir
parent 3049878aa9
commit fa4ea34401
10 changed files with 103 additions and 93 deletions

View File

@ -27,10 +27,10 @@ var_4: &cache_key_fallback v3-angular-node-10.16-
var_3_win: &cache_key_win v5-angular-win-node-12.0-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_4_win: &cache_key_win_fallback v5-angular-win-node-12.0-
# Cache key for the Material unit tests job. **Note** when updating the SHA in the cache keys,
# also update the SHA for the "MATERIAL_REPO_COMMIT" environment variable.
var_5: &material_unit_tests_cache_key v5-angular-material-97a7e2babbccd3dc58e7b3364004e45ed5bd9968
var_6: &material_unit_tests_cache_key_fallback v5-angular-material-
# 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 v5-angular-components-97a7e2babbccd3dc58e7b3364004e45ed5bd9968
var_6: &components_repo_unit_tests_cache_key_fallback v5-angular-components-
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages` and
# `build-ivy-npm-packages`.
@ -682,11 +682,10 @@ jobs:
- run: yarn karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
- run: ./scripts/saucelabs/stop-tunnel.sh
# Job to run unit tests from angular/components. Needs a browser since all
# component unit tests assume they're running in the browser environment.
material-unit-tests:
# Job that runs all unit tests of the `angular/components` repository.
components-repo-unit-tests:
executor:
name: browsers-executor
name: default-executor
resource_class: xlarge
steps:
- custom_attach_workspace
@ -696,33 +695,41 @@ jobs:
# repository needs to be cloned (this is slow and increases based on commits in the repo).
- restore_cache:
keys:
- *material_unit_tests_cache_key
- *material_unit_tests_cache_key_fallback
- *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 Material repository"
command: ./scripts/ci/clone_angular_material_repo.sh
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 Material repo.
name: Installing Material dependencies.
# Run yarn install to fetch the Bazel binaries as used in the components repo.
name: Installing dependencies.
# TODO: remove this once the repo has been updated to use NodeJS v12 and Yarn 1.19.1.
# We temporarily ignore the "engines" because the Angular components repository has
# minimum dependency on NodeJS v12 and Yarn 1.19.1, but the framework repository uses
# older versions.
command: yarn --ignore-engines --cwd ${MATERIAL_REPO_TMP_DIR} install --frozen-lockfile --non-interactive
command: yarn --ignore-engines --cwd ${COMPONENTS_REPO_TMP_DIR} install --frozen-lockfile --non-interactive
- save_cache:
key: *material_unit_tests_cache_key
key: *components_repo_unit_tests_cache_key
paths:
# Material directory must be kept in sync with the `$MATERIAL_REPO_TMP_DIR` env variable.
# It needs to be hardcoded here, because env variables interpolation is not supported.
- "/tmp/material2"
# 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:
# Updates Material's `package.json` to refer to the `packages-dist` directory. Note
# that it's not necessary to perform a yarn install, as Bazel runs it automatically.
# Updates the `angular/components` `package.json` file to refer to the release output
# inside the `packages-dist` directory. Note that it's not necessary to perform a yarn
# install as Bazel runs Yarn automatically when needed.
name: Setting up release packages.
command: node scripts/ci/update-deps-to-dist-packages.js ${MATERIAL_REPO_TMP_DIR}/package.json dist/packages-dist/
command: node scripts/ci/update-deps-to-dist-packages.js ${COMPONENTS_REPO_TMP_DIR}/package.json dist/packages-dist/
- run:
name: "Running Material unit tests"
command: ./scripts/ci/run_angular_material_unit_tests.sh
name: "Running `angular/components` unit tests"
command: ./scripts/ci/run_angular_components_unit_tests.sh
test_zonejs:
executor:
@ -866,7 +873,7 @@ workflows:
- build-npm-packages
- build-ivy-npm-packages
- legacy-unit-tests-saucelabs
- material-unit-tests:
- components-repo-unit-tests:
requires:
- build-npm-packages
- test_zonejs:

View File

@ -66,16 +66,17 @@ setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-framework-${CIRCLE_BUILD_NUM}-${CI
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
####################################################################################################
# Define environment variables for the Angular Material unit tests job.
# 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.
setPublicVar MATERIAL_REPO_TMP_DIR "/tmp/material2"
setPublicVar MATERIAL_REPO_URL "https://github.com/angular/material2.git"
setPublicVar MATERIAL_REPO_BRANCH "master"
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI "config.yml".
setPublicVar MATERIAL_REPO_COMMIT "97a7e2babbccd3dc58e7b3364004e45ed5bd9968"
# 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 "master"
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI `config.yml`.
setPublicVar COMPONENTS_REPO_COMMIT "97a7e2babbccd3dc58e7b3364004e45ed5bd9968"
####################################################################################################

4
.github/CODEOWNERS vendored
View File

@ -939,10 +939,10 @@ testing/** @angular/fw-test
# ================================================
# Material CI
# angular/components CI
# ================================================
/tools/material-ci/** @angular/fw-core @angular/framework-global-approvers
/tools/components-repo-ci/** @angular/fw-core @angular/framework-global-approvers

View File

@ -1,7 +1,7 @@
# Debugging the Material unit tests job
# 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 `material-unit-tests` CI
`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 `node ./scripts/build-ivy-npm-packages.js` in
@ -9,14 +9,14 @@ 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 `components` repository by running the following
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-deps-to-dist-packages.js {COMPONENTS_REPO}/package.json ./dist/packages-dist-ivy-aot
```
4\) Switch into the `components` repository and run the tests by using the
4\) Switch into the `angular/components` repository and run the tests by using the
following command:
```bash

View File

@ -0,0 +1,31 @@
#!/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

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# Clones the Angular Material repository if the repository has not been cloned before. If
# the repository is already cloned, the script refreshes the repository by syncing with
# upstream and resetting to the desired Material commit (see "MATERIAL_REPO_COMMIT" variable).
if [[ ! -d "${MATERIAL_REPO_TMP_DIR}" ]]; then
# Clone the Material repository if not present through restored cache.
git clone --branch ${MATERIAL_REPO_BRANCH} ${MATERIAL_REPO_URL} ${MATERIAL_REPO_TMP_DIR}
# Switch into the cloned repository.
cd ${MATERIAL_REPO_TMP_DIR}
# Reset branch to the desired commit.
git reset --hard ${MATERIAL_REPO_COMMIT}
else
# Switch into the cached repository.
cd ${MATERIAL_REPO_TMP_DIR}
# Only refresh the repository if the current branch HEAD is not
# matching the desired commit.
if [[ "$(git rev-parse HEAD)" != "${MATERIAL_REPO_COMMIT}" ]]; then
# Pull the latest changes of the specified branch.
git fetch origin ${MATERIAL_REPO_BRANCH}
# Reset the current branch to the desired commit.
git reset --hard ${MATERIAL_REPO_COMMIT}
fi
fi

View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# Script that runs all unit tests of the `angular/components` repository. The script also
# sets up the test blocklist from `tools/components-repo-ci`.
# 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}
# Copy the test blocklist into the `angular/components` repository. The unit tests will
# automatically pick up the blocklist and disable the specified tests.
cp ${angular_dir}/tools/components-repo-ci/test-blocklist.ts ${COMPONENTS_REPO_TMP_DIR}/test/
# Create a symlink for the Bazel binary installed through NPM, as running through Yarn introduces OOM errors.
./scripts/circleci/setup_bazel_binary.sh
# Now actually run the tests. The dev-app and all its subpackages are excluded as they fail
# to compile due to limitations in Ivy's type checker (see FW-1352 and FW-1433)
bazel test --build_tag_filters=-docs-package,-e2e,-browser:firefox-local --test_tag_filters=-e2e,-browser:firefox-local --config=ivy -- src/... -src/dev-app/...

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# This script runs unit tests from angular/material2.
# Save the dir for the root of the Angular repo.
angular_dir=$(pwd)
# Switch into Material directory.
cd ${MATERIAL_REPO_TMP_DIR}
# Copy the test blocklist into the "angular/components" repository. The components
# repository automatically picks up the blocklist and disables the specified tests.
cp ${angular_dir}/tools/material-ci/test-blocklist.ts ${MATERIAL_REPO_TMP_DIR}/test/
# Create a symlink for the Bazel binary installed through NPM, as running through Yarn introduces OOM errors.
./scripts/circleci/setup_bazel_binary.sh
# Now actually run the tests. The dev-app and all its subpackages are excluded as they fail
# to compile due to limitations in Ivy's type checker (see FW-1352 and FW-1433)
bazel test --build_tag_filters=-docs-package,-e2e,-browser:firefox-local --test_tag_filters=-e2e,-browser:firefox-local --config=ivy -- src/... -src/dev-app/...

View File

@ -1,8 +1,8 @@
### Unit tests for Angular CDK/Material
### Unit tests for `angular/components`
Currently, all changes to Ivy are validated against the test suite of the
`angular/components` repository. Known failing tests are skipped based on
the blocklist in `tools/material-ci/test-blocklist.ts`.
the blocklist in `tools/components-repo-ci/test-blocklist.ts`.
Whenever the root cause of a known failure is identified, the `notes` field
for the corresponding tests should be updated. Whenever a failure is resolved,
@ -10,7 +10,7 @@ the corresponding tests should be removed from the blocklist.
### Debugging
Information on debugging can be found [here](../../docs/DEBUG_MATERIAL_IVY.md).
Information on debugging can be found [here](../../docs/DEBUG_COMPONENTS_REPO_IVY.md).
### Excluding new tests