<commit_before># Configuration file for https://circleci.com/gh/angular/angular

# Note: YAML anchors allow an object to be re-used, reducing duplication.
# The ampersand declares an alias for an object, then later the `<<: *name`
# syntax dereferences it.
# See http://blog.daemonl.com/2016/02/yaml.html
# To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/

# Note that the browser docker image comes with Chrome and Firefox preinstalled. This is just
# needed for jobs that run tests without Bazel. Bazel runs tests with browsers that will be
# fetched by the Webtesting rules. Therefore for jobs that run tests with Bazel, we don't need a
# docker image with browsers pre-installed.
# **NOTE 1**: If you change the version of the `*-browsers` docker image, make sure the
#             `CI_CHROMEDRIVER_VERSION_ARG` env var (in `.circleci/env.sh`) points to a ChromeDriver
#             version that is compatible with the Chrome version in the image.
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
var_1: &default_docker_image circleci/node:10.16
var_2: &browsers_docker_image circleci/node:10.16-browsers
# We don't want to include the current branch name in the cache key because that would prevent
# PRs from being able to restore the cache since the branch names are always different for PRs.
# The cache key should only consist of dynamic values that change whenever something in the
# cache changes. For example:
# 1) yarn lock file changes --> cached "node_modules" are different.
# 2) bazel repository definitions change --> cached bazel repositories are different.
# **NOTE 1 **: If you change the cache key prefix, also sync the restore_cache fallback to match.
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v3-angular-node-10.16-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_3_win: &cache_key_win v4-angular-win-node-12.0-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}

# Initializes the CI environment by setting up common environment variables.
var_4: &init_environment
  run:
    name: Initializing environment (setting up variables, overwriting Yarn)
    # Overwrite the yarn installed in the docker container with our own version.
    command: |
      ./.circleci/env.sh
      ourYarn=$(realpath ./third_party/github.com/yarnpkg/yarn/releases/download/v1.13.0/bin/yarn.js)
      sudo chmod a+x $ourYarn
      sudo ln -fs $ourYarn /usr/local/bin/yarn
      echo "Yarn version: $(yarn --version)"

      # Add GitHub to known hosts.
      mkdir -p ~/.ssh
      echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts

      # use git+ssh instead of https
      git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
      git config --global gc.auto 0 || true

var_4_win: &init_environment_win
  run:
    # Install Bazel pre-requisites that aren't in the preconfigured CircleCI Windows VM.
    name: Setup windows node environment
    command: ./.circleci/windows-env.ps1


var_5: &setup_bazel_remote_execution
  run:
    name: "Setup bazel RBE remote execution"
    command: |
      # We need ensure that the same default digest is used for encoding and decoding
      # with openssl. Openssl versions might have different default digests which can
      # cause decryption failures based on the openssl version. https://stackoverflow.com/a/39641378/4317734
      openssl aes-256-cbc -d -in .circleci/gcp_token -md md5 -k "$CI_REPO_NAME" -out /home/circleci/.gcp_credentials
      echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV
      ./.circleci/setup-rbe.sh .bazelrc.user

# Settings common to each job
var_6: &job_defaults
  working_directory: ~/ng
  docker:
  - image: *default_docker_image
var_6_win: &job_defaults_win
  working_directory: ~/ng
  resource_class: windows.medium
  # CircleCI windows VMs do have the GitBash shell available:
  # https://github.com/CircleCI-Public/windows-preview-docs#shells
  # But in this specific case we really should not use it because Bazel must not be ran from
  # GitBash. These issues discuss why:
  # https://github.com/bazelbuild/bazel/issues/5751
  # https://github.com/bazelbuild/bazel/issues/5724#issuecomment-410194038
  # https://github.com/bazelbuild/bazel/issues/6339#issuecomment-441600879
  shell: powershell.exe -ExecutionPolicy Bypass
  machine:
    # Preview image that includes the following:
    # - Visual Studio 2019 build tools
    # - Node 12
    # - yarn 1.17
    # - Python 3 3.7.4
    image: windows-server-2019-vs2019:201908-02

