diff --git a/.circleci/config.yml b/.circleci/config.yml index 01b7b5f4acac..9454be12fd03 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,237 +1,16 @@ -# Configuration file for https://circleci.com/gh/angular/components +# This config is remaining in place to prevent pull requests failing because of CircleCI config missing. -# 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/ - -var_1: &docker_image cimg/node:18.17.0 -var_2: &docker-browser-image cimg/node:18.17.0-browsers - -# **Note**: When updating the beginning of the cache key, also update the cache key to match -# the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching. -# Read more here: https://circleci.com/docs/2.0/caching/#restoring-cache. -var_3: &cache_key v16-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }} -# We want to invalidate the cache if the postinstall patches change. In order to apply new -# patches, a clean version of the node modules is needed. Additionally, we invalidate the cache -# if the Bazel version changes. We do this because otherwise the `bazelisk` cache folder will -# contain all previously used versions and ultimately cause the cache restoring to be slower. -var_4: &cache_fallback_key v16-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}- - -# Settings common to each job -var_5: &job_defaults - working_directory: ~/ng - docker: - - image: *docker_image - -# Restores the cache that could be available for the current Yarn lock file. The cache usually -# includes the node modules and the Bazel repository cache. -var_7: &restore_cache - restore_cache: - keys: - - *cache_key - - *cache_fallback_key - -# Saves the cache for the current Yarn lock file. We store the node modules and the Bazel -# repository cache in order to make subsequent builds faster. -var_8: &save_cache - save_cache: - key: *cache_key - paths: - - 'node_modules' - - '~/.cache/bazelisk' - - '~/bazel_repository_cache' - -# Decryption token that is used to decode the GCP credentials file in ".circleci/gcp_token". -var_9: &gcp_decrypt_token 'angular' - -# Job step that ensures that the node module dependencies are installed and up-to-date. We use -# Yarn with the frozen lockfile option in order to make sure that lock file and package.json are -# in sync. Unlike in Travis, we don't need to manually purge the node modules if stale because -# CircleCI automatically discards the cache if the checksum of the lock file has changed. -var_10: &yarn_install - run: - name: 'Installing project dependencies' - command: yarn install --frozen-lockfile --non-interactive - -# Installs all dependencies but does not enforce a frozen lockfile. Helpful when -# the "package.json" is updated as part of a CI job. e.g. when setting up snapshots. -var_11: &yarn_install_loose_lockfile - run: - name: 'Installing project dependencies' - command: yarn install --non-interactive - -# Sets up the Bazel config which is specific for CircleCI builds. -var_12: &setup_bazel_ci_config - run: - name: 'Setting up Bazel configuration for CI' - # Note: We add the remote config flag to the user bazelrc file that is not tracked - # by Git. This is necessary to avoid stamping builds with `.with-local-changes`. - command: echo "import %workspace%/.circleci/bazel.rc" >> ./.bazelrc.user - -# Attaches the release output which has been stored in the workspace to the current job. -# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs -var_13: &attach_release_output - attach_workspace: - at: dist/ - -# Branch filter that we can specify for jobs that should only run on publish branches. This filter -# is used to ensure that not all upstream branches will be published as Github builds -# (e.g. revert branches, feature branches) -var_14: &publish_branches_filter - branches: - only: - - main - # 6.0.x, 7.1.x, etc. - - /\d+\.\d+\.x/ - -# Branch filter that is usually applied to all jobs. Since there is no way within CircleCI to -# exclude a branch for all defined jobs, we need to manually specify the filters for each job. -# In order to reduce duplication we use a YAML anchor that just always excludes the "_presubmit" -# branch. We don't want to run Circle for the temporary "_presubmit" branch which is reserved -# for the caretaker. -var_15: &ignore_presubmit_branch_filter - branches: - ignore: - - '_presubmit' - -# Runs a script that sets up the Bazel remote execution. This will be used by jobs that run -# Bazel primarily and should benefit from remote caching and execution. -var_16: &setup_bazel_remote_execution - devinfra/setup-bazel-remote-exec: - bazelrc: ./.bazelrc.user - -# Sets up the bazel binary globally. We don't want to access bazel through Yarn and NodeJS -# because it could mean that the Bazel child process only has access to limited memory. -var_17: &setup_bazel_binary - run: - name: 'Setting up global Bazel binary' - command: ./scripts/circleci/setup_bazel_binary.sh - -# Sets up the Angular snapshot builds. -var_18: &setup_snapshot_builds - run: - name: 'Setting up Angular snapshot builds' - command: node ./scripts/circleci/setup-angular-snapshots.js main - -# Filter which ensures that jobs only run for pull requests. -var_19: &only_on_pull_requests_filter - branches: - only: - - /pull\/\d+/ - -# Anchor for a step that notifies Slack when preceding steps failed. -var_20: &slack_notify_on_failure - run: - name: 'Notifying team about job failure' - when: on_fail - command: yarn ci-notify-slack-failure - -# Branch filter that only matches the main branch. -var_21: &only_main_branch_filter - branches: - only: - - main - -# ----------------------------- -# Container version of CircleCI -# ----------------------------- version: 2.1 -# Configures CircleCI orbs for this pipeline. Orbs allow consumption of publicly shared -# CircleCI commands, jobs, configuration elements or executors. Read more about orbs here: -# https://circleci.com/docs/2.0/orb-intro/ -orbs: - # Set up the `queue` orb that allows us to queue up builds across jobs. We use it - # to make sure that snapshot builds are not deployed out of order, resulting in Git - # push conflicts. - queue: eddiewebb/queue@1.5.0 - devinfra: angular/dev-infra@1.0.8 - -commands: - checkout_and_rebase: - description: Checkout and rebase the repository - steps: - - checkout - # After checkout, rebase on top of target branch. - - devinfra/rebase-pr-on-target-branch: - base_revision: << pipeline.git.base_revision >> - head_revision: << pipeline.git.revision >> - -# ----------------------------------------------------------------------------------------- -# Job definitions. Jobs which are defined just here, will not run automatically. Each job -# must be part of a workflow definition in order to run for PRs and push builds. -# ----------------------------------------------------------------------------------------- jobs: - # ------------------------------------------------------------------------------------------- - # Job that builds all release packages. The built packages can be then used in the same - # workflow to publish snapshot builds. - # ------------------------------------------------------------------------------------------- - build_release_packages: - <<: *job_defaults - resource_class: xlarge - environment: - GCP_DECRYPT_TOKEN: *gcp_decrypt_token - steps: - - checkout_and_rebase - - *restore_cache - - *setup_bazel_ci_config - - *setup_bazel_remote_execution - - *yarn_install - - *setup_bazel_binary - - - run: yarn build-and-check-release-output - - run: yarn check-tooling-setup - - # TODO(devversion): replace this with bazel tests that run Madge. This is - # cumbersome and doesn't guarantee no circular deps for other entry-points. - - run: yarn madge --circular dist/releases/cdk/schematics/index.js - - # Store the release output in the workspace storage. This means that other jobs - # in the same workflow can attach the release output to their job. - - persist_to_workspace: - root: dist - paths: - - 'releases/**/*' - - *slack_notify_on_failure - - # ---------------------------------------- - # Job that publishes the docs site - # ---------------------------------------- - deploy_docs_site: + pass: docker: - - image: *docker-browser-image - resource_class: xlarge - environment: - GCP_DECRYPT_TOKEN: *gcp_decrypt_token + - image: cimg/base:2022.05 steps: - - checkout_and_rebase - - *restore_cache - - *setup_bazel_ci_config - - *setup_bazel_remote_execution - - *yarn_install - - *setup_bazel_binary - - - run: yarn ci-push-deploy-docs-app - - *slack_notify_on_failure + - run: echo "This too shall pass (always)" -# ---------------------------------------------------------------------------------------- -# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if -# one job depends on another. -# -# NOTE: When updating this configuration section, make sure to update GitHub robot -# config to match the new workflow jobs. -# ---------------------------------------------------------------------------------------- workflows: version: 2 - default_workflow: jobs: - - build_release_packages: - filters: *ignore_presubmit_branch_filter - - deploy_docs_site: - filters: *publish_branches_filter - requires: - - build_release_packages + - pass diff --git a/.github/angular-robot.yml b/.github/angular-robot.yml index 0e6be3bbc272..1987139fe751 100644 --- a/.github/angular-robot.yml +++ b/.github/angular-robot.yml @@ -52,10 +52,6 @@ merge: - 'pr: needs*' - 'presubmit failures' - # list of PR statuses that need to be successful - requiredStatuses: - - 'ci/circleci: build_release_packages' - # the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable # {{MERGE_LABEL}} will be replaced by the value of the mergeLabel option # {{PLACEHOLDER}} will be replaced by the list of failing checks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2db2466c572..370cdeb819d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -296,3 +296,32 @@ jobs: with: name: Package Artifacts path: dist/release-archives + + deploy_doc_site: + if: ${{ github.event_name == 'push'}} + runs-on: ubuntu-latest-4core + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@9931e1a8d1b62fcd2267e89f9993a494856cc1cd + with: + cache-node-modules: true + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@9931e1a8d1b62fcd2267e89f9993a494856cc1cd + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@9931e1a8d1b62fcd2267e89f9993a494856cc1cd + - name: Install node modules + run: yarn install --frozen-lockfile + - name: Build and Verify Release Output + run: yarn build-and-check-release-output + - name: Verify tooling setup + run: yarn check-tooling-setup + - name: Deploy the docs app + run: yarn ci-push-deploy-docs-app + - name: Notify about failed publish + if: ${{ failure() }} + uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v=v1.24.0 + with: + channel-id: 'C015EBF2XB6' + slack-message: 'Deploying doc site failed for ${{ github.base_ref }} branch failed on build ${{ github.event.after }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }}