forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: migrate deploying doc site job to GHA
Migrate the deployment doc site job from CircleCI to Github Actions
- Loading branch information
1 parent
07c9ad5
commit da53528
Showing
5 changed files
with
93 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: 'Notify slack on failure' | ||
description: 'Notifying Slack of failure' | ||
|
||
inputs: | ||
JOB_NAME: | ||
description: 'Name of the job' | ||
required: true | ||
ANGULAR_ROBOT_SLACK_TOKEN: | ||
description: 'Name of the job' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Notify about failed test | ||
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v=v1.24.0 | ||
with: | ||
channel-id: 'C015EBF2XB6' | ||
slack-message: '${{ inputs.JOB_NAME }} job 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: ${{ inputs.ANGULAR_ROBOT_SLACK_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.