# After checkout, rebase on top of target branch.
var_7: &post_checkout
  run:
    name: Rebase PR on target branch
    command: >
      if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
        # User is required for rebase.
        git config user.name "angular-ci"
        git config user.email "<PASSWORD>"
        # Rebase PR on top of target branch.
        node tools/rebase-pr.js angular/angular ${CIRCLE_PR_NUMBER}
      else
        echo "This build is not over a PR, nothing to do."
      fi
var_7_win: &post_checkout_win
  run:
    name: Rebase PR on target branch
    command: >
      if (Test-Path env:CIRCLE_PR_NUMBER) {
        git config user.name "angular-ci"
        git config user.email "<PASSWORD>"
        node tools\rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER
      } else {
        echo "This build is not over a PR, nothing to do."
      }

var_8: &yarn_install
  run:
    name: Running Yarn install
    command: |
      # Yarn's requests sometimes take more than 10mins to complete.
      # Print something to stdout, to prevent CircleCI from failing due to not output.
      while true; do sleep 60; echo "[`date`] Keeping alive..."; done &
      KEEP_ALIVE_PID=$!
      yarn install --frozen-lockfile --non-interactive
      kill $KEEP_ALIVE_PID

var_9: &setup_circleci_bazel_config
  run:
    name: Setting up CircleCI bazel configuration
    command: sudo cp .circleci/bazel.linux.rc /etc/bazel.bazelrc

var_9_win: &setup_circleci_bazel_config_win
  run:
    name: Setting up CircleCI bazel configuration
    command: copy .circleci\bazel.windows.rc $env:ProgramData\bazel.bazelrc

var_10: &restore_cache
  restore_cache:
    keys:
      - *cache_key
      # This fallback should be the cache_key without variables.
      - v3-angular-node-10.16-
var_10_win: &restore_cache_win
  restore_cache:
    keys:<commit_msg>ci: copy bazelrc files to home RC locations (#32251)<commit_after># Configuration file for https://circleci.com/gh/angular/angular

# Note: YAML anchors allow an object to be re-used, reducing duplication.
# The ampersand declares an alias for an object, then later the `<<: *name`
# syntax dereferences it.
# See http://blog.daemonl.com/2016/02/yaml.html
# To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/

# Note that the browser docker image comes with Chrome and Firefox preinstalled. This is just
# needed for jobs that run tests without Bazel. Bazel runs tests with browsers that will be
# fetched by the Webtesting rules. Therefore for jobs that run tests with Bazel, we don't need a
# docker image with browsers pre-installed.
# **NOTE 1**: If you change the version of the `*-browsers` docker image, make sure the
#             `CI_CHROMEDRIVER_VERSION_ARG` env var (in `.circleci/env.sh`) points to a ChromeDriver
#             version that is compatible with the Chrome version in the image.
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
var_1: &default_docker_image circleci/node:10.16
var_2: &browsers_docker_image circleci/node:10.16-browsers
# We don't want to include the current branch name in the cache key because that would prevent
# PRs from being able to restore the cache since the branch names are always different for PRs.
# The cache key should only consist of dynamic values that change whenever something in the
# cache changes. For example:
# 1) yarn lock file changes --> cached "node_modules" are different.
# 2) bazel repository definitions change --> cached bazel repositories are different.
# **NOTE 1 **: If you change the cache key prefix, also sync the restore_cache fallback to match.
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v3-angular-node-10.16-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_3_win: &cache_key_win v4-angular-win-node-12.0-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}

# Initializes the CI environment by setting up common environment variables.
var_4: &init_environment
  run:
    name: Initializing environment (setting up variables, overwriting Yarn)
    # Overwrite the yarn installed in the docker container with our own version.
    command: |
      ./.circleci/env.sh
      ourYarn=$(realpath ./third_party/github.com/yarnpkg/yarn/releases/download/v1.13.0/bin/yarn.js)
      sudo chmod a+x $ourYarn
      sudo ln -fs $ourYarn /usr/local/bin/yarn
      echo "Yarn version: $(yarn --version)"

      # Add GitHub to known hosts.
      mkdir -p ~/.ssh
      echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts

      # use git+ssh instead of https
      git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
      git config --global gc.auto 0 || true

