Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
d23d728909
Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-18 05:49:39 +00:00
22 changed files with 60 additions and 98 deletions

View File

@ -16,4 +16,4 @@ jobs:
name: Basic validation name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with: with:
node-version: '24.x' node-version: '20.x'

View File

@ -16,4 +16,4 @@ jobs:
name: Check dist/ name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with: with:
node-version: '24.x' node-version: '20.x'

View File

@ -30,7 +30,7 @@ jobs:
id: setup-java id: setup-java
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '11'
cache: gradle cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle* cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Create files to cache - name: Create files to cache

View File

@ -30,7 +30,7 @@ jobs:
id: setup-java id: setup-java
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '11'
cache: gradle cache: gradle
- name: Create files to cache - name: Create files to cache
# Need to avoid using Gradle daemon to stabilize the save process on Windows # Need to avoid using Gradle daemon to stabilize the save process on Windows

View File

@ -1,6 +1,6 @@
--- ---
name: "@types/node" name: "@types/node"
version: 24.1.0 version: 20.11.24
type: npm type: npm
summary: TypeScript definitions for node summary: TypeScript definitions for node
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node

View File

@ -1,17 +1,15 @@
--- ---
name: undici-types name: undici-types
version: 7.8.0 version: 5.26.5
type: npm type: npm
summary: A stand-alone types package for Undici summary: A stand-alone types package for Undici
homepage: https://undici.nodejs.org homepage: https://undici.nodejs.org
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: Auto-generated MIT license text
text: | text: |
MIT License MIT License
Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights

View File

