Skip to content

Commit e8aa5c4

Browse files
authored
Merge branch 'main' into support-kona-jdk
2 parents f29bb0b + 77ee41d commit e8aa5c4

20 files changed

Lines changed: 1113 additions & 108 deletions

File tree

‎.github/workflows/e2e-versions.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ permissions:
1919

2020
jobs:
2121
setup-java-major-versions:
22-
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
22+
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
2323
runs-on: ${{ matrix.os }}
2424
strategy:
2525
fail-fast: false
@@ -97,7 +97,7 @@ jobs:
9797
shell: bash
9898

9999
setup-java-alpine-linux:
100-
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - alpine-linux - ${{ matrix.os }}
100+
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - alpine-linux - ${{ matrix.os }}
101101
runs-on: ${{ matrix.os }}
102102
container:
103103
image: alpine:3.21
@@ -128,7 +128,7 @@ jobs:
128128
shell: bash
129129

130130
setup-java-major-minor-versions:
131-
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
131+
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
132132
needs: setup-java-major-versions
133133
runs-on: ${{ matrix.os }}
134134
strategy:
@@ -276,7 +276,7 @@ jobs:
276276
shell: bash
277277

278278
setup-java-ea-versions-zulu:
279-
name: zulu ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
279+
name: zulu ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
280280
needs: setup-java-major-minor-versions
281281
runs-on: ${{ matrix.os }}
282282
strategy:
@@ -303,7 +303,7 @@ jobs:
303303
shell: bash
304304

305305
setup-java-ea-versions-temurin:
306-
name: temurin ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
306+
name: temurin ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
307307
needs: setup-java-major-minor-versions
308308
runs-on: ${{ matrix.os }}
309309
strategy:
@@ -386,7 +386,7 @@ jobs:
386386
shell: bash
387387

388388
setup-java-ea-versions-sapmachine:
389-
name: sapmachine ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
389+
name: sapmachine ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
390390
needs: setup-java-major-minor-versions
391391
runs-on: ${{ matrix.os }}
392392
strategy:

‎.husky/pre-commit‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
npx lint-staged

‎.husky/pre-push‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
npm run build && npm test

