build: setup cronjob to run tests against angular snapshots (#14217)

* Sets up a cronjob workflow that runs the local browser tests against the Angular Github snapshot builds at midnight everyday.
* No longer saves cache multiple times. This can cause unexpected behavior.
* Sorts jobs in `config.yml` to group all `tests_XX` jobs.

Closes #12516.
This commit is contained in:
Paul Gschwendtner
2018-11-27 22:02:22 +01:00
committed by Jeremy Elbourn
parent 50bf6f14a5
commit 2633c7cffd
3 changed files with 51 additions and 20 deletions
+30 -20
View File
@@ -91,24 +91,6 @@ jobs:
- run: bazel build src/...
- run: bazel test src/... tools/public_api_guard/...
# ------------------------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------------------------
tests_local_browsers:
docker: *docker-firefox-image
resource_class: xlarge
environment:
TEST_PLATFORM: local
steps:
- *checkout_code
- *restore_cache
- *yarn_install
# Launches the unit tests. The platform is determined by the "TEST_PLATFORM" environment
# variable which has been configured above
- run: yarn gulp ci:test
# ----------------------------------------------------------------
# Job that runs the e2e tests with Protractor and Chrome Headless
# ----------------------------------------------------------------
@@ -122,6 +104,20 @@ jobs:
- run: yarn gulp ci:e2e
# ------------------------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------------------------
tests_local_browsers:
docker: *docker-firefox-image
resource_class: xlarge
steps:
- *checkout_code
- *restore_cache
- *yarn_install
- run: ./scripts/circleci/run-local-browser-tests.sh
# ----------------------------------------------------------------------------
# Job that runs the unit tests on Browserstack. The browsers that will be used
# to run the unit tests on Browserstack are set in: test/browser-providers.js
@@ -269,8 +265,6 @@ jobs:
- run: ./scripts/circleci/publish-snapshots.sh
- *save_cache
# ----------------------------------------------------------------------------------------
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
# one job depends on another.
@@ -313,6 +307,22 @@ workflows:
jobs:
- lint
# Snapshot tests workflow that is scheduled to run all specified jobs at midnight everyday.
# This workflow runs various jobs against the Angular snapshot builds from Github.
snapshot_tests:
jobs:
- tests_local_browsers
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
# We only want to run the "master" branch against the snapshot builds because
# it's not guaranteed that older versions of Angular Material always work
# with the latest Angular version.
- master
# ---------------------------
# General setup for CircleCI
# ---------------------------
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# In case any command failed, we want to immediately exit the script with the
# proper exit code.
set -e
# Go to project directory.
cd $(dirname ${0})/../..
# In case the "snapshot_tests" workflow is currently running this script, we
# want to run the local browser tests against the Angular snapshot builds.
if [[ "${CIRCLE_WORKFLOW_ID}" == "snapshot_tests" ]]; then
./scripts/install-angular-snapshots.sh
fi
# Setup the test platform environment variable that will be read
# by the Karma configuration script.
export TEST_PLATFORM="local"
# Run the unit tests on the local browsers with Karma.
yarn gulp ci:test