Skip to content

Commit

Permalink
Support Tencent Kona JDK (actions#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang committed Aug 14, 2024
1 parent 67fbd72 commit 9871695
Show file tree
Hide file tree
Showing 9 changed files with 726 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/e2e-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ jobs:
'microsoft',
'semeru',
'corretto',
'dragonwell'
'dragonwell',
'kona'
] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['21', '11', '17']
exclude:
- distribution: microsoft
version: 8
- distribution: dragonwell
os: macos-13
- distribution: kona
version: 21
include:
- distribution: oracle
os: macos-13
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Currently, the following distributions are supported:
| `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) |
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/)
| `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.

Expand Down Expand Up @@ -257,6 +258,7 @@ In the example above multiple JDKs are installed for the same job. The result af
- [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto)
- [Oracle](docs/advanced-usage.md#Oracle)
- [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
- [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 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)
Expand Down
122 changes: 122 additions & 0 deletions __tests__/data/kona.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"8": [
{
"version": "8.0.19",
"jdkVersion": "8u422",
"latest": true,
"baseUrl": "https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/",
"files": [
{
"os": "linux",
"arch": "aarch64",
"filename": "TencentKona8.0.19.b1_jdk_linux-aarch64_8u422.tar.gz",
"checksum": "ef031cc28012413ee771c318c6986bfb1dd80b16962ae073d775e269397f6580"
},
{
"os": "linux",
"arch": "x86_64",
"filename": "TencentKona8.0.19.b1_jdk_linux-x86_64_8u422.tar.gz",
"checksum": "57866cb132fc551028257dd1a6ad65650ca0436a1811f30c53ad67844e35c781"
},
{
"os": "macos",
"arch": "aarch64",
"filename": "TencentKona8.0.19.b1_jdk_macosx-aarch64_8u422_notarized.tar.gz",
"checksum": "4c9c169b983fc0b1fd2bbcdd40daa410c72c10ad360d6a61957270c9bdbd96d9"
},
{
"os": "macos",
"arch": "x86_64",
"filename": "TencentKona8.0.19.b1_jdk_macosx-x86_64_8u422_notarized.tar.gz",
"checksum": "9f9be00fb2259bc6ea0b117cb96041b12b39fdf537991af75e9e475e73c6b40f"
},
{
"os": "windows",
"arch": "x86_64",
"filename": "TencentKona8.0.19.b1_jdk_windows-x86_64_8u422_signed.zip",
"checksum": "afc16c4d048f6c90099841e16ad50314ae710340ec057ef19c845f5d43b6ee9e"
}
]
}
],
"11": [
{
"version": "11.0.24",
"jdkVersion": "11.0.24",
"latest": true,
"baseUrl": "https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/",
"files": [
{
"os": "linux",
"arch": "aarch64",
"filename": "TencentKona-11.0.24.b1-jdk_linux-aarch64.tar.gz",
"checksum": "505aa9e39c6fd9dab20443c0b4ed8fb1fedb40109c52b00edeaa7774c6fe9de9"
},
{
"os": "linux",
"arch": "x86_64",
"filename": "TencentKona-11.0.24.b1-jdk_linux-x86_64.tar.gz",
"checksum": "63ff8d821a2b0eef02aa257a959e53150e02865f8eb143feca1b40179d94a3f3"
},
{
"os": "macos",
"arch": "aarch64",
"filename": "TencentKona-11.0.24.b1_jdk_macosx-aarch64_notarized.tar.gz",
"checksum": "e8a6c493a9922fbabc712fa70a50260f001d9202e3370224eabc27adfcf008de"
},
{
"os": "macos",
"arch": "x86_64",
"filename": "TencentKona-11.0.24.b1_jdk_macosx-x86_64_notarized.tar.gz",
"checksum": "c8316cc8388faaa3d898f412a63ef42efbad243a01eaef37f6a19d77e4cd7956"
},
{
"os": "windows",
"arch": "x86_64",
"filename": "TencentKona-11.0.24.b1_jdk_windows-x86_64_signed.zip",
"checksum": "222b135f637af85e3092921a9c9bfc45a743944c179e4170d93e4eea82165858"
}
]
}
],
"17": [
{
"version": "17.0.12",
"jdkVersion": "17.0.12",
"latest": true,
"baseUrl": "https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/",
"files": [
{
"os": "linux",
"arch": "aarch64",
"filename": "TencentKona-17.0.12.b1-jdk_linux-aarch64.tar.gz",
"checksum": "bf65e9b3ab5781a5bb9ddfe5a6032efa8f099f48d85b5dcec686e5a4c0647fea"
},
{
"os": "linux",
"arch": "x86_64",
"filename": "TencentKona-17.0.12.b1-jdk_linux-x86_64.tar.gz",
"checksum": "b8b6706c3710777240696c672168c8065d7a77c2199238ace7caffe353deab27"
},
{
"os": "macos",
"arch": "aarch64",
"filename": "TencentKona-17.0.12.b1_jdk_macosx-aarch64_notarized.tar.gz",
"checksum": "d1f5653e2e8c7a0febeeadd13d7f4270076c0b4bde3785d4a93a9444c69800b5"
},
{
"os": "macos",
"arch": "x86_64",
"filename": "TencentKona-17.0.12.b1_jdk_macosx-x86_64_notarized.tar.gz",
"checksum": "870678cabbabd6970e8f9d0a7fafa8d87597f71d9f581d0f0d103879101e97bc"
},
{
"os": "windows",
"arch": "x86_64",
"filename": "TencentKona-17.0.12.b1_jdk_windows-x86_64_signed.zip",
"checksum": "0a0bc7c10cd9d0852f368674d02ee6d39200ef4d8857904004b677a15937e412"
}
]
}
]
}
189 changes: 189 additions & 0 deletions __tests__/distributors/kona-installer.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
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.19', 'macos', 'x86_64', 'macosx-x86_64'],
['11', 'linux', 'x86_64', 'linux-x86_64'],
['11.0.24', 'macos', 'aarch64', 'macosx-aarch64'],
['17.0.12', 'windows', 'x86_64', 'windows-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(3);
releases.forEach((release, index) =>
expect(releases[index].downloadUrl).toContain(expectedPattern)
);
}
);
});

