Skip to content

Commit 18d1d83

Browse files
committed
Enable CI
1 parent d40a564 commit 18d1d83

File tree

1 file changed

+55
-12
lines changed

1 file changed

+55
-12
lines changed

.github/workflows/ci.yml

+55-12
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,12 @@ jobs:
3030
- macos-14
3131
node-version:
3232
- '22'
33-
- '20'
34-
- '18'
35-
- '16'
36-
- '14'
3733
bundle:
3834
- 'true'
3935
include:
40-
- node-version: '*'
36+
- node-version: '22'
4137
bundle: false
4238
os: ubuntu-latest
43-
exclude:
44-
# No Node 14 on ARM macOS
45-
- node-version: '14'
46-
os: macos-14
4739

4840
runs-on: ${{ matrix.os }}
4941
name: Test Node ${{ matrix.node-version }} on ${{ matrix.os }}${{ (!matrix.bundle && ' with --no-bundle') || '' }}
@@ -55,19 +47,34 @@ jobs:
5547
with:
5648
node-version: ${{ matrix.node-version }}
5749
check-latest: true
50+
51+
- run: |
52+
echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
53+
name: Enable require(ESM) and process.getBuiltinModule polyfill
54+
id: node-options
55+
56+
- name: Verify that process.getBuiltinModule is available
57+
run: node -e 'if (process.getBuiltinModule) { console.log(process.getBuiltinModule) } else { throw new Error("process.getBuiltinModule is not available") }'
58+
env:
59+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
60+
5861
- run: npm ci
5962

6063
- name: Tests
6164
id: test
6265
# run tests, but lint separately
6366
run: npm run test -- --no-lint --bundle=${{ matrix.bundle }}
67+
env:
68+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
6469

6570
- name: Print baseline diff on failure
6671
if: ${{ failure() && steps.test.conclusion == 'failure' }}
6772
run: |
6873
npx hereby baseline-accept
6974
git add tests/baselines/reference
7075
git diff --staged --exit-code
76+
env:
77+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
7178

7279
lint:
7380
runs-on: ubuntu-latest
@@ -145,6 +152,12 @@ jobs:
145152
with:
146153
node-version: '*'
147154
check-latest: true
155+
156+
- run: |
157+
echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
158+
name: Enable require(ESM) and process.getBuiltinModule polyfill
159+
id: node-options
160+
148161
- run: |
149162
npm --version
150163
# corepack enable npm
@@ -154,12 +167,16 @@ jobs:
154167
- run: npm ci
155168

156169
- run: npx hereby lkg
170+
env:
171+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
157172
- run: |
158173
node ./scripts/addPackageJsonGitHead.mjs package.json
159174
npm pack
160175
mv typescript*.tgz typescript.tgz
161-
echo "package=$PWD/typescript.tgz" >> "$GITHUB_OUTPUT"
176+
echo "package=$(pwd)/typescript.tgz" >> "$GITHUB_OUTPUT"
162177
id: pack
178+
env:
179+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
163180
164181
- name: Smoke test
165182
run: |
@@ -175,6 +192,8 @@ jobs:
175192
176193
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript
177194
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript/lib/tsserverlibrary
195+
env:
196+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
178197

179198
package-size:
180199
runs-on: ubuntu-latest
@@ -243,18 +262,30 @@ jobs:
243262
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
244263
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
245264
with:
246-
node-version: '*'
265+
node-version: '22'
247266
check-latest: true
267+
268+
- run: |
269+
echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
270+
name: Enable require(ESM) and process.getBuiltinModule polyfill
271+
id: node-options
272+
248273
- run: npm ci
249274

250275
- name: Build tsc
251276
run: npx hereby tsc
277+
env:
278+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
252279

253280
- name: Clean
254281
run: npx hereby clean-src
282+
env:
283+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
255284

256285
- name: Self build
257286
run: npx hereby build-src --built
287+
env:
288+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
258289

259290
baselines:
260291
runs-on: ubuntu-latest
@@ -263,20 +294,30 @@ jobs:
263294
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
264295
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
265296
with:
266-
node-version: '*'
297+
node-version: '22'
267298
check-latest: true
299+
300+
- run: |
301+
echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
302+
name: Enable require(ESM) and process.getBuiltinModule polyfill
303+
id: node-options
304+
268305
- run: npm ci
269306

270307
- name: Remove all baselines
271308
run: rm -rf tests/baselines/reference
272309

273310
- name: Run tests
274311
run: npm test &> /dev/null || exit 0
312+
env:
313+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
275314

276315
- name: Accept baselines
277316
run: |
278317
npx hereby baseline-accept
279318
git add tests/baselines/reference
319+
env:
320+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
280321

281322
- name: Check baselines
282323
id: check-baselines
@@ -295,6 +336,8 @@ jobs:
295336
git diff --staged > fix_baselines.patch
296337
exit 1
297338
fi
339+
env:
340+
NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
298341

299342
- name: Upload baseline diff artifact
300343
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}

0 commit comments

Comments
 (0)