Skip to content

Commit 60b83ac

Browse files
authored
CI: Select node version to run CI against automatically (#7032)
## What's the problem this PR addresses? Our CI are running against node versions that are not supported like 19. The version list is manually managed, meaning we need to update it each time Node releases new majors. Also, in #6575 we pinned node versions for most CI processes to Node 22 to avoid 23.0 shenanigans. ## How did you fix it? Add a step to fetch available Node versions and filter them down to major versions that are even-numbered and >=18, or the latest major. This needs to be updated only when we change our own supported Node versions. And essentially revert #6575 to use the current Node version ## Checklist <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
1 parent 571363e commit 60b83ac

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/actions/prepare/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ inputs:
66
node-version:
77
description: 'The version of Node.js to use'
88
required: false
9-
default: '22'
9+
default: 'current'
1010

1111
runs:
1212
using: composite

.github/workflows/integration-workflow.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,28 @@ jobs:
209209
name: vscode-zipfs
210210
path: ./packages/vscode-zipfs/vscode-zipfs-*.vsix
211211

212+
node-versions:
213+
name: 'Acceptance test node versions'
214+
outputs:
215+
versions: ${{ steps.versions.outputs.versions }}
216+
runs-on: ubuntu-latest
217+
steps:
218+
- id: versions
219+
shell: bash
220+
run: >
221+
echo -n 'versions='
222+
>> $GITHUB_OUTPUT
223+
224+
curl https://nodejs.org/dist/index.json |
225+
jq -c '[.[0:1] + map(select(.lts)) | .[].version | capture("^v(?<major>\\d+)") | .major | tonumber] | unique | map(select(. >= 18))'
226+
>> $GITHUB_OUTPUT
227+
212228
acceptance:
213229
strategy:
214230
fail-fast: false
215231
matrix:
216232
# We run the ubuntu tests on multiple Node versions with 2 shards since they're the fastest.
217-
node: [18, 19, 20, 21, 22]
233+
node: ${{ fromJson(needs.node-versions.outputs.versions) }}
218234
platform: [[ubuntu, 22.04]]
219235
shard: ['1/2', '2/2']
220236
include:
@@ -239,7 +255,7 @@ jobs:
239255

240256
name: '${{matrix.platform[0]}}-latest w/ Node.js ${{matrix.node}}.x (${{matrix.shard}})'
241257
runs-on: ${{matrix.platform[0]}}-${{matrix.platform[1]}}
242-
needs: build
258+
needs: [build, node-versions]
243259

244260
# Permission required to produce a valid provenance statement during the tests
245261
# Only run inside the main repository; this may fail in master since it doesn't run in PRs from forks
@@ -249,10 +265,10 @@ jobs:
249265
steps:
250266
- uses: actions/checkout@v4
251267

252-
- name: 'Use Node.js ${{matrix.node}}.x'
268+
- name: 'Use Node.js ${{matrix.node}}'
253269
uses: actions/setup-node@v4
254270
with:
255-
node-version: ${{matrix.node}}.x
271+
node-version: ${{matrix.node}}
256272

257273
- uses: actions/download-artifact@v4
258274
with:

0 commit comments

Comments
 (0)