Skip to content

Commit 6940ea5

Browse files
committed
build: setup cronjob to run tests against angular snapshots
* 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.
1 parent 16f53a7 commit 6940ea5

File tree

3 files changed

+51
-20
lines changed

3 files changed

+51
-20
lines changed

.circleci/config.yml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,6 @@ jobs:
9191
- run: bazel build src/...
9292
- run: bazel test src/... tools/public_api_guard/...
9393

94-
# ------------------------------------------------------------------------------------------
95-
# Job that runs the unit tests on locally installed browsers (Chrome and Firefox headless).
96-
# The available browsers are installed through the angular/ngcontainer Docker image.
97-
# ------------------------------------------------------------------------------------------
98-
tests_local_browsers:
99-
docker: *docker-firefox-image
100-
resource_class: xlarge
101-
environment:
102-
TEST_PLATFORM: local
103-
steps:
104-
- *checkout_code
105-
- *restore_cache
106-
- *yarn_install
107-
108-
# Launches the unit tests. The platform is determined by the "TEST_PLATFORM" environment
109-
# variable which has been configured above
110-
- run: yarn gulp ci:test
111-
11294
# ----------------------------------------------------------------
11395
# Job that runs the e2e tests with Protractor and Chrome Headless
11496
# ----------------------------------------------------------------
@@ -122,6 +104,20 @@ jobs:
122104

123105
- run: yarn gulp ci:e2e
124106

107+
# ------------------------------------------------------------------------------------------
108+
# Job that runs the unit tests on locally installed browsers (Chrome and Firefox headless).
109+
# The available browsers are installed through the angular/ngcontainer Docker image.
110+
# ------------------------------------------------------------------------------------------
111+
tests_local_browsers:
112+
docker: *docker-firefox-image
113+
resource_class: xlarge
114+
steps:
115+
- *checkout_code
116+
- *restore_cache
117+
- *yarn_install
118+
119+
- run: ./scripts/run-local-browser-tests.sh
120+
125121
# ----------------------------------------------------------------------------
126122
# Job that runs the unit tests on Browserstack. The browsers that will be used
127123
# to run the unit tests on Browserstack are set in: test/browser-providers.js
@@ -269,8 +265,6 @@ jobs:
269265

270266
- run: ./scripts/circleci/publish-snapshots.sh
271267

272-
- *save_cache
273-
274268
# ----------------------------------------------------------------------------------------
275269
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
276270
# one job depends on another.
@@ -313,6 +307,22 @@ workflows:
313307
jobs:
314308
- lint
315309

310+
# Snapshot tests workflow that is scheduled to run all specified jobs at midnight everyday.
311+
# This workflow runs various jobs against the Angular snapshot builds from Github.
312+
snapshot_tests:
313+
jobs:
314+
- tests_local_browsers
315+
triggers:
316+
- schedule:
317+
cron: "0 0 * * *"
318+
filters:
319+
branches:
320+
only:
321+
# We only want to run the "master" branch against the snapshot builds because
322+
# it's not guaranteed that older versions of Angular Material always work
323+
# with the latest Angular version.
324+
- master
325+
316326
# ---------------------------
317327
# General setup for CircleCI
318328
# ---------------------------
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# In case any command failed, we want to immediately exit the script with the
4+
# proper exit code.
5+
set -e
6+
7+
# Go to project directory.
8+
cd $(dirname ${0})/../..
9+
10+
# In case the "snapshot_tests" workflow is currently running this script, we
11+
# want to run the local browser tests against the Angular snapshot builds.
12+
if [[ "${CIRCLE_WORKFLOW_ID}" == "snapshot_tests" ]]; then
13+
./scripts/install-angular-snapshots.sh
14+
fi
15+
16+
# Setup the test platform environment variable that will be read
17+
# by the Karma configuration script.
18+
export TEST_PLATFORM="local"
19+
20+
# Run the unit tests on the local browsers with Karma.
21+
yarn gulp ci:test

0 commit comments

Comments
 (0)