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