var_4_win: &init_environment_win
  run:
    # Install Bazel pre-requisites that aren't in the preconfigured CircleCI Windows VM.
    name: Setup windows node environment
    command: ./.circleci/windows-env.ps1


var_5: &setup_bazel_remote_execution
  run:
    name: "Setup bazel RBE remote execution"
    command: |
      # We need ensure that the same default digest is used for encoding and decoding
      # with openssl. Openssl versions might have different default digests which can
      # cause decryption failures based on the openssl version. https://stackoverflow.com/a/39641378/4317734
      openssl aes-256-cbc -d -in .circleci/gcp_token -md md5 -k "$CI_REPO_NAME" -out /home/circleci/.gcp_credentials
      echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV
      ./.circleci/setup-rbe.sh .bazelrc.user

# Settings common to each job
var_6: &job_defaults
  working_directory: ~/ng
  docker:
  - image: *default_docker_image
var_6_win: &job_defaults_win
  working_directory: ~/ng
  resource_class: windows.medium
  # CircleCI windows VMs do have the GitBash shell available:
  # https://github.com/CircleCI-Public/windows-preview-docs#shells
  # But in this specific case we really should not use it because Bazel must not be ran from
  # GitBash. These issues discuss why:
  # https://github.com/bazelbuild/bazel/issues/5751
  # https://github.com/bazelbuild/bazel/issues/5724#issuecomment-410194038
  # https://github.com/bazelbuild/bazel/issues/6339#issuecomment-441600879
  shell: powershell.exe -ExecutionPolicy Bypass
  machine:
    # Preview image that includes the following:
    # - Visual Studio 2019 build tools
    # - Node 12
    # - yarn 1.17
    # - Python 3 3.7.4
    image: windows-server-2019-vs2019:201908-02

# After checkout, rebase on top of target branch.
var_7: &post_checkout
  run:
    name: Rebase PR on target branch
    command: >
      if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
        # User is required for rebase.
        git config user.name "angular-ci"
        git config user.email "angular-ci"
        # Rebase PR on top of target branch.
        node tools/rebase-pr.js angular/angular ${CIRCLE_PR_NUMBER}
      else
        echo "This build is not over a PR, nothing to do."
      fi
var_7_win: &post_checkout_win
  run:
    name: Rebase PR on target branch
    command: >
      if (Test-Path env:CIRCLE_PR_NUMBER) {
        git config user.name "angular-ci"
        git config user.email "angular-ci"
        node tools\rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER
      } else {
        echo "This build is not over a PR, nothing to do."
      }

var_8: &yarn_install
  run:
    name: Running Yarn install
    command: |
      # Yarn's requests sometimes take more than 10mins to complete.
      # Print something to stdout, to prevent CircleCI from failing due to not output.
      while true; do sleep 60; echo "[`date`] Keeping alive..."; done &
      KEEP_ALIVE_PID=$!
      yarn install --frozen-lockfile --non-interactive
      kill $KEEP_ALIVE_PID

var_9: &setup_circleci_bazel_config
  run:
    name: Setting up CircleCI bazel configuration
    command: sudo cp .circleci/bazel.linux.rc $HOME/.bazelrc

var_9_win: &setup_circleci_bazel_config_win
  run:
    name: Setting up CircleCI bazel configuration
    command: copy .circleci\bazel.windows.rc $env:USERPROFILE\.bazelrc

var_10: &restore_cache
  restore_cache:
    keys:
      - *cache_key
      # This fallback should be the cache_key without variables.
      - v3-angular-node-10.16-
var_10_win: &restore_cache_win
  restore_cache:
    keys:
{'fraction_non_alphanumeric': 0.09152067274001402, 'fraction_numerical': 0.027400140154169587, 'mean_word_length': 3.591698841698842, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2806605', 'n_tokens_mistral': 5120, 'n_tokens_neox': 4733, 'n_words': 1439}