Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ----------------------------------------------------------------
Expand All @@ -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
Expand Down Expand Up @@ -269,8 +265,6 @@ jobs:

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

- *save_cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer want to save the cache here?

Copy link
Member Author

@devversion devversion Nov 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the cache should be only updated once in the build_release_packages task. It doesn't make sense to store multiple times because the checksum shouldn't differ.


# ----------------------------------------------------------------------------------------
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
# one job depends on another.
Expand Down Expand Up @@ -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
# ---------------------------
Expand Down
21 changes: 21 additions & 0 deletions scripts/circleci/run-local-browser-tests.sh
Original file line number Diff line number Diff line change
@@ -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