ci: use YAML aliases to define branch filters for CircleCI jobs (#33321)

PR Close #33321
This commit is contained in:
George Kalpakas 2019-10-22 14:30:09 +03:00 committed by Andrew Kushnir
parent 122f755b21
commit 22e483858e

View File

@ -38,21 +38,26 @@ var_6: &material_unit_tests_cache_key_fallback v4-angular-material-
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/ # https://circleci.com/blog/deep-diving-into-circleci-workspaces/
var_7: &workspace_location ~/ var_7: &workspace_location ~/
# Branch filter that can be specified for jobs that should only run on publish branches # Filter to run a job on builds for pull requests only.
# (e.g. master or the patch branch) var_8: &only_on_pull_requests
var_8: &publish_branches_filter filters:
branches: branches:
only: only:
- master - /pull\/\d+/
# e.g. 7.0.x, 7.1.x, etc.
- /\d+\.\d+\.x/
# Filter to ignore pull requests on a given job. # Filter to skip a job on builds for pull requests.
var_9: &ignore_pull_requests var_9: &skip_on_pull_requests
filters: filters:
branches: branches:
ignore: 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 # Executor Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors # https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
@ -775,15 +780,13 @@ workflows:
requires: requires:
- setup - setup
- test_saucelabs_bazel: - test_saucelabs_bazel:
requires:
- setup
# This job is currently a PoC and a subset of `legacy-unit-tests-saucelabs`. Running on # This job is currently a PoC and a subset of `legacy-unit-tests-saucelabs`. Running on
# master only to avoid wasting resources. # master only to avoid wasting resources.
# #
# TODO: Run this job on all branches (including PRs) as soon as it is not a PoC. # TODO: Run this job on all branches (including PRs) as soon as it is not a PoC.
filters: <<: *only_on_master
branches: requires:
only: master - setup
- test_aio: - test_aio:
requires: requires:
- setup - setup
@ -810,12 +813,10 @@ workflows:
requires: requires:
- build-ivy-npm-packages - build-ivy-npm-packages
- aio_preview: - aio_preview:
# Only run on PR builds. (There can be no previews for non-PR builds.)
<<: *only_on_pull_requests
requires: requires:
- setup - setup
# Only run on PR builds. (There can be no previews for non-PR builds.)
filters:
branches:
only: /pull\/\d+/
- test_aio_preview: - test_aio_preview:
requires: requires:
- aio_preview - aio_preview
@ -857,11 +858,11 @@ workflows:
# This isn't strictly necessary as there is no artifact dependency, but helps economize # 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. # CI resources by not attempting to build when we know should fail.
- test_win: - test_win:
<<: *ignore_pull_requests <<: *skip_on_pull_requests
requires: requires:
- test - test
- test_ivy_aot_win: - test_ivy_aot_win:
<<: *ignore_pull_requests <<: *skip_on_pull_requests
requires: requires:
- test_ivy_aot - test_ivy_aot
@ -876,9 +877,6 @@ workflows:
- setup - setup
triggers: triggers:
- schedule: - schedule:
<<: *only_on_master
# Runs AIO monitoring jobs at 10:00AM every day. # Runs AIO monitoring jobs at 10:00AM every day.
cron: "0 10 * * *" cron: "0 10 * * *"
filters:
branches:
only:
- master