-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
388 lines (375 loc) · 12.1 KB
/
ci.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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
name: CI
on: [push, pull_request]
jobs:
prepare-yarn-cache:
name: Prepare Cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: 'Check or update Yarn cache (fix w/ "yarn install")'
env:
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
YARN_NODE_LINKER: pnp # use pnp linker for better linking performance: it's meant to update yarn cache only
run: |
yarn install --mode=skip-build
yarn-validate:
name: Validate Yarn dependencies and constraints
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: 'Check for unmet constraints (fix w/ "yarn constraints --fix")'
run: |
yarn constraints
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
run: |
yarn dedupe --check
- name: Check for dependency cycles
run: |
yarn release-tool check-cycles
test-coverage:
name: Test on Node.js Latest
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Generate coverage report
run: |
make -j test-ci-coverage
yarn test:esm
- name: Upload coverage report
uses: codecov/codecov-action@v1
build:
name: Build Babel Artifacts
needs: prepare-yarn-cache
runs-on: ubuntu-latest
# Yarn PnP does not support native ESM yet (https://github.com/yarnpkg/berry/issues/638)
# env:
# YARN_NODE_LINKER: pnp # use pnp linker for better linking performance and stricter checks
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: Build babel artifacts
run: |
BABEL_ENV=test-legacy make -j build-standalone-ci
env:
BABEL_8_BREAKING: false
STRIP_BABEL_8_FLAG: true
- name: Ensure cwd does not contain uncommitted changes
run: |
./scripts/assert-dir-git-clean.sh
- uses: actions/upload-artifact@v3
with:
name: babel-artifact
path: |
codemods/*/lib/**/*
eslint/*/lib/**/*
packages/*/lib/**/*
packages/babel-standalone/*.js
!**/node_modules/**
build-windows:
name: Build Babel Artifacts On Windows
runs-on: windows-latest
# Yarn PnP does not support native ESM yet (https://github.com/yarnpkg/berry/issues/638)
# env:
# YARN_NODE_LINKER: pnp # use pnp linker for better linking performance and stricter checks
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: Build babel artifacts
shell: bash
run: |
BABEL_ENV=test-legacy make -j build-standalone-ci
env:
BABEL_8_BREAKING: false
STRIP_BABEL_8_FLAG: true
- name: Ensure cwd does not contain uncommitted changes
shell: bash
run: |
./scripts/assert-dir-git-clean.sh
lint:
name: Lint
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: Install
run: yarn install
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Lint
run: make -j tscheck flowcheck-ci lint-ci
test:
name: Test on Node.js # GitHub will add ${{ matrix.node-version }} to this title
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 14, 12, 10, 8, 6]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest # Run yarn on latest node
uses: actions/setup-node@v3
with:
node-version: "*" # Build Babel on latest node LTS versions
cache: "yarn"
- name: Install
run: |
yarn install
- name: Downgrade Jest for node <= 10
if: matrix.node-version == '6' || matrix.node-version == '8' || matrix.node-version == '10'
run: |
yarn remove jest
yarn add --dev jest@24
# Deduplicate dependencies, because duplicate copies of graceful-fs cause
# problems with the "path" module: https://github.com/facebook/jest/issues/9656
yarn dedupe
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Use Node.js ${{ matrix.node-version }} # Checkout node version for test executor
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Test on node.js ${{ matrix.node-version }}
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
# Todo(Babel 8): Jest execution path is hardcoded because Yarn 2 does not support node 6
run: |
BABEL_ENV=test node --max-old-space-size=4096 ./node_modules/.bin/jest --ci --color
env:
TEST_FUZZ: "${{ (matrix.node-version == '6' || matrix.node-version == '8' || matrix.node-version == '10') && 'false' || 'true' }}"
- name: Use Node.js latest # For `yarn version` in post actions of the first actions/setup-node
if: matrix.node-version == '6' || matrix.node-version == '8' || matrix.node-version == '10'
uses: actions/setup-node@v3
with:
node-version: "*"
test-babel-8-breaking:
name: Test Babel 8 breaking changes
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js 14.17
uses: actions/setup-node@v3
with:
node-version: "14.17" # Node.js 14.17 is the first LTS supported by Babel 8
cache: "yarn"
- name: Install and build
run: make -j bootstrap
env:
BABEL_ENV: test
BABEL_8_BREAKING: true
STRIP_BABEL_8_FLAG: true
- name: Lint
run: make -j tscheck flowcheck-ci lint-ci
env:
BABEL_ENV: test
BABEL_8_BREAKING: true
BABEL_TYPES_8_BREAKING: true
- name: Test
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
run: |
yarn jest --ci --color
yarn test:esm
env:
BABEL_ENV: test
BABEL_8_BREAKING: true
BABEL_TYPES_8_BREAKING: true
test-windows:
name: Test on Windows
needs: build
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Test on Windows
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
run: yarn jest --ci --color
env:
BABEL_ENV: test
external-parser-tests:
name: Third-party Parser Tests
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: Install
run: yarn install
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Download tests
run: make -j bootstrap-flow bootstrap-typescript bootstrap-test262
- name: Run Test262 Tests
run: make test-test262
- name: Run Flow Tests
run: make test-flow
- name: Run TypeScript Tests
run: make test-typescript
runtime-interop:
name: Test @babel/runtime integrations
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
# See https://github.com/babel/babel/pull/12906
- name: Support self-references on old Node.js
run: |
echo '{
"private": true,
"devDependencies": {
"@babel/runtime": "workspace:*",
"@babel/runtime-corejs3": "workspace:*"
}
}' > packages/package.json
node -e "
const pkg = require('./package.json');
pkg.workspaces.push('packages');
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2))
"
- name: Install
run: yarn install
env:
# The "Support self-references on old Node.js" step mutates the
# package.json file, causing a yarn.lock update.
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Generate absoluteRuntime tests
run: yarn test:runtime:generate-absolute-runtime
- name: Test bundlers
run: yarn test:runtime:bundlers
- name: Test Node.js
run: yarn test:runtime:node
- name: Use Node.js 10
uses: actions/setup-node@v3
with:
node-version: 10
- name: Test Node.js 10
run: node test/runtime-integration/node.cjs
- name: Use Node.js 12.0
uses: actions/setup-node@v3
with:
node-version: "12.0" # quoted, otherwise it's just 13
- name: Test Node.js 12.0
run: yarn test:runtime:node
- name: Use Node.js 12.17
uses: actions/setup-node@v3
with:
node-version: 12.17
- name: Test Node.js 12.17
run: yarn test:runtime:node
- name: Use Node.js 13.0
uses: actions/setup-node@v3
with:
node-version: "13.0" # quoted, otherwise it's just 13
- name: Test Node.js 13.0
run: yarn test:runtime:node
- name: Use Node.js 13.2
uses: actions/setup-node@v3
with:
node-version: 13.2
- name: Test Node.js 13.2
run: yarn test:runtime:node
- name: Use Node.js 13.6
uses: actions/setup-node@v3
with:
node-version: 13.6
- name: Test Node.js 13.6
run: yarn test:runtime:node
- name: Use Node.js 13.7
uses: actions/setup-node@v3
with:
node-version: 13.7
- name: Test Node.js 13.7
run: yarn test:runtime:node
- name: Use Node.js 14.2
uses: actions/setup-node@v3
with:
node-version: 14.2
- name: Test Node.js 14.2
run: yarn test:runtime:node
- name: Use Node.js 16.5
uses: actions/setup-node@v3
with:
node-version: 16.5
- name: Test Node.js 16.5
run: yarn test:runtime:node
- name: Use Node.js 16.6
uses: actions/setup-node@v3
with:
node-version: 16.6
- name: Test Node.js 16.6
run: yarn test:runtime:node