mirror of
https://github.com/actions/setup-java.git
synced 2025-02-20 16:40:26 +00:00
Support Tencent Kona JDK (#672)
Signed-off-by: John Jiang <johnsjiang@tencent.com>
This commit is contained in:
parent
3a4f6e1af5
commit
6dd1e447fc
10 changed files with 4395 additions and 3617 deletions
3
.github/workflows/e2e-versions.yml
vendored
3
.github/workflows/e2e-versions.yml
vendored
|
@ -32,7 +32,8 @@ jobs:
|
||||||
'corretto',
|
'corretto',
|
||||||
'dragonwell',
|
'dragonwell',
|
||||||
'sapmachine',
|
'sapmachine',
|
||||||
'jetbrains'
|
'jetbrains',
|
||||||
|
'kona'
|
||||||
] # internally 'adopt-hotspot' is the same as 'adopt'
|
] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||||
version: ['21', '11', '17']
|
version: ['21', '11', '17']
|
||||||
exclude:
|
exclude:
|
||||||
|
|
|
@ -111,6 +111,7 @@ Currently, the following distributions are supported:
|
||||||
| `sapmachine` | SAP SapMachine JDK/JRE | [Link](https://sapmachine.io/) | [Link](https://github.com/SAP/SapMachine/blob/sapmachine/LICENSE)
|
| `sapmachine` | SAP SapMachine JDK/JRE | [Link](https://sapmachine.io/) | [Link](https://github.com/SAP/SapMachine/blob/sapmachine/LICENSE)
|
||||||
| `graalvm` | Oracle GraalVM | [Link](https://www.graalvm.org/) | [Link](https://www.oracle.com/downloads/licenses/graal-free-license.html)
|
| `graalvm` | Oracle GraalVM | [Link](https://www.graalvm.org/) | [Link](https://www.oracle.com/downloads/licenses/graal-free-license.html)
|
||||||
| `jetbrains` | JetBrains Runtime | [Link](https://github.com/JetBrains/JetBrainsRuntime/) | [Link](https://github.com/JetBrains/JetBrainsRuntime/blob/main/LICENSE)
|
| `jetbrains` | JetBrains Runtime | [Link](https://github.com/JetBrains/JetBrainsRuntime/) | [Link](https://github.com/JetBrains/JetBrainsRuntime/blob/main/LICENSE)
|
||||||
|
| `kona` | Tencent Kona JDK | [Link](https://tencent.github.io/konajdk/) | [Link](https://tencent.github.io/konajdk/LICENSE.txt)
|
||||||
|
|
||||||
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.
|
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.
|
||||||
|
|
||||||
|
@ -262,6 +263,7 @@ In the example above multiple JDKs are installed for the same job. The result af
|
||||||
- [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
|
- [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
|
||||||
- [SapMachine](docs/advanced-usage.md#SapMachine)
|
- [SapMachine](docs/advanced-usage.md#SapMachine)
|
||||||
- [GraalVM](docs/advanced-usage.md#GraalVM)
|
- [GraalVM](docs/advanced-usage.md#GraalVM)
|
||||||
|
- [Tencent Kona](docs/advanced-usage.md#Tencent-Kona)
|
||||||
- [Installing custom Java package type](docs/advanced-usage.md#Installing-custom-Java-package-type)
|
- [Installing custom Java package type](docs/advanced-usage.md#Installing-custom-Java-package-type)
|
||||||
- [Installing custom Java architecture](docs/advanced-usage.md#Installing-custom-Java-architecture)
|
- [Installing custom Java architecture](docs/advanced-usage.md#Installing-custom-Java-architecture)
|
||||||
- [Installing custom Java distribution from local file](docs/advanced-usage.md#Installing-Java-from-local-file)
|
- [Installing custom Java distribution from local file](docs/advanced-usage.md#Installing-Java-from-local-file)
|
||||||
|
|
162
__tests__/data/kona.json
Normal file
162
__tests__/data/kona.json
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
{
|
||||||
|
"8": [
|
||||||
|
{
|
||||||
|
"version": "8.0.20",
|
||||||
|
"jdkVersion": "8u432",
|
||||||
|
"latest": true,
|
||||||
|
"baseUrl": "https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona8.0.20.b1_jdk_linux-aarch64_8u432.tar.gz",
|
||||||
|
"checksum": "8e6ab38b17f98d7ba727037cb49bbd174f3103a6ddacafb1fb7c0231006a80a7"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona8.0.20.b1_jdk_linux-x86_64_8u432.tar.gz",
|
||||||
|
"checksum": "384cdb36b38993f4b7292682a5dfd8d5d33ba7bdbca2d95018d1341c792d2823"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona8.0.20.b1_jdk_macosx-aarch64_8u432_notarized.tar.gz",
|
||||||
|
"checksum": "829c46691a4b519f14fedfcdca32a94d7793d3570c4a51b3a5072cc394619f25"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona8.0.20.b1_jdk_macosx-x86_64_8u432_notarized.tar.gz",
|
||||||
|
"checksum": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "windows",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona8.0.20.b1_jdk_windows-x86_64_8u432_signed.zip",
|
||||||
|
"checksum": "339646817254dbcb5c17904807bbfdeafaa8e4bac9f2aae25434870cdeaba296"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"11": [
|
||||||
|
{
|
||||||
|
"version": "11.0.25",
|
||||||
|
"jdkVersion": "11.0.25",
|
||||||
|
"latest": true,
|
||||||
|
"baseUrl": "https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona-11.0.25.b1-jdk_linux-aarch64.tar.gz",
|
||||||
|
"checksum": "887ca5eeb675dd9b9d22833a8b0c1031ee1a031227d6cf2d8c1920cc585d2b71"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-11.0.25.b1-jdk_linux-x86_64.tar.gz",
|
||||||
|
"checksum": "6642d7cccf98f33b3ec55cdbf77979c614f0d3cbbd282e8d0df52233edc52f9a"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona-11.0.25.b1_jdk_macosx-aarch64_notarized.tar.gz",
|
||||||
|
"checksum": "8f07242d3191a35c3b2fca1122f315518c7312f0155e98ac7ae39ea083f93e21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-11.0.25.b1_jdk_macosx-x86_64_notarized.tar.gz",
|
||||||
|
"checksum": "0832b93d8d8122cb72db85321ddd85c9a6086e0f28327733fc2da3c0ecc9c455"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "windows",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-11.0.25.b1_jdk_windows-x86_64_signed.zip",
|
||||||
|
"checksum": "05c470c5da4b3bc1844117f611ecd241d3ae9e5d01c17ffafffde0f23825aad7"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"17": [
|
||||||
|
{
|
||||||
|
"version": "17.0.13",
|
||||||
|
"jdkVersion": "17.0.13",
|
||||||
|
"latest": true,
|
||||||
|
"baseUrl": "https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona-17.0.13.b1-jdk_linux-aarch64.tar.gz",
|
||||||
|
"checksum": "372411dff5b42f6e419f1dd40772d98141a15c3d180ed1af6f2b49bdbbd32d52"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-17.0.13.b1-jdk_linux-x86_64.tar.gz",
|
||||||
|
"checksum": "b54bb023d1187737b23ca34d0857d2d40822b14e38d28c7948c8ff6b5927e523"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona-17.0.13.b1_jdk_macosx-aarch64_notarized.tar.gz",
|
||||||
|
"checksum": "22f5d296c407fc137e6af9ce275e662346ca82f1a5acfc407247efd8cedf5256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-17.0.13.b1_jdk_macosx-x86_64_notarized.tar.gz",
|
||||||
|
"checksum": "87ace41ac9718f2a9512b24bad0f735bc5ac61b8198b4cd5634199f124883b36"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "windows",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-17.0.13.b1_jdk_windows-x86_64_signed.zip",
|
||||||
|
"checksum": "616089018151e8e5daf8e88276063633a2cb28a718a2afce49bb8fc10541e83d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"21": [
|
||||||
|
{
|
||||||
|
"version": "21.0.5",
|
||||||
|
"jdkVersion": "21.0.5",
|
||||||
|
"latest": true,
|
||||||
|
"baseUrl": "https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona-21.0.5.b1-jdk_linux-aarch64.tar.gz",
|
||||||
|
"checksum": "d8ca108147db3f19134d7aa995bac14e1fb3d124b0300a9a7893266a8f028104"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-21.0.5.b1-jdk_linux-x86_64.tar.gz",
|
||||||
|
"checksum": "afae039d9666fadcb84940c5350b29cd061019b0cc43700f0bf0342320892adf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"filename": "TencentKona-21.0.5.b1_jdk_macosx-aarch64_notarized.tar.gz",
|
||||||
|
"checksum": "7621a218767bfbd3023b176dc6d9dd019677f8efec0d48a4eb2b2ed2b50bd1fb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "macos",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-21.0.5.b1_jdk_macosx-x86_64_notarized.tar.gz",
|
||||||
|
"checksum": "6c54d46f979ad998b708f664c5aeeeef855660ef527d584a7c2930951cca9999"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "windows",
|
||||||
|
"arch": "x86_64",
|
||||||
|
"filename": "TencentKona-21.0.5.b1_jdk_windows-x86_64_signed.zip",
|
||||||
|
"checksum": "ee1ee730fc5e02268d91b9df602b65122dad25b3d3898069331ebc8338005da1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
224
__tests__/distributors/kona-installer.test.ts
Normal file
224
__tests__/distributors/kona-installer.test.ts
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
import {KonaDistribution} from '../../src/distributions/kona/installer';
|
||||||
|
|
||||||
|
import manifestData from '../data/kona.json';
|
||||||
|
|
||||||
|
function mockDistr(
|
||||||
|
version: string,
|
||||||
|
os: string,
|
||||||
|
arch: string,
|
||||||
|
packageType: string
|
||||||
|
): KonaDistribution {
|
||||||
|
const distribution = new KonaDistribution({
|
||||||
|
version: version,
|
||||||
|
architecture: arch,
|
||||||
|
packageType: packageType,
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
distribution['getOs'] = () => os;
|
||||||
|
distribution['fetchReleaseInfo'] = async () => manifestData;
|
||||||
|
|
||||||
|
return distribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Check getAvailableReleases', () => {
|
||||||
|
it.each([
|
||||||
|
['8', 'linux', 'aarch64', 'linux-aarch64'],
|
||||||
|
['8.0.20', 'macos', 'x86_64', 'macosx-x86_64'],
|
||||||
|
['11', 'linux', 'x86_64', 'linux-x86_64'],
|
||||||
|
['11.0.25', 'macos', 'aarch64', 'macosx-aarch64'],
|
||||||
|
['17.0.13', 'windows', 'x86_64', 'windows-x86_64'],
|
||||||
|
['21.0.5', 'linux', 'x86_64', 'linux-x86_64']
|
||||||
|
])(
|
||||||
|
'should get releases with the specified version "%s", OS "%s" and arch "%s"',
|
||||||
|
async (
|
||||||
|
version: string,
|
||||||
|
os: string,
|
||||||
|
arch: string,
|
||||||
|
expectedPattern: string
|
||||||
|
) => {
|
||||||
|
const distribution = mockDistr(version, os, arch, 'jdk');
|
||||||
|
|
||||||
|
const releases = await distribution['getAvailableReleases']();
|
||||||
|
expect(releases).not.toBeNull();
|
||||||
|
expect(releases.length).toBe(4);
|
||||||
|
releases.forEach(release =>
|
||||||
|
expect(release.downloadUrl).toContain(expectedPattern)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Check findPackageForDownload', () => {
|
||||||
|
it.each([
|
||||||
|
[
|
||||||
|
'8',
|
||||||
|
'linux',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_linux-aarch64_8u432.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'8.0.20',
|
||||||
|
'linux',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_linux-x86_64_8u432.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'8.0.20',
|
||||||
|
'macos',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_macosx-aarch64_8u432_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'8.0.20',
|
||||||
|
'macos',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_macosx-x86_64_8u432_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'8.0.20',
|
||||||
|
'windows',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_windows-x86_64_8u432_signed.zip'
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'11',
|
||||||
|
'linux',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1-jdk_linux-aarch64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'11.0.25',
|
||||||
|
'linux',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1-jdk_linux-x86_64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'11.0.25',
|
||||||
|
'macos',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1_jdk_macosx-aarch64_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'11.0.25',
|
||||||
|
'macos',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1_jdk_macosx-x86_64_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'11.0.25',
|
||||||
|
'windows',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1_jdk_windows-x86_64_signed.zip'
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'17',
|
||||||
|
'linux',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1-jdk_linux-aarch64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17.0.13',
|
||||||
|
'linux',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1-jdk_linux-x86_64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17.0.13',
|
||||||
|
'macos',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1_jdk_macosx-aarch64_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17.0.13',
|
||||||
|
'macos',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1_jdk_macosx-x86_64_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17.0.13',
|
||||||
|
'windows',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1_jdk_windows-x86_64_signed.zip'
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'21',
|
||||||
|
'linux',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1-jdk_linux-aarch64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'21.0.5',
|
||||||
|
'linux',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1-jdk_linux-x86_64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'21.0.5',
|
||||||
|
'macos',
|
||||||
|
'aarch64',
|
||||||
|
'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1_jdk_macosx-aarch64_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'21.0.5',
|
||||||
|
'macos',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1_jdk_macosx-x86_64_notarized.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'21.0.5',
|
||||||
|
'windows',
|
||||||
|
'x86_64',
|
||||||
|
'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1_jdk_windows-x86_64_signed.zip'
|
||||||
|
]
|
||||||
|
])(
|
||||||
|
'should return the download URL with the specified version "%s", OS "%s" and arch "%s"',
|
||||||
|
async (version: string, os: string, arch: string, expectedUrl: string) => {
|
||||||
|
const distribution = mockDistr(version, os, arch, 'jdk');
|
||||||
|
|
||||||
|
const availableRelease = await distribution['findPackageForDownload'](
|
||||||
|
version
|
||||||
|
);
|
||||||
|
expect(availableRelease).not.toBeNull();
|
||||||
|
expect(availableRelease.url).toBe(expectedUrl);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('No release is found', () => {
|
||||||
|
it.each([
|
||||||
|
['8', 'linux', 'x86'],
|
||||||
|
['8.0.0', 'linux', 'x86_64'],
|
||||||
|
['11', 'linux', 'ppc64'],
|
||||||
|
['17', 'solaris', 'x86_64'],
|
||||||
|
['17', 'windows', 'aarch64'],
|
||||||
|
['22', 'macos', 'x86_64']
|
||||||
|
])(
|
||||||
|
`should throw an error due to no release with the specified version "%s", os "%s" and arch "%s"`,
|
||||||
|
async (version: string, os: string, arch: string) => {
|
||||||
|
const distribution = mockDistr(version, os, arch, 'jdk');
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload'](version)
|
||||||
|
).rejects.toThrow(
|
||||||
|
`No Kona release for the specified version "${version}" on OS "${os}" and arch "${arch}".`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('The package type must be jdk', () => {
|
||||||
|
it('should throw an error due to the specified package type is not jdk', async () => {
|
||||||
|
const version = '8.0.20';
|
||||||
|
const os = 'linux';
|
||||||
|
const arch = 'x86_64';
|
||||||
|
const distribution = mockDistr(version, os, arch, 'jre');
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload'](version)
|
||||||
|
).rejects.toThrow('Kona provides jdk only');
|
||||||
|
});
|
||||||
|
});
|
2800
dist/cleanup/index.js
vendored
2800
dist/cleanup/index.js
vendored
File diff suppressed because one or more lines are too long
4590
dist/setup/index.js
vendored
4590
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,7 @@
|
||||||
- [SapMachine](#SapMachine)
|
- [SapMachine](#SapMachine)
|
||||||
- [GraalVM](#GraalVM)
|
- [GraalVM](#GraalVM)
|
||||||
- [JetBrains](#JetBrains)
|
- [JetBrains](#JetBrains)
|
||||||
|
- [Tencent Kona](#Tencent-Kona)
|
||||||
- [Installing custom Java package type](#Installing-custom-Java-package-type)
|
- [Installing custom Java package type](#Installing-custom-Java-package-type)
|
||||||
- [Installing custom Java architecture](#Installing-custom-Java-architecture)
|
- [Installing custom Java architecture](#Installing-custom-Java-architecture)
|
||||||
- [Installing custom Java distribution from local file](#Installing-Java-from-local-file)
|
- [Installing custom Java distribution from local file](#Installing-Java-from-local-file)
|
||||||
|
@ -215,19 +216,17 @@ The available package types are:
|
||||||
- `jdk+ft` - JBRSDK (FreeType)
|
- `jdk+ft` - JBRSDK (FreeType)
|
||||||
- `jre+ft` - JBR (FreeType)
|
- `jre+ft` - JBR (FreeType)
|
||||||
|
|
||||||
### GraalVM
|
### Tencent Kona
|
||||||
**NOTE:** Oracle GraalVM is only available for JDK 17 and later.
|
**NOTE:** Tencent Kona supports major versions 8, 11, 17 and 21, and provides jdk only.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'graalvm'
|
distribution: 'kona'
|
||||||
java-version: '21'
|
java-version: '8'
|
||||||
- run: |
|
- run: java -cp java HelloWorldApp
|
||||||
java -cp java HelloWorldApp
|
|
||||||
native-image -cp java HelloWorldApp
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installing custom Java package type
|
## Installing custom Java package type
|
||||||
|
@ -614,12 +613,12 @@ steps:
|
||||||
|
|
||||||
## Java version file
|
## Java version file
|
||||||
If the `java-version-file` input is specified, the action will extract the version from the file and install it.
|
If the `java-version-file` input is specified, the action will extract the version from the file and install it.
|
||||||
|
|
||||||
Supported files are .java-version and .tool-versions.
|
Supported files are .java-version and .tool-versions.
|
||||||
In .java-version file, only the version should be specified (e.g., 17.0.7).
|
In .java-version file, only the version should be specified (e.g., 17.0.7).
|
||||||
In .tool-versions file, java version should be preceded by the java keyword (e.g., java 17.0.7).
|
In .tool-versions file, java version should be preceded by the java keyword (e.g., java 17.0.7).
|
||||||
The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv). Similarly, the `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf) standards, adhering to Semantic Versioning ([semver](https://semver.org/)).
|
The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv). Similarly, the `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf) standards, adhering to Semantic Versioning ([semver](https://semver.org/)).
|
||||||
|
|
||||||
If both java-version and java-version-file inputs are provided, the java-version input will be used.
|
If both java-version and java-version-file inputs are provided, the java-version input will be used.
|
||||||
|
|
||||||
Valid entry options:
|
Valid entry options:
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {DragonwellDistribution} from './dragonwell/installer';
|
||||||
import {SapMachineDistribution} from './sapmachine/installer';
|
import {SapMachineDistribution} from './sapmachine/installer';
|
||||||
import {GraalVMDistribution} from './graalvm/installer';
|
import {GraalVMDistribution} from './graalvm/installer';
|
||||||
import {JetBrainsDistribution} from './jetbrains/installer';
|
import {JetBrainsDistribution} from './jetbrains/installer';
|
||||||
|
import {KonaDistribution} from './kona/installer';
|
||||||
|
|
||||||
enum JavaDistribution {
|
enum JavaDistribution {
|
||||||
Adopt = 'adopt',
|
Adopt = 'adopt',
|
||||||
|
@ -29,7 +30,8 @@ enum JavaDistribution {
|
||||||
Dragonwell = 'dragonwell',
|
Dragonwell = 'dragonwell',
|
||||||
SapMachine = 'sapmachine',
|
SapMachine = 'sapmachine',
|
||||||
GraalVM = 'graalvm',
|
GraalVM = 'graalvm',
|
||||||
JetBrains = 'jetbrains'
|
JetBrains = 'jetbrains',
|
||||||
|
Kona = 'kona'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getJavaDistribution(
|
export function getJavaDistribution(
|
||||||
|
@ -76,6 +78,8 @@ export function getJavaDistribution(
|
||||||
return new GraalVMDistribution(installerOptions);
|
return new GraalVMDistribution(installerOptions);
|
||||||
case JavaDistribution.JetBrains:
|
case JavaDistribution.JetBrains:
|
||||||
return new JetBrainsDistribution(installerOptions);
|
return new JetBrainsDistribution(installerOptions);
|
||||||
|
case JavaDistribution.Kona:
|
||||||
|
return new KonaDistribution(installerOptions);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
183
src/distributions/kona/installer.ts
Normal file
183
src/distributions/kona/installer.ts
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
import {JavaBase} from '../base-installer';
|
||||||
|
import {IKonaReleaseInfo, IKonaRelease} from './models';
|
||||||
|
import {
|
||||||
|
JavaDownloadRelease,
|
||||||
|
JavaInstallerOptions,
|
||||||
|
JavaInstallerResults
|
||||||
|
} from '../base-models';
|
||||||
|
import {
|
||||||
|
extractJdkFile,
|
||||||
|
getDownloadArchiveExtension,
|
||||||
|
isVersionSatisfies
|
||||||
|
} from '../../util';
|
||||||
|
|
||||||
|
export class KonaDistribution extends JavaBase {
|
||||||
|
constructor(installerOptions: JavaInstallerOptions) {
|
||||||
|
super('Kona', installerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async downloadTool(
|
||||||
|
javaRelease: JavaDownloadRelease
|
||||||
|
): Promise<JavaInstallerResults> {
|
||||||
|
core.info(
|
||||||
|
`Downloading Kona JDK ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
|
||||||
|
);
|
||||||
|
const javaArchivePath = await tc.downloadTool(javaRelease.url);
|
||||||
|
|
||||||
|
core.info(`Extracting Java archive...`);
|
||||||
|
|
||||||
|
const extension = getDownloadArchiveExtension();
|
||||||
|
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
|
||||||
|
|
||||||
|
const archiveName = fs.readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path.join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
|
||||||
|
const javaPath = await tc.cacheDir(
|
||||||
|
archivePath,
|
||||||
|
this.toolcacheFolderName,
|
||||||
|
version,
|
||||||
|
this.architecture
|
||||||
|
);
|
||||||
|
|
||||||
|
return {version: javaRelease.version, path: javaPath};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async findPackageForDownload(
|
||||||
|
version: string
|
||||||
|
): Promise<JavaDownloadRelease> {
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('Kona provides stable releases only');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error('Kona provides jdk only');
|
||||||
|
}
|
||||||
|
|
||||||
|
const availableReleases = await this.getAvailableReleases();
|
||||||
|
const releases = availableReleases
|
||||||
|
.filter(item => {
|
||||||
|
return isVersionSatisfies(version, item.version);
|
||||||
|
})
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.version,
|
||||||
|
url: item.downloadUrl
|
||||||
|
} as JavaDownloadRelease;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!releases.length) {
|
||||||
|
throw new Error(
|
||||||
|
`No Kona release for the specified version "${version}" on OS "${this.getOs()}" and arch "${this.getArch()}".`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return releases[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getAvailableReleases(): Promise<IKonaRelease[]> {
|
||||||
|
if (core.isDebug()) {
|
||||||
|
console.time('Retrieving available releases for Kona took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
|
||||||
|
const releaseInfo = await this.fetchReleaseInfo();
|
||||||
|
if (!releaseInfo) {
|
||||||
|
throw new Error(`Couldn't fetch Kona release information`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const availableReleases = this.chooseReleases(
|
||||||
|
this.getOs(),
|
||||||
|
this.getArch(),
|
||||||
|
releaseInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
core.startGroup('Print information about available releases');
|
||||||
|
core.debug(availableReleases.map(item => item.version).join(', '));
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableReleases;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async fetchReleaseInfo(): Promise<IKonaReleaseInfo | null> {
|
||||||
|
const releasesInfoUrl =
|
||||||
|
'https://tencent.github.io/konajdk/releases/kona-v1.json';
|
||||||
|
|
||||||
|
try {
|
||||||
|
core.debug(`Fetching Kona release info from URL: ${releasesInfoUrl}`);
|
||||||
|
return (await this.http.getJson<IKonaReleaseInfo>(releasesInfoUrl))
|
||||||
|
.result;
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(
|
||||||
|
`Fetching Kona release info from the URL: ${releasesInfoUrl} failed with the error: ${
|
||||||
|
(err as Error).message
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private chooseReleases(
|
||||||
|
os: string,
|
||||||
|
arch: string,
|
||||||
|
releaseInfo: IKonaReleaseInfo
|
||||||
|
): IKonaRelease[] {
|
||||||
|
const releases: IKonaRelease[] = [];
|
||||||
|
|
||||||
|
for (const majorVersion in releaseInfo) {
|
||||||
|
const versions = releaseInfo[majorVersion];
|
||||||
|
|
||||||
|
for (const version of versions) {
|
||||||
|
if (!version.latest) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const file of version.files) {
|
||||||
|
if (file.os === os && file.arch === arch) {
|
||||||
|
releases.push({
|
||||||
|
version: version.version,
|
||||||
|
jdkVersion: version.jdkVersion,
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
downloadUrl: version.baseUrl + file.filename,
|
||||||
|
checksum: file.checksum
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getOs(): string {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getArch(): string {
|
||||||
|
switch (this.architecture) {
|
||||||
|
case 'arm64':
|
||||||
|
return 'aarch64';
|
||||||
|
case 'x64':
|
||||||
|
return 'x86_64';
|
||||||
|
default:
|
||||||
|
return this.architecture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
src/distributions/kona/models.ts
Normal file
25
src/distributions/kona/models.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
export interface IKonaReleaseInfo {
|
||||||
|
[majorVersion: string]: {
|
||||||
|
version: string;
|
||||||
|
jdkVersion: string;
|
||||||
|
latest: boolean;
|
||||||
|
|
||||||
|
baseUrl: string;
|
||||||
|
files: {
|
||||||
|
os: string; // linux, macos, windows
|
||||||
|
arch: string; // x86_64, aarch64
|
||||||
|
|
||||||
|
filename: string;
|
||||||
|
checksum: string;
|
||||||
|
}[];
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IKonaRelease {
|
||||||
|
version: string;
|
||||||
|
jdkVersion: string;
|
||||||
|
os: string; // linux, macos, windows
|
||||||
|
arch: string; // x86_64, aarch64
|
||||||
|
downloadUrl: string;
|
||||||
|
checksum: string; // SHA-256 digest
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue