Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
5f00602cd1 | |||
d61af71edf | |||
ae26cabe43 | |||
ee43590bc7 | |||
c187df66d0 |
20
.github/workflows/e2e-versions.yml
vendored
20
.github/workflows/e2e-versions.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu'] # internally 'adopt-hotspot' is the same as 'adopt'
|
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica'] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||||
version: ['8', '11', '16']
|
version: ['8', '11', '16']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -43,7 +43,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'zulu']
|
distribution: ['temurin', 'zulu', 'liberica']
|
||||||
version:
|
version:
|
||||||
- '11.0'
|
- '11.0'
|
||||||
- '8.0.302'
|
- '8.0.302'
|
||||||
@ -69,7 +69,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'zulu']
|
distribution: ['temurin', 'zulu', 'liberica']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@ -136,7 +136,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'zulu']
|
distribution: ['temurin', 'zulu', 'liberica']
|
||||||
java-package: ['jre']
|
java-package: ['jre']
|
||||||
version: ['16.0']
|
version: ['16.0']
|
||||||
include:
|
include:
|
||||||
@ -148,6 +148,14 @@ jobs:
|
|||||||
java-package: jdk+fx
|
java-package: jdk+fx
|
||||||
version: '8.0.242'
|
version: '8.0.242'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
|
- distribution: 'liberica'
|
||||||
|
java-package: jdk+fx
|
||||||
|
version: '8'
|
||||||
|
os: ubuntu-latest
|
||||||
|
- distribution: 'liberica'
|
||||||
|
java-package: jre+fx
|
||||||
|
version: '11'
|
||||||
|
os: ubuntu-latest
|
||||||
exclude:
|
exclude:
|
||||||
# Eclipse Temurin currently doesn't publish JREs, only JDKs
|
# Eclipse Temurin currently doesn't publish JREs, only JDKs
|
||||||
- distribution: 'temurin'
|
- distribution: 'temurin'
|
||||||
@ -173,9 +181,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# Only Zulu provides x86 arch for now and only for windows / ubuntu
|
# Only Zulu and Liberica provides x86 arch for now and only for windows / ubuntu
|
||||||
os: [windows-latest, ubuntu-latest]
|
os: [windows-latest, ubuntu-latest]
|
||||||
distribution: ['zulu']
|
distribution: ['zulu', 'liberica']
|
||||||
version: ['11']
|
version: ['11']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
BIN
.licenses/npm/@actions/cache.dep.yml
generated
BIN
.licenses/npm/@actions/cache.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-http.dep.yml
generated
BIN
.licenses/npm/@azure/core-http.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-lro.dep.yml
generated
BIN
.licenses/npm/@azure/core-lro.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-paging.dep.yml
generated
BIN
.licenses/npm/@azure/core-paging.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-tracing.dep.yml
generated
BIN
.licenses/npm/@azure/core-tracing.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/logger.dep.yml
generated
BIN
.licenses/npm/@azure/logger.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/ms-rest-js.dep.yml
generated
BIN
.licenses/npm/@azure/ms-rest-js.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/storage-blob.dep.yml
generated
BIN
.licenses/npm/@azure/storage-blob.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@opencensus/web-types.dep.yml
generated
BIN
.licenses/npm/@opencensus/web-types.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@opentelemetry/api.dep.yml
generated
BIN
.licenses/npm/@opentelemetry/api.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@types/node-fetch.dep.yml
generated
BIN
.licenses/npm/@types/node-fetch.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@types/tunnel.dep.yml
generated
BIN
.licenses/npm/@types/tunnel.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/form-data-4.0.0.dep.yml
generated
Normal file
BIN
.licenses/npm/form-data-4.0.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/node-fetch.dep.yml
generated
BIN
.licenses/npm/node-fetch.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/tr46.dep.yml
generated
Normal file
BIN
.licenses/npm/tr46.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/webidl-conversions.dep.yml
generated
Normal file
BIN
.licenses/npm/webidl-conversions.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/whatwg-url.dep.yml
generated
Normal file
BIN
.licenses/npm/whatwg-url.dep.yml
generated
Normal file
Binary file not shown.
10
README.md
10
README.md
@ -29,7 +29,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ steps:
|
|||||||
|
|
||||||
#### Supported version syntax
|
#### Supported version syntax
|
||||||
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
|
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
|
||||||
- major versions: `8`, `11`, `16`
|
- major versions: `8`, `11`, `16`, `17`
|
||||||
- more specific versions: `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
|
- more specific versions: `17.0`, `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
|
||||||
- early access (EA) versions: `15-ea`, `15.0.0-ea`, `15.0.0-ea.2`, `15.0.0+2-ea`
|
- early access (EA) versions: `15-ea`, `15.0.0-ea`, `15.0.0-ea.2`, `15.0.0+2-ea`
|
||||||
|
|
||||||
#### Supported distributions
|
#### Supported distributions
|
||||||
@ -57,7 +57,8 @@ Currently, the following distributions are supported:
|
|||||||
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
|
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
|
||||||
| `zulu` | Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
| `zulu` | Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
||||||
| `adopt` or `adopt-hotspot` | Adopt OpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
| `adopt` or `adopt-hotspot` | Adopt OpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
||||||
| `adopt-openj9` | Adopt OpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html)
|
| `adopt-openj9` | Adopt OpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
||||||
|
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
|
||||||
|
|
||||||
**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.
|
||||||
|
|
||||||
@ -134,6 +135,7 @@ jobs:
|
|||||||
- [Eclipse Temurin](docs/advanced-usage.md#Eclipse-Temurin)
|
- [Eclipse Temurin](docs/advanced-usage.md#Eclipse-Temurin)
|
||||||
- [Adopt](docs/advanced-usage.md#Adopt)
|
- [Adopt](docs/advanced-usage.md#Adopt)
|
||||||
- [Zulu](docs/advanced-usage.md#Zulu)
|
- [Zulu](docs/advanced-usage.md#Zulu)
|
||||||
|
- [Liberica](docs/advanced-usage.md#Liberica)
|
||||||
- [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)
|
||||||
|
434
__tests__/data/liberica.json
Normal file
434
__tests__/data/liberica.json
Normal 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
|
||||||
|
}
|
||||||
|
]
|
196
__tests__/distributors/liberica-installer.test.ts
Normal file
196
__tests__/distributors/liberica-installer.test.ts
Normal 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);
|
||||||
|
});
|
||||||
|
});
|
20213
dist/cleanup/index.js
vendored
20213
dist/cleanup/index.js
vendored
File diff suppressed because one or more lines are too long
20663
dist/setup/index.js
vendored
20663
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
@ -53,6 +53,18 @@ steps:
|
|||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Liberica
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '11'
|
||||||
|
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
||||||
|
- run: java -cp java HelloWorldApp
|
||||||
|
```
|
||||||
|
|
||||||
## Installing custom Java package type
|
## Installing custom Java package type
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
5343
package-lock.json
generated
5343
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -24,7 +24,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^1.0.7",
|
"@actions/cache": "^1.0.8",
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/glob": "^0.2.0",
|
"@actions/glob": "^0.2.0",
|
||||||
@ -35,14 +35,14 @@
|
|||||||
"xmlbuilder2": "^2.4.0"
|
"xmlbuilder2": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.20",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/node": "^12.19.13",
|
"@types/node": "^12.19.13",
|
||||||
"@types/semver": "^7.3.4",
|
"@types/semver": "^7.3.4",
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@zeit/ncc": "^0.20.5",
|
||||||
"jest": "^26.6.3",
|
"jest": "^27.2.5",
|
||||||
"jest-circus": "^26.6.3",
|
"jest-circus": "^27.2.5",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"ts-jest": "^26.5.3",
|
"ts-jest": "^27.0.5",
|
||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
|
@ -4,6 +4,7 @@ import { LocalDistribution } from './local/installer';
|
|||||||
import { ZuluDistribution } from './zulu/installer';
|
import { ZuluDistribution } from './zulu/installer';
|
||||||
import { AdoptDistribution, AdoptImplementation } from './adopt/installer';
|
import { AdoptDistribution, AdoptImplementation } from './adopt/installer';
|
||||||
import { TemurinDistribution, TemurinImplementation } from './temurin/installer';
|
import { TemurinDistribution, TemurinImplementation } from './temurin/installer';
|
||||||
|
import { LibericaDistributions } from './liberica/installer';
|
||||||
|
|
||||||
enum JavaDistribution {
|
enum JavaDistribution {
|
||||||
Adopt = 'adopt',
|
Adopt = 'adopt',
|
||||||
@ -11,6 +12,7 @@ enum JavaDistribution {
|
|||||||
AdoptOpenJ9 = 'adopt-openj9',
|
AdoptOpenJ9 = 'adopt-openj9',
|
||||||
Temurin = 'temurin',
|
Temurin = 'temurin',
|
||||||
Zulu = 'zulu',
|
Zulu = 'zulu',
|
||||||
|
Liberica = 'liberica',
|
||||||
JdkFile = 'jdkfile'
|
JdkFile = 'jdkfile'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +33,8 @@ export function getJavaDistribution(
|
|||||||
return new TemurinDistribution(installerOptions, TemurinImplementation.Hotspot);
|
return new TemurinDistribution(installerOptions, TemurinImplementation.Hotspot);
|
||||||
case JavaDistribution.Zulu:
|
case JavaDistribution.Zulu:
|
||||||
return new ZuluDistribution(installerOptions);
|
return new ZuluDistribution(installerOptions);
|
||||||
|
case JavaDistribution.Liberica:
|
||||||
|
return new LibericaDistributions(installerOptions);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
157
src/distributions/liberica/installer.ts
Normal file
157
src/distributions/liberica/installer.ts
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
import { JavaBase } from '../base-installer';
|
||||||
|
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from '../base-models';
|
||||||
|
import semver from 'semver';
|
||||||
|
import { extractJdkFile, getDownloadArchiveExtension, isVersionSatisfies } from '../../util';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import { ArchitectureOptions, LibericaVersion, OsVersions } from './models';
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
|
||||||
|
|
||||||
|
const supportedArchitecture = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
|
||||||
|
|
||||||
|
export class LibericaDistributions extends JavaBase {
|
||||||
|
constructor(installerOptions: JavaInstallerOptions) {
|
||||||
|
super('Liberica', installerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async downloadTool(javaRelease: JavaDownloadRelease): Promise<JavaInstallerResults> {
|
||||||
|
core.info(
|
||||||
|
`Downloading Java ${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 javaPath = await tc.cacheDir(
|
||||||
|
archivePath,
|
||||||
|
this.toolcacheFolderName,
|
||||||
|
this.getToolcacheVersionName(javaRelease.version),
|
||||||
|
this.architecture
|
||||||
|
);
|
||||||
|
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async findPackageForDownload(range: string): Promise<JavaDownloadRelease> {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions();
|
||||||
|
|
||||||
|
const availableVersions = availableVersionsRaw.map(item => ({
|
||||||
|
url: item.downloadUrl,
|
||||||
|
version: this.convertVersionToSemver(item)
|
||||||
|
}));
|
||||||
|
|
||||||
|
const satisfiedVersion = availableVersions
|
||||||
|
.filter(item => isVersionSatisfies(range, item.version))
|
||||||
|
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||||
|
|
||||||
|
if (!satisfiedVersion) {
|
||||||
|
const availableOptions = availableVersions.map(item => item.version).join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return satisfiedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getAvailableVersions(): Promise<LibericaVersion[]> {
|
||||||
|
console.time('liberica-retrieve-available-versions');
|
||||||
|
const url = this.prepareAvailableVersionsUrl();
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
core.debug(`Gathering available versions from '${url}'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const availableVersions = (await this.http.getJson<LibericaVersion[]>(url)).result ?? [];
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
core.startGroup('Print information about available versions');
|
||||||
|
console.timeEnd('liberica-retrieve-available-versions');
|
||||||
|
console.log(`Available versions: [${availableVersions.length}]`);
|
||||||
|
console.log(availableVersions.map(item => item.version));
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private prepareAvailableVersionsUrl() {
|
||||||
|
const urlOptions = {
|
||||||
|
os: this.getPlatformOption(),
|
||||||
|
'bundle-type': this.getBundleType(),
|
||||||
|
...this.getArchitectureOptions(),
|
||||||
|
'build-type': this.stable ? 'all' : 'ea',
|
||||||
|
'installation-type': 'archive',
|
||||||
|
fields: 'downloadUrl,version,featureVersion,interimVersion,updateVersion,buildVersion'
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||||
|
|
||||||
|
return `https://api.bell-sw.com/v1/liberica/releases?${searchParams}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getBundleType(): string {
|
||||||
|
const [bundleType, feature] = this.packageType.split('+');
|
||||||
|
if (feature?.includes('fx')) {
|
||||||
|
return bundleType + '-full';
|
||||||
|
}
|
||||||
|
return bundleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getArchitectureOptions(): ArchitectureOptions {
|
||||||
|
switch (this.architecture) {
|
||||||
|
case 'x86':
|
||||||
|
return { bitness: '32', arch: 'x86' };
|
||||||
|
case 'x64':
|
||||||
|
return { bitness: '64', arch: 'x86' };
|
||||||
|
case 'armv7':
|
||||||
|
return { bitness: '32', arch: 'arm' };
|
||||||
|
case 'aarch64':
|
||||||
|
return { bitness: '64', arch: 'arm' };
|
||||||
|
case 'ppc64le':
|
||||||
|
return { bitness: '64', arch: 'ppc' };
|
||||||
|
default:
|
||||||
|
throw new Error(
|
||||||
|
`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitecture}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getPlatformOption(platform: NodeJS.Platform = process.platform): OsVersions {
|
||||||
|
switch (platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
case 'cygwin':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
return 'linux';
|
||||||
|
case 'sunos':
|
||||||
|
return 'solaris';
|
||||||
|
default:
|
||||||
|
throw new Error(
|
||||||
|
`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private convertVersionToSemver(version: LibericaVersion): string {
|
||||||
|
let { buildVersion, featureVersion, interimVersion, updateVersion } = version;
|
||||||
|
const mainVersion = [featureVersion, interimVersion, updateVersion].join('.');
|
||||||
|
if (buildVersion != 0) {
|
||||||
|
return `${mainVersion}+${buildVersion}`;
|
||||||
|
}
|
||||||
|
return mainVersion;
|
||||||
|
}
|
||||||
|
}
|
20
src/distributions/liberica/models.ts
Normal file
20
src/distributions/liberica/models.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Models from https://api.bell-sw.com/api.html
|
||||||
|
|
||||||
|
export type Bitness = '32' | '64';
|
||||||
|
export type ArchType = 'arm' | 'ppc' | 'sparc' | 'x86';
|
||||||
|
|
||||||
|
export type OsVersions = 'linux' | 'linux-musl' | 'macos' | 'solaris' | 'windows';
|
||||||
|
|
||||||
|
export interface ArchitectureOptions {
|
||||||
|
bitness: Bitness;
|
||||||
|
arch: ArchType;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LibericaVersion {
|
||||||
|
downloadUrl: string;
|
||||||
|
version: string;
|
||||||
|
featureVersion: number;
|
||||||
|
interimVersion: number;
|
||||||
|
updateVersion: number;
|
||||||
|
buildVersion: number;
|
||||||
|
}
|
Reference in New Issue
Block a user