@@ -27,6 +27,7 @@ var_2: &browsers_docker_image circleci/node:10.16-browsers
27
27
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
28
28
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
29
29
var_3 : &cache_key v3-angular-node-10.16-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
30
+ 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" }}
30
31
31
32
# Initializes the CI environment by setting up common environment variables.
32
33
var_4 : &init_environment
@@ -48,6 +49,12 @@ var_4: &init_environment
48
49
git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
49
50
git config --global gc.auto 0 || true
50
51
52
+ var_4_win : &init_environment_win
53
+ run :
54
+ # Install Bazel pre-requisites that aren't in the preconfigured CircleCI Windows VM.
55
+ name : Setup windows node environment
56
+ command : ./.circleci/windows-env.ps1
57
+
51
58
52
59
var_5 : &setup_bazel_remote_execution
53
60
run :
@@ -65,6 +72,24 @@ var_6: &job_defaults
65
72
working_directory : ~/ng
66
73
docker :
67
74
- image : *default_docker_image
75
+ var_6_win : &job_defaults_win
76
+ working_directory : ~/ng
77
+ resource_class : windows.medium
78
+ # CircleCI windows VMs do have the GitBash shell available:
79
+ # https://github.com/CircleCI-Public/windows-preview-docs#shells
80
+ # But in this specific case we really should not use it because Bazel must not be ran from
81
+ # GitBash. These issues discuss why:
82
+ # https://github.com/bazelbuild/bazel/issues/5751
83
+ # https://github.com/bazelbuild/bazel/issues/5724#issuecomment-410194038
84
+ # https://github.com/bazelbuild/bazel/issues/6339#issuecomment-441600879
85
+ shell : powershell.exe -ExecutionPolicy Bypass
86
+ machine :
87
+ # Preview image that includes the following:
88
+ # - Visual Studio 2019 build tools
89
+ # - Node 12
90
+ # - yarn 1.17
91
+ # - Python 3 3.7.4
92
+ image : windows-server-2019-vs2019:201908-02
68
93
69
94
# After checkout, rebase on top of target branch.
70
95
var_7 : &post_checkout
@@ -80,6 +105,17 @@ var_7: &post_checkout
80
105
else
81
106
echo "This build is not over a PR, nothing to do."
82
107
fi
108
+ var_7_win : &post_checkout_win
109
+ run :
110
+ name : Rebase PR on target branch
111
+ command : >
112
+ if (Test-Path env:CIRCLE_PR_NUMBER) {
113
+ git config user.name "angular-ci"
114
+ git config user.email "angular-ci"
115
+ node tools\rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER
116
+ } else {
117
+ echo "This build is not over a PR, nothing to do."
118
+ }
83
119
84
120
var_8 : &yarn_install
85
121
run :
@@ -95,14 +131,25 @@ var_8: &yarn_install
95
131
var_9 : &setup_circleci_bazel_config
96
132
run :
97
133
name : Setting up CircleCI bazel configuration
98
- command : sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
134
+ command : sudo cp .circleci/bazel.linux.rc /etc/bazel.bazelrc
135
+
136
+ var_9_win : &setup_circleci_bazel_config_win
137
+ run :
138
+ name : Setting up CircleCI bazel configuration
139
+ command : copy .circleci\bazel.windows.rc $env:ProgramData\bazel.bazelrc
99
140
100
141
var_10 : &restore_cache
101
142
restore_cache :
102
143
keys :
103
144
- *cache_key
104
145
# This fallback should be the cache_key without variables.
105
146
- v3-angular-node-10.16-
147
+ var_10_win : &restore_cache_win
148
+ restore_cache :
149
+ keys :
150
+ - *cache_key_win
151
+ # This fallback should be the cache_key without variables.
152
+ - v4-angular-win-node-12.0-
106
153
107
154
# Branch filter that can be specified for jobs that should only run on publish branches
108
155
# (e.g. master or the patch branch)
@@ -670,6 +717,55 @@ jobs:
670
717
cp dist/bin/packages/zone.js/npm_package/dist/zone-patch-electron.js ./packages/zone.js/test/extra/ &&
671
718
yarn --cwd packages/zone.js electrontest
672
719
720
+ # Windows jobs
721
+ # Docs: https://circleci.com/docs/2.0/hello-world-windows/
722
+ # Skipping workspace for now because it fails to extract on windows.
723
+ # TODO: when CircleCI fixes it, split this single job into install/test ones.
724
+ # Notes:
725
+ # - windows needs its own cache key because binaries in node_modules are different.
726
+ # - windows might need its own workspace for the same reason.
727
+ test_win :
728
+ << : *job_defaults_win
729
+ steps :
730
+ - checkout
731
+ - *init_environment_win
732
+ - *post_checkout_win
733
+ # TODO: windows cache restoration is currently failing. Re-enable when it's fixed.
734
+ # Example failure: https://circleci.com/gh/angular/angular/423738
735
+ # - *restore_cache_win
736
+ - *setup_circleci_bazel_config_win
737
+ - run : yarn install --frozen-lockfile --non-interactive
738
+ # Install @bazel/bazel globally and use that for the first run.
739
+ # Workaround for https://github.com/bazelbuild/rules_nodejs/issues/894
740
+ - run : yarn global add @bazel/bazel@$env:BAZEL_VERSION
741
+ - run : bazel info
742
+ # Ran into a command parsing problem where `-browser:chromium-local` was converted to
743
+ # `-browser: chromium-local` (a space was added) in https://circleci.com/gh/angular/angular/357511.
744
+ # Probably a powershell command parsing thing. This way there's no problem.
745
+ - run :
746
+ command : yarn circleci-win-ve
747
+ no_output_timeout : 45m
748
+ # - save_cache:
749
+ # key: *cache_key_win
750
+ # paths:
751
+ # - "node_modules"
752
+ # - "C:/Users/circleci/bazel_repository_cache"
753
+ test_ivy_aot_win :
754
+ << : *job_defaults_win
755
+ steps :
756
+ - checkout
757
+ - *init_environment_win
758
+ - *post_checkout_win
759
+ # - *restore_cache_win
760
+ - *setup_circleci_bazel_config_win
761
+ - run : yarn install --frozen-lockfile --non-interactive
762
+ - run : yarn global add @bazel/bazel@$env:BAZEL_VERSION
763
+ - run : bazel info
764
+ - run :
765
+ command : yarn circleci-win-ivy
766
+ no_output_timeout : 45m
767
+
768
+
673
769
workflows :
674
770
version : 2
675
771
default_workflow :
@@ -767,6 +863,25 @@ workflows:
767
863
- test_zonejs :
768
864
requires :
769
865
- setup
866
+ # Windows jobs very slow so we run it on non-PRs only for now.
867
+ # TODO: remove the filter when CircleCI makes Windows FS faster.
868
+ # The Windows jobs are only run after their non-windows counterparts finish successfully.
869
+ # This isn't strictly necessary as there is no artifact dependency, but helps economize
870
+ # CI resources by not attempting to build when we know should fail.
871
+ - test_win :
872
+ requires :
873
+ - test
874
+ filters :
875
+ branches :
876
+ ignore :
877
+ - /pull\/.*/
878
+ - test_ivy_aot_win :
879
+ requires :
880
+ - test_ivy_aot
881
+ filters :
882
+ branches :
883
+ ignore :
884
+ - /pull\/.*/
770
885
771
886
aio_monitoring :
772
887
jobs :
0 commit comments