Skip to content

Commit c1b1ce1

Browse files
authored
Node 24 Support (#1357)
Since GitHub will force Node 24 on June 2nd, 2026: * Update to Node 24 and npm 11 * Update dependencies * Bump action version to 2 ESlint needs a bump once the GitHub plugin supports v10
2 parents f52a672 + f9874d6 commit c1b1ce1

22 files changed

Lines changed: 92352 additions & 106853 deletions

.github/workflows/npm-run-package.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ jobs:
2222
repository: ${{ github.event.repository.full_name }}
2323
ref: ${{ inputs.branch }}${{ github.event.ref }}
2424
token: ${{ secrets.GIT_FOR_WINDOWS_CI_PUSH }}
25+
- uses: actions/setup-node@v6
26+
with:
27+
node-version: 24
2528
- run: npm ci
2629
- run: npm run build
2730
- run: npm run lint
31+
- run: npm run typecheck
2832
- run: npm run format && git diff-files
2933
- run: npm run test
3034
- run: npm run package
@@ -33,7 +37,7 @@ jobs:
3337
run: |
3438
git add -u -- dist/ &&
3539
git diff-index --cached --exit-code HEAD -- ||
36-
echo "::set-output name=need-to-commit::yes"
40+
echo "need-to-commit=yes" >> "$GITHUB_OUTPUT"
3741
- name: commit & push
3842
if: steps.check.outputs.need-to-commit == 'yes'
3943
run: |

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ jobs:
1313
runs-on: windows-latest
1414
steps:
1515
- uses: actions/checkout@v6
16+
- uses: actions/setup-node@v6
17+
with:
18+
node-version: 24
1619
- run: npm ci
1720
- run: npm run build
1821
- run: npm run lint
22+
- run: npm run typecheck
1923
- run: npm run format && git diff-files
2024
- run: npm run test
2125
- run: npm run package

README.md

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Setup Git for Windows' minimal SDK
16-
uses: git-for-windows/setup-git-for-windows-sdk@v1
16+
uses: git-for-windows/setup-git-for-windows-sdk@v2
1717
- name: Build
1818
shell: bash
1919
run: make
@@ -78,7 +78,7 @@ On self-hosted runners, the SDK files persist after the workflow run is done. To
7878

7979
## Developing _this_ Action
8080

81-
> First, you'll need to have a reasonably modern version of `node` handy, such as Node 12.
81+
> First, you'll need to have a reasonably modern version of `node` handy, such as Node 24.
8282

8383
Install the dependencies
8484

@@ -97,25 +97,12 @@ Run the tests :heavy_check_mark:
9797
```bash
9898
$ npm test
9999
100-
> setup-git-for-windows-sdk@0.0.0 test C:\Users\me\setup-git-for-windows-sdk
101-
> jest
100+
✓ __tests__/main.test.ts (1)
101+
✓ skipping tests requiring network access
102+
✓ src/__tests__/git.test.ts (2)
103+
✓ git (2)
102104
103-
PASS __tests__/main.test.ts (28.869 s)
104-
√ skipping tests requiring network access (224 ms)
105-
106-
console.log
107-
If you want to run tests that access the network, set:
108-
export RUN_NETWORK_TESTS=true
109-
110-
at __tests__/main.test.ts:26:13
111-
112-
PASS __tests__/downloader.test.ts (29.889 s)
113-
√ can obtain build ID (9 ms)
114-
115-
Test Suites: 2 passed, 2 total
116-
Tests: 2 passed, 2 total
117-
Snapshots: 0 total
118-
Time: 31.11 s
119-
Ran all test suites.
105+
Test Files 2 passed (2)
106+
Tests 3 passed (3)
120107
...
121108
```

__mocks__/@octokit/rest.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
module.exports = {
2-
__esModule: true,
3-
Octokit: jest.fn().mockImplementation(() => {
1+
import {vi} from 'vitest'
2+
3+
export const Octokit = vi.fn().mockImplementation(() => {
44
return {
55
actions: {
6-
listWorkflowRuns: jest.fn().mockResolvedValue({
6+
listWorkflowRuns: vi.fn().mockResolvedValue({
77
data: {
88
workflow_runs: [
99
{
@@ -12,7 +12,7 @@ module.exports = {
1212
]
1313
}
1414
}),
15-
listWorkflowRunArtifacts: jest.fn().mockResolvedValue({
15+
listWorkflowRunArtifacts: vi.fn().mockResolvedValue({
1616
data: {
1717
artifacts: [
1818
{
@@ -23,19 +23,19 @@ module.exports = {
2323
]
2424
}
2525
}),
26-
downloadArtifact: jest.fn().mockResolvedValue({
26+
downloadArtifact: vi.fn().mockResolvedValue({
2727
data: 'mock artifact content'
2828
})
2929
},
3030
repos: {
31-
getBranch: jest.fn().mockResolvedValue({
31+
getBranch: vi.fn().mockResolvedValue({
3232
data: {
3333
commit: {
3434
sha: 'mock_sha'
3535
}
3636
}
3737
}),
38-
getReleaseByTag: jest.fn().mockResolvedValue({
38+
getReleaseByTag: vi.fn().mockResolvedValue({
3939
status: 200,
4040
data: {
4141
html_url: 'https://github.com/git-for-windows/git-sdk-64/releases/tag/ci-artifacts',
@@ -53,7 +53,7 @@ module.exports = {
5353
]
5454
}
5555
}),
56-
listReleases: jest.fn().mockResolvedValue({
56+
listReleases: vi.fn().mockResolvedValue({
5757
data: [
5858
{
5959
tag_name: 'v2.41.0.windows.1',
@@ -69,4 +69,3 @@ module.exports = {
6969
}
7070
}
7171
})
72-
}

__tests__/main.test.ts

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint no-console: "off" */
2+
import {test, expect} from 'vitest'
23
import * as child_process from 'child_process'
34
import * as path from 'path'
45
import * as process from 'process'
@@ -40,33 +41,35 @@ if (process.env.RUN_NETWORK_TESTS !== 'true') {
4041
).toEqual(1)
4142
})
4243

43-
jest.setTimeout(5 * 60 * 1000) // this can easily take a minute or five
44+
test(
45+
'extract the 64-bit minimal SDK',
46+
async () => {
47+
const outputDirectory = `${__dirname}/../git-sdk-64-minimal`
48+
expect(
49+
await runAction({
50+
env: {
51+
INPUT_FLAVOR: 'minimal',
52+
INPUT_ARCHITECTURE: 'x86_64',
53+
INPUT_PATH: outputDirectory,
54+
INPUT_VERBOSE: '250',
55+
INPUT_CACHE: 'true'
56+
}
57+
})
58+
).toEqual(0)
59+
expect(
60+
statSync.bind(null, `${outputDirectory}/mingw64/bin/gcc.exe`)
61+
).not.toThrow()
4462

45-
test('extract the 64-bit minimal SDK', async () => {
46-
const outputDirectory = `${__dirname}/../git-sdk-64-minimal`
47-
expect(
48-
await runAction({
49-
env: {
50-
INPUT_FLAVOR: 'minimal',
51-
INPUT_ARCHITECTURE: 'x86_64',
52-
INPUT_PATH: outputDirectory,
53-
INPUT_VERBOSE: '250',
54-
INPUT_CACHE: 'true'
63+
const hello = child_process.spawnSync(
64+
'usr\\bin\\bash.exe',
65+
['-lc', 'cat <(echo hello)'],
66+
{
67+
cwd: outputDirectory
5568
}
56-
})
57-
).toEqual(0)
58-
expect(
59-
statSync.bind(null, `${outputDirectory}/mingw64/bin/gcc.exe`)
60-
).not.toThrow()
61-
62-
const hello = child_process.spawnSync(
63-
'usr\\bin\\bash.exe',
64-
['-lc', 'cat <(echo hello)'],
65-
{
66-
cwd: outputDirectory
67-
}
68-
)
69-
expect(hello.stderr.toString()).toBe('')
70-
expect(hello.stdout.toString()).toBe('hello\n')
71-
})
69+
)
70+
expect(hello.stderr.toString()).toBe('')
71+
expect(hello.stdout.toString()).toBe('hello\n')
72+
},
73+
5 * 60 * 1000
74+
)
7275
}

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ inputs:
4747
[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
4848
default: ${{ github.token }}
4949
runs:
50-
using: 'node20'
50+
using: 'node24'
5151
main: 'dist/index.js'
5252
post: 'dist/index.js'

0 commit comments

Comments
 (0)