mirror of
https://github.com/actions/setup-java.git
synced 2026-07-01 01:21:39 +00:00
Compare commits
No commits in common. "b05076766e16f3f96d8a80ad3545b09a7cba52df" and "8c15982abcc6d5f8dc49e6699f5766d0c59be15d" have entirely different histories.
b05076766e
...
8c15982abc
@ -356,16 +356,14 @@ describe('GraalVMDistribution', () => {
|
|||||||
// Verify the error is thrown with the expected message
|
// Verify the error is thrown with the expected message
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
).rejects.toThrow("No matching version found for SemVer '17.0.99'");
|
).rejects.toThrow(
|
||||||
// Verify distribution info is included
|
"No matching GraalVM version found for SemVer '17.0.99'. Available versions can be found at https://download.oracle.com/graalvm/. Pick a version from the list."
|
||||||
await expect(
|
);
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
|
||||||
).rejects.toThrow('GraalVM');
|
|
||||||
|
|
||||||
// Verify the hint about checking the base URL is included
|
// Verify the hint about checking the base URL is included
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
).rejects.toThrow('https://www.graalvm.org/downloads/');
|
).rejects.toThrow('https://download.oracle.com/graalvm');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error for unauthorized access (401)', async () => {
|
it('should throw error for unauthorized access (401)', async () => {
|
||||||
@ -507,20 +505,12 @@ describe('GraalVMDistribution', () => {
|
|||||||
.spyOn(distribution as any, 'distributionArchitecture')
|
.spyOn(distribution as any, 'distributionArchitecture')
|
||||||
.mockReturnValue('x64');
|
.mockReturnValue('x64');
|
||||||
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findPackageForDownload('23')
|
|
||||||
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('23')
|
(distribution as any).findPackageForDownload('23')
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
'Note: No EA build is marked as latest for this version.'
|
"No EA build is marked as latest for version '23-ea'. Available EA versions: ['23-ea-20240716']."
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findPackageForDownload('23')
|
|
||||||
).rejects.toThrow('23-ea-20240716');
|
|
||||||
|
|
||||||
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -726,20 +716,12 @@ describe('GraalVMDistribution', () => {
|
|||||||
const noLatestVersions = mockEAVersions.map(v => ({...v, latest: false}));
|
const noLatestVersions = mockEAVersions.map(v => ({...v, latest: false}));
|
||||||
fetchEASpy.mockResolvedValue(noLatestVersions);
|
fetchEASpy.mockResolvedValue(noLatestVersions);
|
||||||
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
|
||||||
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
'Note: No EA build is marked as latest for this version.'
|
"No EA build is marked as latest for version '23-ea'. Available EA versions: ['23-ea-20240716', '23-ea-20240709']."
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
|
||||||
).rejects.toThrow('23-ea-20240716');
|
|
||||||
|
|
||||||
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
14
dist/setup/index.js
vendored
14
dist/setup/index.js
vendored
@ -113139,7 +113139,6 @@ const base_installer_1 = __nccwpck_require__(59741);
|
|||||||
const http_client_1 = __nccwpck_require__(96255);
|
const http_client_1 = __nccwpck_require__(96255);
|
||||||
const util_1 = __nccwpck_require__(92629);
|
const util_1 = __nccwpck_require__(92629);
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@ -113218,10 +113217,9 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
handleHttpResponse(response, range) {
|
handleHttpResponse(response, range) {
|
||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
if (statusCode === http_client_1.HttpCodes.NotFound) {
|
if (statusCode === http_client_1.HttpCodes.NotFound) {
|
||||||
// Create the standard error with additional hint about checking the download URL
|
throw new Error(`No matching GraalVM version found for SemVer '${range}'.` +
|
||||||
const error = this.createVersionNotFoundError(range);
|
` Available versions can be found at ${GRAALVM_DL_BASE}/.` +
|
||||||
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
` Pick a version from the list.`);
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
|
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
|
||||||
statusCode === http_client_1.HttpCodes.Forbidden) {
|
statusCode === http_client_1.HttpCodes.Forbidden) {
|
||||||
@ -113239,7 +113237,11 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
const availableVersions = versions.map(v => v.version);
|
const availableVersions = versions.map(v => v.version);
|
||||||
throw this.createVersionNotFoundError(javaEaVersion, availableVersions, 'Note: No EA build is marked as latest for this version.');
|
let message = `No EA build is marked as latest for version '${javaEaVersion}'.`;
|
||||||
|
if (availableVersions.length > 0) {
|
||||||
|
message += ` Available EA versions: [${availableVersions.map(v => `'${v}'`).join(', ')}].`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
const arch = this.distributionArchitecture();
|
const arch = this.distributionArchitecture();
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import {
|
|||||||
} from '../../util';
|
} from '../../util';
|
||||||
|
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@ -150,10 +149,11 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
|
|
||||||
if (statusCode === HttpCodes.NotFound) {
|
if (statusCode === HttpCodes.NotFound) {
|
||||||
// Create the standard error with additional hint about checking the download URL
|
throw new Error(
|
||||||
const error = this.createVersionNotFoundError(range);
|
`No matching GraalVM version found for SemVer '${range}'.` +
|
||||||
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
` Available versions can be found at ${GRAALVM_DL_BASE}/.` +
|
||||||
throw error;
|
` Pick a version from the list.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -183,11 +183,11 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
const availableVersions = versions.map(v => v.version);
|
const availableVersions = versions.map(v => v.version);
|
||||||
throw this.createVersionNotFoundError(
|
let message = `No EA build is marked as latest for version '${javaEaVersion}'.`;
|
||||||
javaEaVersion,
|
if (availableVersions.length > 0) {
|
||||||
availableVersions,
|
message += ` Available EA versions: [${availableVersions.map(v => `'${v}'`).join(', ')}].`;
|
||||||
'Note: No EA build is marked as latest for this version.'
|
}
|
||||||
);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user