/
config.yml
257 lines (241 loc) · 7.02 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
version: 2.1
# -------------------------
# ORBS
# -------------------------
orbs:
nx: nrwl/nx@1.1.3
# -------------------------
# DEFAULTS
# -------------------------
machine:
pre:
- mkdir ~/.cache/yarn
- mkdir ~/Library/Caches/Homebrew
- mkdir /usr/local/Homebrew
dependencies:
cache_directories:
- ~/.cache/yarn
- /usr/local/Homebrew
- ~/Library/Caches/Homebrew
override:
- yarn install
- brew install
defaults: &defaults
working_directory: ~/repo
# -------------------------
# EXECUTORS
# -------------------------
executors:
linux:
<<: *defaults
docker:
- image: cimg/node:16.13-browsers
macos:
<<: *defaults
macos:
xcode: &_XCODE_VERSION '13.0.0'
# -------------------------
# COMMANDS
# -------------------------
commands:
run-yarn-install:
parameters:
os:
type: string
steps:
- restore_cache:
name: Restore Yarn Package Cache
keys:
- nrwl-nx-yarn-packages-<< parameters.os >>-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: yarn install --prefer-offline --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
- save_cache:
name: Save Yarn Package Cache
key: nrwl-nx-yarn-packages-<< parameters.os >>-{{ checksum "yarn.lock" }}
paths:
- node_modules
- ~/.cache/yarn
install-pnpm:
steps:
- run:
name: Install PNPM
command: npm install --prefix=$HOME/.local -g pnpm@6.9.1
setup:
parameters:
os:
type: string
steps:
- checkout
- when:
condition:
equal: [<< parameters.os >>, macos]
steps:
- restore_cache:
name: Restore Homebrew packages
keys:
- nrwl-nx-homebrew-packages
- run:
name: Configure Detox Environment, Install applesimutils
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
xcrun simctl shutdown all && xcrun simctl erase all
no_output_timeout: 20m
- save_cache:
name: Save Homebrew Cache
key: nrwl-nx-homebrew-packages
paths:
- /usr/local/Homebrew
- ~/Library/Caches/Homebrew
- run-yarn-install:
os: << parameters.os >>
- when:
condition:
equal: [<< parameters.os >>, linux]
steps:
- install-pnpm
# -------------------------
# JOBS
# -------------------------
jobs:
# -------------------------
# JOBS: Agent
# -------------------------
agent:
parameters:
os:
type: string
default: 'linux'
pm:
type: string
default: 'pnpm'
executor: << parameters.os >>
environment:
GIT_AUTHOR_EMAIL: test@test.com
GIT_AUTHOR_NAME: Test
GIT_COMMITTER_EMAIL: test@test.com
GIT_COMMITTER_NAME: Test
NX_E2E_CI_CACHE_KEY: e2e-circleci-<< parameters.os >>
SELECTED_PM: << parameters.pm >>
NX_E2E_RUN_CYPRESS: 'false'
NX_VERBOSE_LOGGING: 'false'
steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-<< parameters.os >>-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- setup:
os: << parameters.os >>
- run:
name: Agent
command: npx nx-cloud start-agent
no_output_timeout: 60m
# -------------------------
# JOBS: Main Linux
# -------------------------
main-linux:
executor: linux
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
NX_VERBOSE_LOGGING: 'false'
steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-linux-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- setup:
os: linux
- nx/set-shas:
main-branch-name: 'master'
- run: yarn check-imports
- run: yarn nx format:check --base=$NX_BASE --head=$NX_HEAD
- run: yarn check-commit
- run: yarn depcheck
- run:
name: Check Documentation
command: yarn documentation
no_output_timeout: 20m
- run:
name: Run Lint/Test/Build
command: |
pids=()
yarn nx workspace-lint &
pids+=($!)
yarn nx affected --target=lint --base=$NX_BASE --head=$NX_HEAD --parallel=3 &
pids+=($!)
yarn nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel=1 &
pids+=($!)
yarn nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel=3 &
pids+=($!)
for pid in "${pids[@]}"; do
wait "$pid"
done
- run:
name: Run E2E Tests
command: |
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-storybook,e2e-react-native,e2e-detox --parallel=1
no_output_timeout: 45m
- run:
name: Stop All Running Agents for This CI Run
command: npx nx-cloud stop-all-agents
# -------------------------
# JOBS: Main-MacOS
# -------------------------
mainmacos:
executor: macos
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-macos
steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-macos-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- setup:
os: macos
- nx/set-shas:
main-branch-name: 'master'
- run:
name: Run E2E Tests
command: |
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-detox,e2e-js,e2e-next,e2e-workspace-create,e2e-workspace-integrations,e2e-workspace-core,e2e-react,e2e-web,e2e-angular-extensions,e2e-angular-core,e2e-cli,e2e-nx-plugin,e2e-cypress,e2e-node,e2e-linter,e2e-jest,e2e-add-nx-to-monorepo --parallel=1
no_output_timeout: 45m
- run:
name: Stop All Running Agents for This CI Run
command: npx nx-cloud stop-all-agents
# -------------------------
# WORKFLOWS
# -------------------------
workflows:
version: 2
build:
jobs:
- agent:
name: 'agent1'
- agent:
name: 'agent2'
- agent:
name: 'agent3'
- agent:
name: 'agent4'
- agent:
name: 'agent5'
- agent:
name: 'agent6'
- agent:
name: 'agent7'
- agent:
name: 'agent8'
- agent:
name: 'agent9'
pm: 'npm'
os: 'macos'
- agent:
name: 'agent10'
pm: 'npm'
os: 'macos'
- main-linux
- mainmacos:
name: main-macos-e2e