mirror of
https://github.com/actions/setup-java.git
synced 2025-08-19 11:21:02 +00:00
Merge 09fb09208a
into e9343db97e
This commit is contained in:
commit
1dc98fcdb2
22 changed files with 98 additions and 61 deletions
2
.github/workflows/basic-validation.yml
vendored
2
.github/workflows/basic-validation.yml
vendored
|
@ -16,4 +16,4 @@ jobs:
|
|||
name: Basic validation
|
||||
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
|
||||
with:
|
||||
node-version: '20.x'
|
||||
node-version: '24.x'
|
||||
|
|
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
|
@ -16,4 +16,4 @@ jobs:
|
|||
name: Check dist/
|
||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||
with:
|
||||
node-version: '20.x'
|
||||
node-version: '24.x'
|
||||
|
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
id: setup-java
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
java-version: '17'
|
||||
cache: gradle
|
||||
cache-dependency-path: __tests__/cache/gradle1/*.gradle*
|
||||
- name: Create files to cache
|
||||
|
|
2
.github/workflows/e2e-cache.yml
vendored
2
.github/workflows/e2e-cache.yml
vendored
|
@ -30,7 +30,7 @@ jobs:
|
|||
id: setup-java
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
java-version: '17'
|
||||
cache: gradle
|
||||
- name: Create files to cache
|
||||
# Need to avoid using Gradle daemon to stabilize the save process on Windows
|
||||
|
|
2
.licenses/npm/@types/node.dep.yml
generated
2
.licenses/npm/@types/node.dep.yml
generated
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
name: "@types/node"
|
||||
version: 20.11.24
|
||||
version: 24.1.0
|
||||
type: npm
|
||||
summary: TypeScript definitions for node
|
||||
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
|
||||
|
|
6
.licenses/npm/undici-types.dep.yml
generated
6
.licenses/npm/undici-types.dep.yml
generated
|
@ -1,15 +1,17 @@
|
|||
---
|
||||
name: undici-types
|
||||
version: 5.26.5
|
||||
version: 7.8.0
|
||||
type: npm
|
||||
summary: A stand-alone types package for Undici
|
||||
homepage: https://undici.nodejs.org
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License
|
||||
|
||||
Copyright (c) Matteo Collina and Undici contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
|
|
|
@ -191,7 +191,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const installerOptions: JavaInstallerOptions = {
|
||||
version: '17',
|
||||
|
|
|
@ -287,7 +287,7 @@ describe('setupJava', () => {
|
|||
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
||||
spyCoreSetOutput.mockImplementation(() => undefined);
|
||||
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x86');
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -203,28 +203,26 @@ describe('getAvailableVersions', () => {
|
|||
});
|
||||
|
||||
it.each([
|
||||
['arm64', 'aarch64'],
|
||||
['amd64', 'x64']
|
||||
['amd64', 'x64'],
|
||||
['arm64', 'aarch64']
|
||||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const version = '17';
|
||||
const installerOptions: JavaInstallerOptions = {
|
||||
version,
|
||||
const distribution = new CorrettoDistribution({
|
||||
version: '17',
|
||||
architecture: '', // to get default value
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
};
|
||||
|
||||
const distribution = new CorrettoDistribution(installerOptions);
|
||||
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 availableVersion = await distribution['findPackageForDownload'](
|
||||
version
|
||||
'17'
|
||||
);
|
||||
expect(availableVersion).not.toBeNull();
|
||||
expect(availableVersion.url).toBe(expectedLink);
|
||||
|
|
|
@ -98,31 +98,35 @@ describe('findPackageForDownload', () => {
|
|||
});
|
||||
|
||||
it.each([
|
||||
['amd64', 'x64'],
|
||||
['arm64', 'aarch64']
|
||||
['amd64', ['x64', 'amd64']],
|
||||
['arm64', ['aarch64', 'arm64']]
|
||||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest.spyOn(os, 'platform').mockReturnValue('linux');
|
||||
async (osArch: string, distroArchs: string[]) => {
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const version = '21';
|
||||
const distro = new GraalVMDistribution({
|
||||
version,
|
||||
const distribution = new GraalVMDistribution({
|
||||
version: '21',
|
||||
architecture: '', // to get default value
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
const osType = distribution.getPlatform();
|
||||
if (osType === 'windows' && distroArch == 'aarch64') {
|
||||
if (osType === 'windows' && distroArchs.includes('aarch64')) {
|
||||
return; // skip, aarch64 is not available for Windows
|
||||
}
|
||||
const archiveType = getDownloadArchiveExtension();
|
||||
const result = await distro['findPackageForDownload'](version);
|
||||
const expectedUrl = `https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${osType}-${distroArch}_bin.${archiveType}`;
|
||||
const result = await distribution['findPackageForDownload']('21');
|
||||
|
||||
expect(result.url).toBe(expectedUrl);
|
||||
const expectedUrls = distroArchs.map(
|
||||
distroArch =>
|
||||
`https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${osType}-${distroArch}_bin.${archiveType}`
|
||||
);
|
||||
|
||||
expect(expectedUrls).toContain(result.url);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -105,9 +105,11 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: DistroArch) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const distribution = new LibericaDistributions({
|
||||
const distributions = new LibericaDistributions({
|
||||
version: '17',
|
||||
architecture: '', // to get default value
|
||||
packageType: 'jdk',
|
||||
|
@ -117,11 +119,11 @@ describe('getAvailableVersions', () => {
|
|||
const additionalParams =
|
||||
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
|
||||
'updateVersion%2CbuildVersion';
|
||||
distribution['getPlatformOption'] = () => 'macos';
|
||||
distributions['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}`;
|
||||
|
||||
await distribution['getAvailableVersions']();
|
||||
await distributions['getAvailableVersions']();
|
||||
|
||||
expect(spyHttpClient.mock.calls).toHaveLength(1);
|
||||
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
|
||||
|
|
|
@ -105,7 +105,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: DistroArch) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const distribution = new LibericaDistributions({
|
||||
version: '17',
|
||||
|
|
|
@ -105,7 +105,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: DistroArch) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const distribution = new LibericaDistributions({
|
||||
version: '17',
|
||||
|
|
|
@ -95,7 +95,9 @@ describe('findPackageForDownload', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
jest.spyOn(os, 'platform').mockReturnValue('darwin');
|
||||
|
||||
const version = '17';
|
||||
|
@ -119,7 +121,9 @@ describe('findPackageForDownload', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
jest.spyOn(os, 'platform').mockReturnValue('linux');
|
||||
|
||||
const version = '17';
|
||||
|
@ -143,7 +147,9 @@ describe('findPackageForDownload', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32');
|
||||
|
||||
const version = '17';
|
||||
|
|
|
@ -95,7 +95,9 @@ describe('findPackageForDownload', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
jest.spyOn(os, 'platform').mockReturnValue('linux');
|
||||
|
||||
const version = '18';
|
||||
|
|
|
@ -147,7 +147,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(distroArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const installerOptions: JavaInstallerOptions = {
|
||||
version: '17',
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {HttpClient} from '@actions/http-client';
|
||||
import * as semver from 'semver';
|
||||
import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||
import * as utils from '../../src/util';
|
||||
|
@ -126,7 +125,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: DistroArch) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const distribution = new ZuluDistribution({
|
||||
version: '17',
|
||||
|
|
|
@ -126,7 +126,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: DistroArch) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const distribution = new ZuluDistribution({
|
||||
version: '17',
|
||||
|
@ -135,7 +137,9 @@ describe('getAvailableVersions', () => {
|
|||
checkLatest: false
|
||||
});
|
||||
distribution['getPlatformOption'] = () => 'linux';
|
||||
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`;
|
||||
// Override extension for linux default arch case to match util behavior
|
||||
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']();
|
||||
|
||||
|
|
|
@ -126,7 +126,9 @@ describe('getAvailableVersions', () => {
|
|||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: DistroArch) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
||||
jest
|
||||
.spyOn(os, 'arch')
|
||||
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const distribution = new ZuluDistribution({
|
||||
version: '17',
|
||||
|
|
|
@ -81,6 +81,6 @@ outputs:
|
|||
cache-hit:
|
||||
description: 'A boolean value to indicate an exact match was found for the primary key'
|
||||
runs:
|
||||
using: 'node20'
|
||||
using: 'node24'
|
||||
main: 'dist/setup/index.js'
|
||||
post: 'dist/cleanup/index.js'
|
||||
|
|
25
package-lock.json
generated
25
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "setup-java",
|
||||
"version": "4.0.0",
|
||||
"version": "5.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "setup-java",
|
||||
"version": "4.0.0",
|
||||
"version": "5.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.0.3",
|
||||
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^20.11.24",
|
||||
"@types/node": "^24.1.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
||||
"@typescript-eslint/parser": "^8.35.1",
|
||||
|
@ -35,6 +35,9 @@
|
|||
"prettier": "^2.8.4",
|
||||
"ts-jest": "^29.3.0",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
|
@ -1644,11 +1647,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.11.24",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz",
|
||||
"integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==",
|
||||
"version": "24.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
|
||||
"integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
"undici-types": "~7.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
|
@ -5510,9 +5514,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
|
||||
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.0.13",
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
{
|
||||
"name": "setup-java",
|
||||
"version": "4.0.0",
|
||||
"version": "5.0.0",
|
||||
"private": true,
|
||||
"description": "setup java action",
|
||||
"main": "dist/setup/index.js",
|
||||
"engines": {
|
||||
"node": ">=24.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"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}\"",
|
||||
|
@ -38,7 +41,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^20.11.24",
|
||||
"@types/node": "^24.1.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
||||
"@typescript-eslint/parser": "^8.35.1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue