Add support for Liberica JDK (#225)

This commit is contained in:
Даниил Разоренов
2021-11-29 12:15:06 +03:00
committed by GitHub
parent ae26cabe43
commit d61af71edf
10 changed files with 2788 additions and 1793 deletions

View File

@ -0,0 +1,434 @@
[
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-macos-amd64.zip",
"interimVersion": 0,
"version": "14+36",
"featureVersion": 14
},
{
"buildVersion": 9,
"updateVersion": 11,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.11+9/bellsoft-jdk11.0.11+9-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.11+9",
"featureVersion": 11
},
{
"buildVersion": 8,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.1+8/bellsoft-jdk14.0.1+8-macos-amd64.zip",
"interimVersion": 0,
"version": "14.0.1+8",
"featureVersion": 14
},
{
"buildVersion": 10,
"updateVersion": 262,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u262+10/bellsoft-jdk8u262+10-macos-amd64.zip",
"interimVersion": 0,
"version": "8u262+10",
"featureVersion": 8
},
{
"buildVersion": 1,
"updateVersion": 275,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u275+1/bellsoft-jdk8u275+1-macos-amd64.zip",
"interimVersion": 0,
"version": "8u275+1",
"featureVersion": 8
},
{
"buildVersion": 1,
"updateVersion": 9,
"patchVersion": 1,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.9.1+1",
"featureVersion": 11
},
{
"buildVersion": 8,
"updateVersion": 202,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u202/bellsoft-jdk8u202-macos-amd64.zip",
"interimVersion": 0,
"version": "8u202+8",
"featureVersion": 8
},
{
"buildVersion": 33,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12/bellsoft-jdk12-macos-amd64.zip",
"interimVersion": 0,
"version": "12+33",
"featureVersion": 12
},
{
"buildVersion": 8,
"updateVersion": 282,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jdk8u282+8-macos-amd64.zip",
"interimVersion": 0,
"version": "8u282+8",
"featureVersion": 8
},
{
"buildVersion": 11,
"updateVersion": 9,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+11/bellsoft-jdk11.0.9+11-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.9+11",
"featureVersion": 11
},
{
"buildVersion": 33,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13/bellsoft-jdk13-macos-amd64.zip",
"interimVersion": 0,
"version": "13+33",
"featureVersion": 13
},
{
"buildVersion": 12,
"updateVersion": 9,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+12/bellsoft-jdk11.0.9+12-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.9+12",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 242,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u242+7/bellsoft-jdk8u242+7-macos-amd64.zip",
"interimVersion": 0,
"version": "8u242+7",
"featureVersion": 8
},
{
"buildVersion": 9,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.2+9/bellsoft-jdk13.0.2+9-macos-amd64.zip",
"interimVersion": 0,
"version": "13.0.2+9",
"featureVersion": 13
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1/bellsoft-jdk13.0.1-macos-amd64.zip",
"interimVersion": 0,
"version": "13.0.1+9",
"featureVersion": 13
},
{
"buildVersion": 1,
"updateVersion": 265,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u265+1/bellsoft-jdk8u265+1-macos-amd64.zip",
"interimVersion": 0,
"version": "8u265+1",
"featureVersion": 8
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.1+9/bellsoft-jdk15.0.1+9-macos-amd64.zip",
"interimVersion": 0,
"version": "15.0.1+9",
"featureVersion": 15
},
{
"buildVersion": 10,
"updateVersion": 272,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u272+10/bellsoft-jdk8u272+10-macos-amd64.zip",
"interimVersion": 0,
"version": "8u272+10",
"featureVersion": 8
},
{
"buildVersion": 7,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.2+7/bellsoft-jdk16.0.2+7-macos-amd64.zip",
"interimVersion": 0,
"version": "16.0.2+7",
"featureVersion": 16
},
{
"buildVersion": 10,
"updateVersion": 6,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.6+10/bellsoft-jdk11.0.6+10-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.6+10",
"featureVersion": 11
},
{
"buildVersion": 9,
"updateVersion": 252,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jdk8u252+9-macos-amd64.zip",
"interimVersion": 0,
"version": "8u252+9",
"featureVersion": 8
},
{
"buildVersion": 12,
"updateVersion": 212,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u212/bellsoft-jdk8u212-macos-amd64.zip",
"interimVersion": 0,
"version": "8u212+12",
"featureVersion": 8
},
{
"buildVersion": 10,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+10/bellsoft-jdk15.0.2+10-macos-amd64.zip",
"interimVersion": 0,
"version": "15.0.2+10",
"featureVersion": 15
},
{
"buildVersion": 9,
"updateVersion": 10,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.10+9/bellsoft-jdk11.0.10+9-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.10+9",
"featureVersion": 11
},
{
"buildVersion": 0,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.1/bellsoft-jdk11.0.1-macos-amd64.tar.gz",
"interimVersion": 0,
"version": "11.0.1+0",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 12,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.12+7/bellsoft-jdk11.0.12+7-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.12+7",
"featureVersion": 11
},
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16+36/bellsoft-jdk16+36-macos-amd64.zip",
"interimVersion": 0,
"version": "16+36",
"featureVersion": 16
},
{
"buildVersion": 12,
"updateVersion": 3,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.3/bellsoft-jdk11.0.3-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.3+12",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 8,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.8+10/bellsoft-jdk11.0.8+10-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.8+10",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.2/bellsoft-jdk11.0.2-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.2+7",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5/bellsoft-jdk11.0.5-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.5+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 4,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.4/bellsoft-jdk11.0.4-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.4+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.2/bellsoft-jdk12.0.2-macos-amd64.zip",
"interimVersion": 0,
"version": "12.0.2+10",
"featureVersion": 12
},
{
"buildVersion": 12,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.1/bellsoft-jdk12.0.1-macos-amd64.zip",
"interimVersion": 0,
"version": "12.0.1+12",
"featureVersion": 12
},
{
"buildVersion": 10,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1+10/bellsoft-jdk13.0.1+10-macos-amd64.zip",
"interimVersion": 0,
"version": "13.0.1+10",
"featureVersion": 13
},
{
"buildVersion": 11,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-macos-amd64.tar.gz",
"interimVersion": 0,
"version": "11.0.5+11",
"featureVersion": 11
},
{
"buildVersion": 11,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.5+11",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 292,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u292+10/bellsoft-jdk8u292+10-macos-amd64.zip",
"interimVersion": 0,
"version": "8u292+10",
"featureVersion": 8
},
{
"buildVersion": 11,
"updateVersion": 222,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u222/bellsoft-jdk8u222-macos-amd64.zip",
"interimVersion": 0,
"version": "8u222+11",
"featureVersion": 8
},
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15+36/bellsoft-jdk15+36-macos-amd64.zip",
"interimVersion": 0,
"version": "15+36",
"featureVersion": 15
},
{
"buildVersion": 10,
"updateVersion": 7,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.7+10/bellsoft-jdk11.0.7+10-macos-amd64.zip",
"interimVersion": 0,
"version": "11.0.7+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 232,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232+10/bellsoft-jdk8u232+10-macos-amd64.zip",
"interimVersion": 0,
"version": "8u232+10",
"featureVersion": 8
},
{
"buildVersion": 8,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+8/bellsoft-jdk15.0.2+8-macos-amd64.zip",
"interimVersion": 0,
"version": "15.0.2+8",
"featureVersion": 15
},
{
"buildVersion": 8,
"updateVersion": 302,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u302+8/bellsoft-jdk8u302+8-macos-amd64.zip",
"interimVersion": 0,
"version": "8u302+8",
"featureVersion": 8
},
{
"buildVersion": 12,
"updateVersion": 192,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u192.all/bellsoft-jdk1.8.0-macos-amd64.tar.gz",
"interimVersion": 0,
"version": "8u192+12",
"featureVersion": 8
},
{
"buildVersion": 13,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.2+13/bellsoft-jdk14.0.2+13-macos-amd64.zip",
"interimVersion": 0,
"version": "14.0.2+13",
"featureVersion": 14
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.1+9/bellsoft-jdk16.0.1+9-macos-amd64.zip",
"interimVersion": 0,
"version": "16.0.1+9",
"featureVersion": 16
},
{
"buildVersion": 9,
"updateVersion": 232,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232/bellsoft-jdk8u232-macos-amd64.zip",
"interimVersion": 0,
"version": "8u232+9",
"featureVersion": 8
}
]