‎__tests__/auth.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ describe('auth tests', () => {
160160
const expectedSettings = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
161161
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
162162
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
163+
<interactiveMode>false</interactiveMode>
163164
<servers>
164165
<server>
165166
<id>${id}</id>
@@ -181,6 +182,7 @@ describe('auth tests', () => {
181182
const expectedSettings = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
182183
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
183184
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
185+
<interactiveMode>false</interactiveMode>
184186
<servers>
185187
<server>
186188
<id>${id}</id>

‎__tests__/distributors/jetbrains-installer.test.ts‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,26 @@ describe('findPackageForDownload', () => {
8787
const url = resolvedVersion.url;
8888
const options = {method: 'HEAD'};
8989

90-
https.request(url, options, res => {
91-
// JetBrains uses 403 for inexistent packages
92-
expect(res.statusCode).not.toBe(403);
93-
res.resume();
90+
await new Promise<void>((resolve, reject) => {
91+
const request = https.request(url, options, res => {
92+
let assertionError: unknown;
93+
94+
try {
95+
// JetBrains uses 403 for non-existent packages
96+
expect(res.statusCode).not.toBe(403);
97+
} catch (error) {
98+
assertionError = error;
99+
}
100+
101+
res.resume();
102+
res.once('error', reject);
103+
res.once('end', () =>
104+
assertionError ? reject(assertionError as Error) : resolve()
105+
);
106+
});
107+
108+
request.on('error', reject);
109+
request.end();
94110
});
95111
}
96112
);

‎__tests__/maven-args.test.ts‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import * as core from '@actions/core';
2+
3+
import {configureMavenArgs} from '../src/maven-args';
4+
import {
5+
INPUT_SHOW_DOWNLOAD_PROGRESS,
6+
MAVEN_ARGS_ENV,
7+
MAVEN_NO_TRANSFER_PROGRESS_FLAG
8+
} from '../src/constants';
9+
10+
describe('configureMavenArgs', () => {
11+
let inputs: Record<string, string>;
12+
let spyGetInput: jest.SpyInstance;
13+
let spyExportVariable: jest.SpyInstance;
14+
let spyInfo: jest.SpyInstance;
15+
let spyDebug: jest.SpyInstance;
16+
const originalMavenArgs = process.env[MAVEN_ARGS_ENV];
17+
18+
beforeEach(() => {
19+
inputs = {};
20+
21+
spyGetInput = jest.spyOn(core, 'getInput');
22+
spyGetInput.mockImplementation((name: string) => inputs[name] ?? '');
23+
24+
spyExportVariable = jest.spyOn(core, 'exportVariable');
25+
spyExportVariable.mockImplementation((name: string, value: string) => {
26+
process.env[name] = value;
27+
});
28+
29+
spyInfo = jest.spyOn(core, 'info');
30+
spyInfo.mockImplementation(() => undefined);
31+
32+
spyDebug = jest.spyOn(core, 'debug');
33+
spyDebug.mockImplementation(() => undefined);
34+
35+
delete process.env[MAVEN_ARGS_ENV];
36+
});
37+
38+
afterEach(() => {
39+
jest.restoreAllMocks();
40+
if (originalMavenArgs === undefined) {
41+
delete process.env[MAVEN_ARGS_ENV];
42+
} else {
43+
process.env[MAVEN_ARGS_ENV] = originalMavenArgs;
44+
}
45+
});
46+
47+
it('sets MAVEN_ARGS with -ntp by default', () => {
48+
configureMavenArgs();
49+
50+
expect(spyExportVariable).toHaveBeenCalledWith(
51+
MAVEN_ARGS_ENV,
52+
MAVEN_NO_TRANSFER_PROGRESS_FLAG
53+
);
54+
expect(process.env[MAVEN_ARGS_ENV]).toBe(MAVEN_NO_TRANSFER_PROGRESS_FLAG);
55+
});
56+
57+
it('does not modify MAVEN_ARGS when show-download-progress is true', () => {
58+
inputs[INPUT_SHOW_DOWNLOAD_PROGRESS] = 'true';
59+
60+
configureMavenArgs();
61+
62+
expect(spyExportVariable).not.toHaveBeenCalled();
63+
expect(process.env[MAVEN_ARGS_ENV]).toBeUndefined();
64+
});
65+
66+
it('preserves an existing MAVEN_ARGS value and appends -ntp', () => {
67+
process.env[MAVEN_ARGS_ENV] = '-B -Dstyle.color=always';
68+
69+
configureMavenArgs();
70+
71+
expect(spyExportVariable).toHaveBeenCalledWith(
72+
MAVEN_ARGS_ENV,
73+
`-B -Dstyle.color=always ${MAVEN_NO_TRANSFER_PROGRESS_FLAG}`
74+
);
75+
});
76+
77+
it('does not duplicate the flag when -ntp is already present', () => {
78+
process.env[MAVEN_ARGS_ENV] = '-B -ntp';
79+
80+
configureMavenArgs();
81+
82+
expect(spyExportVariable).not.toHaveBeenCalled();
83+
expect(process.env[MAVEN_ARGS_ENV]).toBe('-B -ntp');
84+
});
85+
86+
it('does not duplicate the flag when --no-transfer-progress is already present', () => {
87+
process.env[MAVEN_ARGS_ENV] = '--no-transfer-progress -B';
88+
89+
configureMavenArgs();
90+
91+
expect(spyExportVariable).not.toHaveBeenCalled();
92+
expect(process.env[MAVEN_ARGS_ENV]).toBe('--no-transfer-progress -B');
93+
});
94+
95+
it('keeps the existing MAVEN_ARGS when show-download-progress is true', () => {
96+
inputs[INPUT_SHOW_DOWNLOAD_PROGRESS] = 'true';
97+
process.env[MAVEN_ARGS_ENV] = '-B';
98+
99+
configureMavenArgs();
100+
101+
expect(spyExportVariable).not.toHaveBeenCalled();
102+
expect(process.env[MAVEN_ARGS_ENV]).toBe('-B');
103+
});
104+
});

0 commit comments

Comments
 (0)