describe('Check findPackageForDownload', () => {
it.each([
[
'8',
'linux',
'aarch64',
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_linux-aarch64_8u422.tar.gz'
],
[
'8.0.19',
'linux',
'x86_64',
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_linux-x86_64_8u422.tar.gz'
],
[
'8.0.19',
'macos',
'aarch64',
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_macosx-aarch64_8u422_notarized.tar.gz'
],
[
'8.0.19',
'macos',
'x86_64',
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_macosx-x86_64_8u422_notarized.tar.gz'
],
[
'8.0.19',
'windows',
'x86_64',
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_windows-x86_64_8u422_signed.zip'
],

[
'11',
'linux',
'aarch64',
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1-jdk_linux-aarch64.tar.gz'
],
[
'11.0.24',
'linux',
'x86_64',
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1-jdk_linux-x86_64.tar.gz'
],
[
'11.0.24',
'macos',
'aarch64',
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1_jdk_macosx-aarch64_notarized.tar.gz'
],
[
'11.0.24',
'macos',
'x86_64',
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1_jdk_macosx-x86_64_notarized.tar.gz'
],
[
'11.0.24',
'windows',
'x86_64',
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1_jdk_windows-x86_64_signed.zip'
],

[
'17',
'linux',
'aarch64',
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1-jdk_linux-aarch64.tar.gz'
],
[
'17.0.12',
'linux',
'x86_64',
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1-jdk_linux-x86_64.tar.gz'
],
[
'17.0.12',
'macos',
'aarch64',
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1_jdk_macosx-aarch64_notarized.tar.gz'
],
[
'17.0.12',
'macos',
'x86_64',
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1_jdk_macosx-x86_64_notarized.tar.gz'
],
[
'17.0.12',
'windows',
'x86_64',
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.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'],
['17', 'solaris', 'x86_64'],
['21', 'linux', '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.19';
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');
});
});
Loading

0 comments on commit 9871695

Please sign in to comment.