Skip to content

Commit

Permalink
ci: use YAML aliases to define branch filters for CircleCI jobs (#33321)
Browse files Browse the repository at this point in the history
PR Close #33321
  • Loading branch information
gkalpak authored and AndrewKushnir committed Oct 24, 2019
1 parent 122f755 commit 22e4838
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions .circleci/config.yml
Expand Up @@ -38,21 +38,26 @@ var_6: &material_unit_tests_cache_key_fallback v4-angular-material-
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
var_7: &workspace_location ~/

# Branch filter that can be specified for jobs that should only run on publish branches
# (e.g. master or the patch branch)
var_8: &publish_branches_filter
branches:
only:
- master
# e.g. 7.0.x, 7.1.x, etc.
- /\d+\.\d+\.x/

# Filter to ignore pull requests on a given job.
var_9: &ignore_pull_requests
# Filter to run a job on builds for pull requests only.
var_8: &only_on_pull_requests
filters:
branches:
only:
- /pull\/\d+/

# Filter to skip a job on builds for pull requests.
var_9: &skip_on_pull_requests
filters:
branches:
ignore:
- /pull\/.*/
- /pull\/\d+/

# Filter to run a job on builds for the master branch only.
var_10: &only_on_master
filters:
branches:
only:
- master

# Executor Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
Expand Down Expand Up @@ -775,15 +780,13 @@ workflows:
requires:
- setup
- test_saucelabs_bazel:
requires:
- setup
# This job is currently a PoC and a subset of `legacy-unit-tests-saucelabs`. Running on
# master only to avoid wasting resources.
#
# TODO: Run this job on all branches (including PRs) as soon as it is not a PoC.
filters:
branches:
only: master
<<: *only_on_master
requires:
- setup
- test_aio:
requires:
- setup
Expand All @@ -810,12 +813,10 @@ workflows:
requires:
- build-ivy-npm-packages
- aio_preview:
# Only run on PR builds. (There can be no previews for non-PR builds.)
<<: *only_on_pull_requests
requires:
- setup
# Only run on PR builds. (There can be no previews for non-PR builds.)
filters:
branches:
only: /pull\/\d+/
- test_aio_preview:
requires:
- aio_preview
Expand Down Expand Up @@ -857,11 +858,11 @@ workflows:
# This isn't strictly necessary as there is no artifact dependency, but helps economize
# CI resources by not attempting to build when we know should fail.
- test_win:
<<: *ignore_pull_requests
<<: *skip_on_pull_requests
requires:
- test
- test_ivy_aot_win:
<<: *ignore_pull_requests
<<: *skip_on_pull_requests
requires:
- test_ivy_aot

Expand All @@ -876,9 +877,6 @@ workflows:
- setup
triggers:
- schedule:
<<: *only_on_master
# Runs AIO monitoring jobs at 10:00AM every day.
cron: "0 10 * * *"
filters:
branches:
only:
- master

0 comments on commit 22e4838

Please sign in to comment.