@ -191,9 +191,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const installerOptions: JavaInstallerOptions = { const installerOptions: JavaInstallerOptions = {
version: '17', version: '17',

View File

@ -287,7 +287,7 @@ describe('setupJava', () => {
spyCoreSetOutput = jest.spyOn(core, 'setOutput'); spyCoreSetOutput = jest.spyOn(core, 'setOutput');
spyCoreSetOutput.mockImplementation(() => undefined); spyCoreSetOutput.mockImplementation(() => undefined);
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>); jest.spyOn(os, 'arch').mockReturnValue('x86');
}); });
afterEach(() => { afterEach(() => {

View File

@ -203,27 +203,28 @@ describe('getAvailableVersions', () => {
}); });
it.each([ it.each([
['amd64', 'x64'], ['arm64', 'aarch64'],
['arm64', 'aarch64'] ['amd64', 'x64']
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new CorrettoDistribution({ const version = '17';
version: '17', const installerOptions: JavaInstallerOptions = {
version,
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
checkLatest: false checkLatest: false
}); };
const distribution = new CorrettoDistribution(installerOptions);
mockPlatform(distribution, 'macos'); mockPlatform(distribution, 'macos');
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`; const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
const availableVersion = await distribution['findPackageForDownload']( const availableVersion = await distribution['findPackageForDownload'](
'17' version
); );
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);

View File

@ -98,35 +98,31 @@ describe('findPackageForDownload', () => {
}); });
it.each([ it.each([
['amd64', ['x64', 'amd64']], ['amd64', 'x64'],
['arm64', ['aarch64', 'arm64']] ['arm64', 'aarch64']
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArchs: string[]) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch') jest.spyOn(os, 'platform').mockReturnValue('linux');
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new GraalVMDistribution({ const version = '21';
version: '21', const distro = new GraalVMDistribution({
version,
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
checkLatest: false checkLatest: false
}); });
const osType = distribution.getPlatform(); const osType = distribution.getPlatform();
if (osType === 'windows' && distroArchs.includes('aarch64')) { if (osType === 'windows' && distroArch == 'aarch64') {
return; // skip, aarch64 is not available for Windows return; // skip, aarch64 is not available for Windows
} }
const archiveType = getDownloadArchiveExtension(); const archiveType = getDownloadArchiveExtension();
const result = await distribution['findPackageForDownload']('21'); const result = await distro['findPackageForDownload'](version);
const expectedUrl = `https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${osType}-${distroArch}_bin.${archiveType}`;
const expectedUrls = distroArchs.map( expect(result.url).toBe(expectedUrl);
distroArch =>
`https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${osType}-${distroArch}_bin.${archiveType}`
);
expect(expectedUrls).toContain(result.url);
} }
); );

View File

@ -105,11 +105,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distributions = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
@ -119,11 +117,11 @@ describe('getAvailableVersions', () => {
const additionalParams = const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion'; 'updateVersion%2CbuildVersion';
distributions['getPlatformOption'] = () => 'macos'; distribution['getPlatformOption'] = () => 'macos';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`; const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`;
await distributions['getAvailableVersions'](); await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1); expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);

View File

@ -105,9 +105,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',

View File

@ -105,9 +105,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',

View File

@ -95,9 +95,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('darwin'); jest.spyOn(os, 'platform').mockReturnValue('darwin');
const version = '17'; const version = '17';
@ -121,9 +119,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('linux'); jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '17'; const version = '17';
@ -147,9 +143,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('win32'); jest.spyOn(os, 'platform').mockReturnValue('win32');
const version = '17'; const version = '17';

View File

@ -95,9 +95,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('linux'); jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '18'; const version = '18';

View File

@ -147,9 +147,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(distroArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const installerOptions: JavaInstallerOptions = { const installerOptions: JavaInstallerOptions = {
version: '17', version: '17',

View File

@ -1,4 +1,5 @@
import {HttpClient} from '@actions/http-client'; import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
import {ZuluDistribution} from '../../src/distributions/zulu/installer'; import {ZuluDistribution} from '../../src/distributions/zulu/installer';
import {IZuluVersions} from '../../src/distributions/zulu/models'; import {IZuluVersions} from '../../src/distributions/zulu/models';
import * as utils from '../../src/util'; import * as utils from '../../src/util';
@ -125,9 +126,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',

View File

@ -126,9 +126,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',
@ -137,9 +135,7 @@ describe('getAvailableVersions', () => {
checkLatest: false checkLatest: false
}); });
distribution['getPlatformOption'] = () => 'linux'; distribution['getPlatformOption'] = () => 'linux';
// Override extension for linux default arch case to match util behavior const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=tar.gz&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
await distribution['getAvailableVersions'](); await distribution['getAvailableVersions']();

View File

@ -126,9 +126,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',

View File

@ -81,6 +81,6 @@ outputs:
cache-hit: cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key' description: 'A boolean value to indicate an exact match was found for the primary key'
runs: runs:
using: 'node24' using: 'node20'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
post: 'dist/cleanup/index.js' post: 'dist/cleanup/index.js'

25
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "setup-java", "name": "setup-java",
"version": "5.0.0", "version": "4.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-java", "name": "setup-java",
"version": "5.0.0", "version": "4.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^4.0.3", "@actions/cache": "^4.0.3",
@ -21,7 +21,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^24.1.0", "@types/node": "^20.11.24",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.35.1", "@typescript-eslint/eslint-plugin": "^8.35.1",
"@typescript-eslint/parser": "^8.35.1", "@typescript-eslint/parser": "^8.35.1",
@ -35,9 +35,6 @@
"prettier": "^2.8.4", "prettier": "^2.8.4",
"ts-jest": "^29.3.0", "ts-jest": "^29.3.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
},
"engines": {
"node": ">=24.0.0"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {
@ -1647,12 +1644,11 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.1.0", "version": "20.11.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz",
"integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==",
"license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~7.8.0" "undici-types": "~5.26.4"
} }
}, },
"node_modules/@types/node-fetch": { "node_modules/@types/node-fetch": {
@ -5514,10 +5510,9 @@
} }
}, },
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "7.8.0", "version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
"license": "MIT"
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.0.13", "version": "1.0.13",

View File

@ -1,12 +1,9 @@
{ {
"name": "setup-java", "name": "setup-java",
"version": "5.0.0", "version": "4.0.0",
"private": true, "private": true,
"description": "setup java action", "description": "setup java action",
"main": "dist/setup/index.js", "main": "dist/setup/index.js",
"engines": {
"node": ">=24.0.0"
},
"scripts": { "scripts": {
"build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts", "build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"", "format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
@ -41,7 +38,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^24.1.0", "@types/node": "^20.11.24",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.35.1", "@typescript-eslint/eslint-plugin": "^8.35.1",
"@typescript-eslint/parser": "^8.35.1", "@typescript-eslint/parser": "^8.35.1",