|
1 | | -# Configuration file for https://circleci.com/gh/angular/components |
| 1 | +# This config is remaining in place to prevent pull requests failing because of CircleCI config missing. |
2 | 2 |
|
3 | | -# Note: YAML anchors allow an object to be re-used, reducing duplication. |
4 | | -# The ampersand declares an alias for an object, then later the `<<: *name` |
5 | | -# syntax dereferences it. |
6 | | -# See http://blog.daemonl.com/2016/02/yaml.html |
7 | | -# To validate changes, use an online parser, eg. |
8 | | -# http://yaml-online-parser.appspot.com/ |
9 | | - |
10 | | -var_1: &docker_image cimg/node:18.17.0 |
11 | | -var_2: &docker-browser-image cimg/node:18.17.0-browsers |
12 | | - |
13 | | -# **Note**: When updating the beginning of the cache key, also update the cache key to match |
14 | | -# the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching. |
15 | | -# Read more here: https://circleci.com/docs/2.0/caching/#restoring-cache. |
16 | | -var_3: &cache_key v16-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }} |
17 | | -# We want to invalidate the cache if the postinstall patches change. In order to apply new |
18 | | -# patches, a clean version of the node modules is needed. Additionally, we invalidate the cache |
19 | | -# if the Bazel version changes. We do this because otherwise the `bazelisk` cache folder will |
20 | | -# contain all previously used versions and ultimately cause the cache restoring to be slower. |
21 | | -var_4: &cache_fallback_key v16-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}- |
22 | | - |
23 | | -# Settings common to each job |
24 | | -var_5: &job_defaults |
25 | | - working_directory: ~/ng |
26 | | - docker: |
27 | | - - image: *docker_image |
28 | | - |
29 | | -# Restores the cache that could be available for the current Yarn lock file. The cache usually |
30 | | -# includes the node modules and the Bazel repository cache. |
31 | | -var_7: &restore_cache |
32 | | - restore_cache: |
33 | | - keys: |
34 | | - - *cache_key |
35 | | - - *cache_fallback_key |
36 | | - |
37 | | -# Saves the cache for the current Yarn lock file. We store the node modules and the Bazel |
38 | | -# repository cache in order to make subsequent builds faster. |
39 | | -var_8: &save_cache |
40 | | - save_cache: |
41 | | - key: *cache_key |
42 | | - paths: |
43 | | - - 'node_modules' |
44 | | - - '~/.cache/bazelisk' |
45 | | - - '~/bazel_repository_cache' |
46 | | - |
47 | | -# Decryption token that is used to decode the GCP credentials file in ".circleci/gcp_token". |
48 | | -var_9: &gcp_decrypt_token 'angular' |
49 | | - |
50 | | -# Job step that ensures that the node module dependencies are installed and up-to-date. We use |
51 | | -# Yarn with the frozen lockfile option in order to make sure that lock file and package.json are |
52 | | -# in sync. Unlike in Travis, we don't need to manually purge the node modules if stale because |
53 | | -# CircleCI automatically discards the cache if the checksum of the lock file has changed. |
54 | | -var_10: &yarn_install |
55 | | - run: |
56 | | - name: 'Installing project dependencies' |
57 | | - command: yarn install --frozen-lockfile --non-interactive |
58 | | - |
59 | | -# Installs all dependencies but does not enforce a frozen lockfile. Helpful when |
60 | | -# the "package.json" is updated as part of a CI job. e.g. when setting up snapshots. |
61 | | -var_11: &yarn_install_loose_lockfile |
62 | | - run: |
63 | | - name: 'Installing project dependencies' |
64 | | - command: yarn install --non-interactive |
65 | | - |
66 | | -# Sets up the Bazel config which is specific for CircleCI builds. |
67 | | -var_12: &setup_bazel_ci_config |
68 | | - run: |
69 | | - name: 'Setting up Bazel configuration for CI' |
70 | | - # Note: We add the remote config flag to the user bazelrc file that is not tracked |
71 | | - # by Git. This is necessary to avoid stamping builds with `.with-local-changes`. |
72 | | - command: echo "import %workspace%/.circleci/bazel.rc" >> ./.bazelrc.user |
73 | | - |
74 | | -# Attaches the release output which has been stored in the workspace to the current job. |
75 | | -# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs |
76 | | -var_13: &attach_release_output |
77 | | - attach_workspace: |
78 | | - at: dist/ |
79 | | - |
80 | | -# Branch filter that we can specify for jobs that should only run on publish branches. This filter |
81 | | -# is used to ensure that not all upstream branches will be published as Github builds |
82 | | -# (e.g. revert branches, feature branches) |
83 | | -var_14: &publish_branches_filter |
84 | | - branches: |
85 | | - only: |
86 | | - - main |
87 | | - # 6.0.x, 7.1.x, etc. |
88 | | - - /\d+\.\d+\.x/ |
89 | | - |
90 | | -# Branch filter that is usually applied to all jobs. Since there is no way within CircleCI to |
91 | | -# exclude a branch for all defined jobs, we need to manually specify the filters for each job. |
92 | | -# In order to reduce duplication we use a YAML anchor that just always excludes the "_presubmit" |
93 | | -# branch. We don't want to run Circle for the temporary "_presubmit" branch which is reserved |
94 | | -# for the caretaker. |
95 | | -var_15: &ignore_presubmit_branch_filter |
96 | | - branches: |
97 | | - ignore: |
98 | | - - '_presubmit' |
99 | | - |
100 | | -# Runs a script that sets up the Bazel remote execution. This will be used by jobs that run |
101 | | -# Bazel primarily and should benefit from remote caching and execution. |
102 | | -var_16: &setup_bazel_remote_execution |
103 | | - devinfra/setup-bazel-remote-exec: |
104 | | - bazelrc: ./.bazelrc.user |
105 | | - |
106 | | -# Sets up the bazel binary globally. We don't want to access bazel through Yarn and NodeJS |
107 | | -# because it could mean that the Bazel child process only has access to limited memory. |
108 | | -var_17: &setup_bazel_binary |
109 | | - run: |
110 | | - name: 'Setting up global Bazel binary' |
111 | | - command: ./scripts/circleci/setup_bazel_binary.sh |
112 | | - |
113 | | -# Sets up the Angular snapshot builds. |
114 | | -var_18: &setup_snapshot_builds |
115 | | - run: |
116 | | - name: 'Setting up Angular snapshot builds' |
117 | | - command: node ./scripts/circleci/setup-angular-snapshots.js main |
118 | | - |
119 | | -# Filter which ensures that jobs only run for pull requests. |
120 | | -var_19: &only_on_pull_requests_filter |
121 | | - branches: |
122 | | - only: |
123 | | - - /pull\/\d+/ |
124 | | - |
125 | | -# Anchor for a step that notifies Slack when preceding steps failed. |
126 | | -var_20: &slack_notify_on_failure |
127 | | - run: |
128 | | - name: 'Notifying team about job failure' |
129 | | - when: on_fail |
130 | | - command: yarn ci-notify-slack-failure |
131 | | - |
132 | | -# Branch filter that only matches the main branch. |
133 | | -var_21: &only_main_branch_filter |
134 | | - branches: |
135 | | - only: |
136 | | - - main |
137 | | - |
138 | | -# ----------------------------- |
139 | | -# Container version of CircleCI |
140 | | -# ----------------------------- |
141 | 3 | version: 2.1 |
142 | 4 |
|
143 | | -# Configures CircleCI orbs for this pipeline. Orbs allow consumption of publicly shared |
144 | | -# CircleCI commands, jobs, configuration elements or executors. Read more about orbs here: |
145 | | -# https://circleci.com/docs/2.0/orb-intro/ |
146 | | -orbs: |
147 | | - # Set up the `queue` orb that allows us to queue up builds across jobs. We use it |
148 | | - # to make sure that snapshot builds are not deployed out of order, resulting in Git |
149 | | - # push conflicts. |
150 | | - queue: eddiewebb/queue@1.5.0 |
151 | | - devinfra: angular/dev-infra@1.0.8 |
152 | | - |
153 | | -commands: |
154 | | - checkout_and_rebase: |
155 | | - description: Checkout and rebase the repository |
156 | | - steps: |
157 | | - - checkout |
158 | | - # After checkout, rebase on top of target branch. |
159 | | - - devinfra/rebase-pr-on-target-branch: |
160 | | - base_revision: << pipeline.git.base_revision >> |
161 | | - head_revision: << pipeline.git.revision >> |
162 | | - |
163 | | -# ----------------------------------------------------------------------------------------- |
164 | | -# Job definitions. Jobs which are defined just here, will not run automatically. Each job |
165 | | -# must be part of a workflow definition in order to run for PRs and push builds. |
166 | | -# ----------------------------------------------------------------------------------------- |
167 | 5 | jobs: |
168 | | - # ------------------------------------------------------------------------------------------- |
169 | | - # Job that builds all release packages. The built packages can be then used in the same |
170 | | - # workflow to publish snapshot builds. |
171 | | - # ------------------------------------------------------------------------------------------- |
172 | | - build_release_packages: |
173 | | - <<: *job_defaults |
174 | | - resource_class: xlarge |
175 | | - environment: |
176 | | - GCP_DECRYPT_TOKEN: *gcp_decrypt_token |
177 | | - steps: |
178 | | - - checkout_and_rebase |
179 | | - - *restore_cache |
180 | | - - *setup_bazel_ci_config |
181 | | - - *setup_bazel_remote_execution |
182 | | - - *yarn_install |
183 | | - - *setup_bazel_binary |
184 | | - |
185 | | - - run: yarn build-and-check-release-output |
186 | | - - run: yarn check-tooling-setup |
187 | | - |
188 | | - # TODO(devversion): replace this with bazel tests that run Madge. This is |
189 | | - # cumbersome and doesn't guarantee no circular deps for other entry-points. |
190 | | - - run: yarn madge --circular dist/releases/cdk/schematics/index.js |
191 | | - |
192 | | - # Store the release output in the workspace storage. This means that other jobs |
193 | | - # in the same workflow can attach the release output to their job. |
194 | | - - persist_to_workspace: |
195 | | - root: dist |
196 | | - paths: |
197 | | - - 'releases/**/*' |
198 | | - - *slack_notify_on_failure |
199 | | - |
200 | | - # ---------------------------------------- |
201 | | - # Job that publishes the docs site |
202 | | - # ---------------------------------------- |
203 | | - deploy_docs_site: |
| 6 | + pass: |
204 | 7 | docker: |
205 | | - - image: *docker-browser-image |
206 | | - resource_class: xlarge |
207 | | - environment: |
208 | | - GCP_DECRYPT_TOKEN: *gcp_decrypt_token |
| 8 | + - image: cimg/base:2022.05 |
209 | 9 | steps: |
210 | | - - checkout_and_rebase |
211 | | - - *restore_cache |
212 | | - - *setup_bazel_ci_config |
213 | | - - *setup_bazel_remote_execution |
214 | | - - *yarn_install |
215 | | - - *setup_bazel_binary |
216 | | - |
217 | | - - run: yarn ci-push-deploy-docs-app |
218 | | - - *slack_notify_on_failure |
| 10 | + - run: echo "This too shall pass (always)" |
219 | 11 |
|
220 | | -# ---------------------------------------------------------------------------------------- |
221 | | -# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if |
222 | | -# one job depends on another. |
223 | | -# |
224 | | -# NOTE: When updating this configuration section, make sure to update GitHub robot |
225 | | -# config to match the new workflow jobs. |
226 | | -# ---------------------------------------------------------------------------------------- |
227 | 12 | workflows: |
228 | 13 | version: 2 |
229 | | - |
230 | 14 | default_workflow: |
231 | 15 | jobs: |
232 | | - - build_release_packages: |
233 | | - filters: *ignore_presubmit_branch_filter |
234 | | - - deploy_docs_site: |
235 | | - filters: *publish_branches_filter |
236 | | - requires: |
237 | | - - build_release_packages |
| 16 | + - pass |
0 commit comments