ci: add yarn cache for material-unit tests job (#29378)
PR Close #29378
This commit is contained in:
parent
067657c1e9
commit
37cc514f0f
|
@ -563,7 +563,24 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- *attach_workspace
|
- *attach_workspace
|
||||||
- *init_environment
|
- *init_environment
|
||||||
- run: ./scripts/ci/run_angular_material_unit_tests.sh
|
- run:
|
||||||
|
name: "Determining SHA of Material Ivy branch"
|
||||||
|
command: git ls-remote ${MATERIAL_REPO_URL} ${MATERIAL_REPO_BRANCH} | cut -f1 > material_repo_sha
|
||||||
|
- run:
|
||||||
|
name: "Cloning Material repository"
|
||||||
|
command: ./scripts/ci/clone_angular_material_repo.sh
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- v1-angular-material-{{ checksum "material_repo_sha" }}
|
||||||
|
- v1-angular-material-
|
||||||
|
- run:
|
||||||
|
name: "Running Material unit tests"
|
||||||
|
command: ./scripts/ci/run_angular_material_unit_tests.sh
|
||||||
|
- save_cache:
|
||||||
|
key: v1-angular-material-{{ checksum "material_repo_sha" }}
|
||||||
|
paths:
|
||||||
|
# Needs to be hardcoded because environment variables are not interpolated here.
|
||||||
|
- "/tmp/material2/node_modules"
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
|
@ -62,6 +62,15 @@ setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_
|
||||||
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
|
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
|
||||||
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
|
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# Define environment variables for the Angular Material 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 "ivy-2019"
|
||||||
|
|
||||||
# Source `$BASH_ENV` to make the variables available immediately.
|
# Source `$BASH_ENV` to make the variables available immediately.
|
||||||
source $BASH_ENV;
|
source $BASH_ENV;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -u -e -o pipefail
|
||||||
|
|
||||||
|
# Ensure that the temporary directory does not exist.
|
||||||
|
rm -rf ${MATERIAL_REPO_TMP_DIR}
|
||||||
|
|
||||||
|
# Clone the Material repository into the given temporary directory.
|
||||||
|
git clone --depth 1 --branch ${MATERIAL_REPO_BRANCH} ${MATERIAL_REPO_URL} \
|
||||||
|
${MATERIAL_REPO_TMP_DIR}
|
|
@ -1,36 +1,28 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -u -e -o pipefail
|
set -u -e -o pipefail
|
||||||
|
|
||||||
|
|
||||||
# This script runs unit tests from angular/material2.
|
# This script runs unit tests from angular/material2.
|
||||||
|
|
||||||
# Save the dir for the root of the Angular repo.
|
# Save the dir for the root of the Angular repo.
|
||||||
angular_dir=$(pwd)
|
angular_dir=$(pwd)
|
||||||
|
|
||||||
# Clone the angular/material2 repo into tmp so we can run the tests from there.
|
# Switch into Material directory.
|
||||||
# We specifically use /tmp here because we want the cloned repo to be completely
|
cd ${MATERIAL_REPO_TMP_DIR}
|
||||||
# isolated from angular/angular in order to avoid any bad interactions between their
|
|
||||||
# separate build setups. Also note that this is using the ivy-2019 branch, which has
|
|
||||||
# previously been set up to work with ivy.
|
|
||||||
cd /tmp
|
|
||||||
rm -rf /tmp/material2
|
|
||||||
git clone --depth 1 --branch ivy-2019 https://github.com/angular/material2.git
|
|
||||||
|
|
||||||
# Install dependencies for the freshly cloned repo.
|
# Install dependencies for the freshly cloned repo.
|
||||||
cd /tmp/material2
|
yarn install --frozen-lockfile --non-interactive
|
||||||
yarn install --frozen-lockfile --non-interactive # TODO: cache
|
|
||||||
|
|
||||||
# Install this version of Angular into the freshly cloned repo.
|
# Install this version of Angular into the freshly cloned repo.
|
||||||
rm -rf /tmp/material2/node_modules/@angular/*
|
rm -rf ./node_modules/@angular/*
|
||||||
cp -r ${angular_dir}/dist/packages-dist-ivy-aot/* /tmp/material2/node_modules/@angular/
|
cp -r ${angular_dir}/dist/packages-dist-ivy-aot/* ./node_modules/@angular/
|
||||||
|
|
||||||
# The angular/material2 CI sets TEST_PLATFORM to either local, saucelabs, or browserstack.
|
# The angular/material2 CI sets TEST_PLATFORM to either "local", "saucelabs", or "browserstack".
|
||||||
# For angular/angular, we only want to run the local tests.
|
# For angular/angular, we only want to run the "local" tests.
|
||||||
export TEST_PLATFORM=local
|
export TEST_PLATFORM=local
|
||||||
|
|
||||||
# Append the test blocklist into angular/material2's karma-test-shim.js.
|
# Append the test blocklist into angular/material2's karma-test-shim.js.
|
||||||
# This filters out known-failing tests because the goal is to prevent regressions.
|
# This filters out known-failing tests because the goal is to prevent regressions.
|
||||||
cat ${angular_dir}/tools/material-ci/angular_material_test_blocklist.js >> /tmp/material2/test/karma-test-shim.js
|
cat ${angular_dir}/tools/material-ci/angular_material_test_blocklist.js >> ./test/karma-test-shim.js
|
||||||
|
|
||||||
# Now actually run the tests.
|
# Now actually run the tests.
|
||||||
yarn gulp test:single-run
|
yarn gulp test:single-run
|
||||||
|
|
Loading…
Reference in New Issue