View File

@ -0,0 +1,196 @@
import { LibericaDistributions } from '../../src/distributions/liberica/installer';
import { ArchitectureOptions, LibericaVersion } from '../../src/distributions/liberica/models';
import { HttpClient } from '@actions/http-client';
const manifestData = require('../data/liberica.json') as LibericaVersion[];
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: manifestData
});
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
it.each([
[
{ version: '11.x', architecture: 'x86', packageType: 'jdk', checkLatest: false },
'bundle-type=jdk&bitness=32&arch=x86&build-type=all'
],
[
{ version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false },
'bundle-type=jdk&bitness=32&arch=x86&build-type=ea'
],
[
{ version: '16.0.2', architecture: 'x64', packageType: 'jdk', checkLatest: false },
'bundle-type=jdk&bitness=64&arch=x86&build-type=all'
],
[
{ version: '16.0.2', architecture: 'x64', packageType: 'jre', checkLatest: false },
'bundle-type=jre&bitness=64&arch=x86&build-type=all'
],
[
{ version: '8', architecture: 'armv7', packageType: 'jdk+fx', checkLatest: false },
'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all'
],
[
{ version: '8', architecture: 'aarch64', packageType: 'jre+fx', checkLatest: false },
'bundle-type=jre-full&bitness=64&arch=arm&build-type=all'
]
])('build correct url for %s -> %s', async (input, urlParams) => {
const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion';
const distribution = new LibericaDistributions(input);
distribution['getPlatformOption'] = () => 'macos';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&${urlParams}${additionalParams}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
it('load available versions', async () => {
const distribution = new LibericaDistributions({
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).toEqual(manifestData);
});
});
describe('getArchitectureOptions', () => {
it.each([
['x86', { bitness: '32', arch: 'x86' }],
['x64', { bitness: '64', arch: 'x86' }],
['armv7', { bitness: '32', arch: 'arm' }],
['aarch64', { bitness: '64', arch: 'arm' }],
['ppc64le', { bitness: '64', arch: 'ppc' }]
] as [string, ArchitectureOptions][])('parse architecture %s -> %s', (input, expected) => {
const distributions = new LibericaDistributions({
architecture: input,
checkLatest: false,
packageType: '',
version: ''
});
expect(distributions['getArchitectureOptions']()).toEqual(expected);
});
it.each(['armv6', 's390x'])('not support architecture %s', input => {
const distributions = new LibericaDistributions({
architecture: input,
checkLatest: false,
packageType: '',
version: ''
});
expect(() => distributions['getArchitectureOptions']()).toThrow(
/Architecture '\w+' is not supported\. Supported architectures: .*/
);
});
});
describe('findPackageForDownload', () => {
let distribution: LibericaDistributions;
beforeEach(() => {
distribution = new LibericaDistributions({
version: '',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
});
it.each([
['8', '8.0.302+8'],
['11.x', '11.0.12+7'],
['8.0', '8.0.302+8'],
['11.0.x', '11.0.12+7'],
['15', '15.0.2+10'],
['15.0', '15.0.2+10'],
['15.0.0', '15.0.0+36'],
['8.0.232', '8.0.232+10'],
['8.0.232+9', '8.0.232+9'],
['15.0.2+8', '15.0.2+8'],
['15.0.2+10', '15.0.2+10']
])('version is %s -> %s', async (input, expected) => {
const result = await distribution['findPackageForDownload'](input);
expect(result.version).toBe(expected);
});
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
/Could not find satisfied version for semver */
);
});
});
describe('getPlatformOption', () => {
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
packageType: 'jdk',
checkLatest: false
});
it.each([
['linux', 'linux'],
['darwin', 'macos'],
['win32', 'windows'],
['cygwin', 'windows'],
['sunos', 'solaris']
])('os version %s -> %s', (input, expected) => {
const actual = distributions['getPlatformOption'](input as NodeJS.Platform);
expect(actual).toEqual(expected);
});
it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])(
'not support os version %s',
input => {
expect(() => distributions['getPlatformOption'](input as NodeJS.Platform)).toThrow(
/Platform '\w+' is not supported\. Supported platforms: .+/
);
}
);
});
describe('convertVersionToSemver', () => {
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
packageType: 'jdk',
checkLatest: false
});
it.each([
[{ featureVersion: 11, interimVersion: 0, updateVersion: 12, buildVersion: 7 }, '11.0.12+7'],
[{ featureVersion: 11, interimVersion: 0, updateVersion: 12, buildVersion: 0 }, '11.0.12'],
[{ featureVersion: 11, interimVersion: 0, updateVersion: 0, buildVersion: 13 }, '11.0.0+13']
])('%s -> %s', (input, expected) => {
const actual = distributions['convertVersionToSemver']({
downloadUrl: '',
version: '',
...input
});
expect(actual).toEqual(expected);
});
});