mirror of
https://github.com/actions/setup-java.git
synced 2026-06-30 09:08:12 +00:00
Compare commits
21 Commits
46392a1481
...
ff6bc27707
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff6bc27707 | ||
|
|
ad9d6a6320 | ||
|
|
039af37997 | ||
|
|
1756ab6acd | ||
|
|
662bb59f48 | ||
|
|
1071fc12d6 | ||
|
|
576b821f29 | ||
|
|
307d3a25a0 | ||
|
|
b622de1dfa | ||
|
|
c76542e033 | ||
|
|
0756542bc5 | ||
|
|
ce975d168d | ||
|
|
a8992588fb | ||
|
|
72c7c408b4 | ||
|
|
b2eb50785e | ||
|
|
af8eb9ec81 | ||
|
|
65e87d410c | ||
|
|
0596ef5ff1 | ||
|
|
bd5aa541b3 | ||
|
|
c3514ca397 | ||
|
|
a3e5d6092c |
26
.github/workflows/e2e-versions.yml
vendored
26
.github/workflows/e2e-versions.yml
vendored
@ -86,6 +86,32 @@ jobs:
|
|||||||
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
setup-java-alpine-linux:
|
||||||
|
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - alpine-linux - ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container:
|
||||||
|
image: alpine:latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
distribution: ['temurin', 'sapmachine']
|
||||||
|
version: ['21', '17']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Install bash
|
||||||
|
run: apk add --no-cache bash
|
||||||
|
- name: setup-java
|
||||||
|
uses: ./
|
||||||
|
id: setup-java
|
||||||
|
with:
|
||||||
|
java-version: ${{ matrix.version }}
|
||||||
|
distribution: ${{ matrix.distribution }}
|
||||||
|
- name: Verify Java
|
||||||
|
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
setup-java-major-minor-versions:
|
setup-java-major-minor-versions:
|
||||||
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
||||||
needs: setup-java-major-versions
|
needs: setup-java-major-versions
|
||||||
|
|||||||
@ -14,3 +14,4 @@ allowed:
|
|||||||
reviewed:
|
reviewed:
|
||||||
npm:
|
npm:
|
||||||
- "@actions/http-client" # MIT (license text present), but detected as "other"
|
- "@actions/http-client" # MIT (license text present), but detected as "other"
|
||||||
|
- "argparse" # Python Software Foundation License (PSF), but detected as "other"
|
||||||
BIN
.licenses/npm/@actions/cache.dep.yml
generated
BIN
.licenses/npm/@actions/cache.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/core-1.11.1.dep.yml
generated
BIN
.licenses/npm/@actions/core-1.11.1.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@actions/exec-1.1.1.dep.yml
generated
BIN
.licenses/npm/@actions/exec-1.1.1.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/glob.dep.yml
generated
BIN
.licenses/npm/@actions/glob.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/http-client-2.2.3.dep.yml
generated
BIN
.licenses/npm/@actions/http-client-2.2.3.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/io-1.1.3.dep.yml
generated
BIN
.licenses/npm/@actions/io-1.1.3.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/tool-cache.dep.yml
generated
BIN
.licenses/npm/@actions/tool-cache.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@fastify/busboy.dep.yml
generated
BIN
.licenses/npm/@fastify/busboy.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@nodable/entities.dep.yml
generated
Normal file
BIN
.licenses/npm/@nodable/entities.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@oozcitak/dom.dep.yml
generated
BIN
.licenses/npm/@oozcitak/dom.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@oozcitak/infra.dep.yml
generated
BIN
.licenses/npm/@oozcitak/infra.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@oozcitak/url.dep.yml
generated
BIN
.licenses/npm/@oozcitak/url.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@oozcitak/util.dep.yml
generated
BIN
.licenses/npm/@oozcitak/util.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@types/node.dep.yml
generated
BIN
.licenses/npm/@types/node.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/argparse.dep.yml
generated
BIN
.licenses/npm/argparse.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/brace-expansion.dep.yml
generated
BIN
.licenses/npm/brace-expansion.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/esprima.dep.yml
generated
BIN
.licenses/npm/esprima.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/fast-xml-builder.dep.yml
generated
BIN
.licenses/npm/fast-xml-builder.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/js-yaml.dep.yml
generated
BIN
.licenses/npm/js-yaml.dep.yml
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/sprintf-js.dep.yml
generated
BIN
.licenses/npm/sprintf-js.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/strnum.dep.yml
generated
BIN
.licenses/npm/strnum.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/uuid.dep.yml
generated
BIN
.licenses/npm/uuid.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/xml-naming.dep.yml
generated
Normal file
BIN
.licenses/npm/xml-naming.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/xmlbuilder2.dep.yml
generated
BIN
.licenses/npm/xmlbuilder2.dep.yml
generated
Binary file not shown.
36
README.md
36
README.md
@ -105,21 +105,21 @@ The `java-version` input supports an exact version or a version range using [Sem
|
|||||||
|
|
||||||
#### Supported distributions
|
#### Supported distributions
|
||||||
Currently, the following distributions are supported:
|
Currently, the following distributions are supported:
|
||||||
| Keyword | Distribution | Official site | License
|
| Keyword | Distribution / Official site | License
|
||||||
|-|-|-|-|
|
|-|-|-|
|
||||||
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
|
| `temurin` | [Eclipse Temurin](https://adoptium.net/) | [`temurin` license](https://adoptium.net/about.html)
|
||||||
| `zulu` | Azul 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` | [Azul Zulu OpenJDK](https://www.azul.com/downloads/zulu-community/?package=jdk) | [`zulu` license](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
||||||
| `adopt` or `adopt-hotspot` | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
| `adopt` or `adopt-hotspot` | [AdoptOpenJDK Hotspot](https://adoptopenjdk.net/) | [`adopt-hotspot` license](https://adoptopenjdk.net/about.html) |
|
||||||
| `adopt-openj9` | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
| `adopt-openj9` | [AdoptOpenJDK OpenJ9](https://adoptopenjdk.net/) | [`adopt-openj9` license](https://adoptopenjdk.net/about.html) |
|
||||||
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
|
| `liberica` | [Liberica JDK](https://bell-sw.com/) | [`liberica` license](https://bell-sw.com/liberica_eula/) |
|
||||||
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
|
| `microsoft` | [Microsoft Build of OpenJDK](https://www.microsoft.com/openjdk) | [`microsoft` license](https://docs.microsoft.com/java/openjdk/faq)
|
||||||
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
|
| `corretto` | [Amazon Corretto Build of OpenJDK](https://aws.amazon.com/corretto/) | [`corretto` license](https://aws.amazon.com/corretto/faqs/)
|
||||||
| `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) |
|
| `semeru` | [IBM Semeru Runtime Open Edition](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [`semeru` license](https://openjdk.java.net/legal/gplv2+ce.html) |
|
||||||
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
|
| `oracle` | [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) | [`oracle` license](https://java.com/freeuselicense)
|
||||||
| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/)
|
| `dragonwell` | [Alibaba Dragonwell JDK](https://dragonwell-jdk.io/) | [`dragonwell` license](https://www.aliyun.com/product/dragonwell/)
|
||||||
| `sapmachine` | SAP SapMachine JDK/JRE | [Link](https://sapmachine.io/) | [Link](https://github.com/SAP/SapMachine/blob/sapmachine/LICENSE)
|
| `sapmachine` | [SAP SapMachine JDK/JRE](https://sapmachine.io/) | [`sapmachine` license](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](https://www.graalvm.org/) | [`graalvm` license](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](https://github.com/JetBrains/JetBrainsRuntime/) | [`jetbrains` license](https://github.com/JetBrains/JetBrainsRuntime/blob/main/LICENSE)
|
||||||
|
|
||||||
**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.
|
||||||
|
|
||||||
@ -129,6 +129,10 @@ Currently, the following distributions are supported:
|
|||||||
|
|
||||||
**NOTE:** To comply with the GraalVM Free Terms and Conditions (GFTC) license, it is recommended to use GraalVM JDK 17 version 17.0.12, as this is the only version of GraalVM JDK 17 available under the GFTC license. Additionally, it is encouraged to consider upgrading to GraalVM JDK 21, which offers the latest features and improvements.
|
**NOTE:** To comply with the GraalVM Free Terms and Conditions (GFTC) license, it is recommended to use GraalVM JDK 17 version 17.0.12, as this is the only version of GraalVM JDK 17 available under the GFTC license. Additionally, it is encouraged to consider upgrading to GraalVM JDK 21, which offers the latest features and improvements.
|
||||||
|
|
||||||
|
**NOTE:** Oracle JDK 17 licensing varies by patch level. As shown on the [JDK 17 Archive](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) (versions up to 17.0.12 are under the [NFTC](https://www.oracle.com/downloads/licenses/no-fee-license.html) license) and the [JDK 17.0.13+ Archive](https://www.oracle.com/java/technologies/javase/jdk17-0-13-later-archive-downloads.html) (versions 17.0.13 and later are under the [OTN](https://www.oracle.com/downloads/licenses/javase-license1.html) license). To stay on the free NFTC license, use `distribution: 'oracle'` with `java-version: '17.0.12'` (or earlier) instead of the floating `'17'`. Alternatively, upgrade to Oracle JDK 21+, which remains under the NFTC license.
|
||||||
|
|
||||||
|
**NOTE:** On Ubuntu runners, commands executed via `sudo` do not inherit the `JAVA_HOME` and `PATH` set by `setup-java` and will fall back to the runner image's system-default JDK.
|
||||||
|
|
||||||
### Caching packages dependencies
|
### Caching packages dependencies
|
||||||
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
|
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
|
||||||
|
|
||||||
@ -214,7 +218,7 @@ In the basic examples above, the `check-latest` flag defaults to `false`. When s
|
|||||||
|
|
||||||
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
|
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
|
||||||
|
|
||||||
For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on-flight. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
|
For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on the fly. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@ -17,6 +17,7 @@ describe('dependency cache', () => {
|
|||||||
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
||||||
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
||||||
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
||||||
@ -51,6 +52,10 @@ describe('dependency cache', () => {
|
|||||||
|
|
||||||
spySaveState = jest.spyOn(core, 'saveState');
|
spySaveState = jest.spyOn(core, 'saveState');
|
||||||
spySaveState.mockImplementation(() => null);
|
spySaveState.mockImplementation(() => null);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -58,6 +63,10 @@ describe('dependency cache', () => {
|
|||||||
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
||||||
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
||||||
resetState();
|
resetState();
|
||||||
|
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('restore', () => {
|
describe('restore', () => {
|
||||||
|
|||||||
@ -11,22 +11,35 @@ describe('cleanup', () => {
|
|||||||
Parameters<typeof cache.saveCache>
|
Parameters<typeof cache.saveCache>
|
||||||
>;
|
>;
|
||||||
let spyJobStatusSuccess: jest.SpyInstance;
|
let spyJobStatusSuccess: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyWarning = jest.spyOn(core, 'warning');
|
spyWarning = jest.spyOn(core, 'warning');
|
||||||
spyWarning.mockImplementation(() => null);
|
spyWarning.mockImplementation(() => null);
|
||||||
|
|
||||||
spyInfo = jest.spyOn(core, 'info');
|
spyInfo = jest.spyOn(core, 'info');
|
||||||
spyInfo.mockImplementation(() => null);
|
spyInfo.mockImplementation(() => null);
|
||||||
|
|
||||||
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
||||||
|
|
||||||
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
||||||
spyJobStatusSuccess.mockReturnValue(true);
|
spyJobStatusSuccess.mockReturnValue(true);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
|
|
||||||
createStateForSuccessfulRestore();
|
createStateForSuccessfulRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
resetState();
|
resetState();
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
it('does not warn/fail even when the save process throws a ReserveCacheError', async () => {
|
||||||
spyCacheSave.mockImplementation((paths: string[], key: string) =>
|
spyCacheSave.mockImplementation((paths: string[], key: string) =>
|
||||||
Promise.reject(
|
Promise.reject(
|
||||||
new cache.ReserveCacheError(
|
new cache.ReserveCacheError(
|
||||||
|
|||||||
@ -247,7 +247,7 @@
|
|||||||
{
|
{
|
||||||
"id": 12446,
|
"id": 12446,
|
||||||
"url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
|
"url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
|
||||||
"name": "zulu17.48.15-ca-jdk17.0.10-win_aarhc4.zip",
|
"name": "zulu17.48.15-ca-jdk17.0.10-win_aarch4.zip",
|
||||||
"zulu_version": [17, 48, 15, 0],
|
"zulu_version": [17, 48, 15, 0],
|
||||||
"jdk_version": [17, 0, 10, 7]
|
"jdk_version": [17, 0, 10, 7]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,9 +9,11 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import manifestData from '../data/adopt.json';
|
import manifestData from '../data/adopt.json';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -20,6 +22,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -262,7 +268,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
).rejects.toThrow(/No matching version found for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@ -277,7 +283,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -293,7 +299,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class EmptyJavaBase extends JavaBase {
|
|||||||
): Promise<JavaDownloadRelease> {
|
): Promise<JavaDownloadRelease> {
|
||||||
const availableVersion = '11.0.9';
|
const availableVersion = '11.0.9';
|
||||||
if (!semver.satisfies(availableVersion, range)) {
|
if (!semver.satisfies(availableVersion, range)) {
|
||||||
throw new Error('Available version not found');
|
throw this.createVersionNotFoundError(range, [availableVersion]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -248,6 +248,7 @@ describe('setupJava', () => {
|
|||||||
let spyCoreExportVariable: jest.SpyInstance;
|
let spyCoreExportVariable: jest.SpyInstance;
|
||||||
let spyCoreAddPath: jest.SpyInstance;
|
let spyCoreAddPath: jest.SpyInstance;
|
||||||
let spyCoreSetOutput: jest.SpyInstance;
|
let spyCoreSetOutput: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
|
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
|
||||||
@ -287,6 +288,10 @@ describe('setupJava', () => {
|
|||||||
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
||||||
spyCoreSetOutput.mockImplementation(() => undefined);
|
spyCoreSetOutput.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => undefined);
|
||||||
|
|
||||||
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -530,19 +535,16 @@ describe('setupJava', () => {
|
|||||||
checkLatest: false
|
checkLatest: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
])(
|
])('should throw an error for version not found for %s', async input => {
|
||||||
'should throw an error for Available version not found for %s',
|
mockJavaBase = new EmptyJavaBase(input);
|
||||||
async input => {
|
await expect(mockJavaBase.setupJava()).rejects.toThrow(
|
||||||
mockJavaBase = new EmptyJavaBase(input);
|
`No matching version found for SemVer '${input.version}'`
|
||||||
await expect(mockJavaBase.setupJava()).rejects.toThrow(
|
);
|
||||||
'Available version not found'
|
expect(spyTcFindAllVersions).toHaveBeenCalled();
|
||||||
);
|
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
||||||
expect(spyTcFindAllVersions).toHaveBeenCalled();
|
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
||||||
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
expect(spyCoreSetOutput).not.toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
});
|
||||||
expect(spyCoreSetOutput).not.toHaveBeenCalled();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('normalizeVersion', () => {
|
describe('normalizeVersion', () => {
|
||||||
@ -570,6 +572,97 @@ describe('normalizeVersion', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('createVersionNotFoundError', () => {
|
||||||
|
it('should include all required fields in error message without available versions', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError('17.0.5');
|
||||||
|
|
||||||
|
expect(error.message).toContain(
|
||||||
|
"No matching version found for SemVer '17.0.5'"
|
||||||
|
);
|
||||||
|
expect(error.message).toContain('Distribution: Empty');
|
||||||
|
expect(error.message).toContain('Package type: jdk');
|
||||||
|
expect(error.message).toContain('Architecture: x64');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include available versions when provided', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const availableVersions = ['11.0.1', '11.0.2', '17.0.1', '17.0.2'];
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError(
|
||||||
|
'17.0.5',
|
||||||
|
availableVersions
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(error.message).toContain(
|
||||||
|
"No matching version found for SemVer '17.0.5'"
|
||||||
|
);
|
||||||
|
expect(error.message).toContain('Distribution: Empty');
|
||||||
|
expect(error.message).toContain('Package type: jdk');
|
||||||
|
expect(error.message).toContain('Architecture: x64');
|
||||||
|
expect(error.message).toContain(
|
||||||
|
'Available versions: 11.0.1, 11.0.2, 17.0.1, 17.0.2'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should truncate available versions when there are many', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create 60 versions to test truncation
|
||||||
|
const availableVersions = Array.from({length: 60}, (_, i) => `11.0.${i}`);
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError(
|
||||||
|
'17.0.5',
|
||||||
|
availableVersions
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(error.message).toContain('Available versions:');
|
||||||
|
expect(error.message).toContain('...');
|
||||||
|
expect(error.message).toContain('(showing first 50 of 60 versions');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include additional context when provided', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const availableVersions = ['11.0.1', '11.0.2'];
|
||||||
|
const additionalContext = 'Platform: linux';
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError(
|
||||||
|
'17.0.5',
|
||||||
|
availableVersions,
|
||||||
|
additionalContext
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(error.message).toContain(
|
||||||
|
"No matching version found for SemVer '17.0.5'"
|
||||||
|
);
|
||||||
|
expect(error.message).toContain('Distribution: Empty');
|
||||||
|
expect(error.message).toContain('Package type: jdk');
|
||||||
|
expect(error.message).toContain('Architecture: x64');
|
||||||
|
expect(error.message).toContain('Platform: linux');
|
||||||
|
expect(error.message).toContain('Available versions: 11.0.1, 11.0.2');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('getToolcacheVersionName', () => {
|
describe('getToolcacheVersionName', () => {
|
||||||
const DummyJavaBase = JavaBase as any;
|
const DummyJavaBase = JavaBase as any;
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,14 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
||||||
import * as util from '../../src/util';
|
import * as util from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import {isGeneratorFunction} from 'util/types';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/corretto.json';
|
import manifestData from '../data/corretto.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -23,6 +24,10 @@ describe('getAvailableVersions', () => {
|
|||||||
util,
|
util,
|
||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -198,7 +203,7 @@ describe('getAvailableVersions', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](version)
|
distribution['findPackageForDownload'](version)
|
||||||
).rejects.toThrow("Could not find satisfied version for SemVer '4'");
|
).rejects.toThrow("No matching version found for SemVer '4'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/dragonwell.json';
|
import manifestData from '../data/dragonwell.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -21,6 +23,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -219,7 +225,7 @@ describe('getAvailableVersions', () => {
|
|||||||
['11', 'macos', 'aarch64'],
|
['11', 'macos', 'aarch64'],
|
||||||
['17', 'linux', 'riscv']
|
['17', 'linux', 'riscv']
|
||||||
])(
|
])(
|
||||||
'should throw when required version of JDK can not be found in the JSON',
|
'should throw when required version of JDK cannot be found in the JSON',
|
||||||
async (jdkVersion: string, platform: string, arch: string) => {
|
async (jdkVersion: string, platform: string, arch: string) => {
|
||||||
const distribution = new DragonwellDistribution({
|
const distribution = new DragonwellDistribution({
|
||||||
version: jdkVersion,
|
version: jdkVersion,
|
||||||
@ -232,7 +238,7 @@ describe('getAvailableVersions', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](jdkVersion)
|
distribution['findPackageForDownload'](jdkVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${jdkVersion}" and architecture: "${arch}".`
|
`No matching version found for SemVer '${jdkVersion}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -42,6 +42,7 @@ beforeAll(() => {
|
|||||||
describe('GraalVMDistribution', () => {
|
describe('GraalVMDistribution', () => {
|
||||||
let distribution: GraalVMDistribution;
|
let distribution: GraalVMDistribution;
|
||||||
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
const defaultOptions: JavaInstallerOptions = {
|
const defaultOptions: JavaInstallerOptions = {
|
||||||
version: '17',
|
version: '17',
|
||||||
@ -59,6 +60,10 @@ describe('GraalVMDistribution', () => {
|
|||||||
(distribution as any).http = mockHttpClient;
|
(distribution as any).http = mockHttpClient;
|
||||||
|
|
||||||
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
@ -348,11 +353,19 @@ describe('GraalVMDistribution', () => {
|
|||||||
} as http.HttpClientResponse;
|
} as http.HttpClientResponse;
|
||||||
mockHttpClient.head.mockResolvedValue(mockResponse);
|
mockHttpClient.head.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
|
// Verify the error is thrown with the expected message
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
).rejects.toThrow(
|
).rejects.toThrow("No matching version found for SemVer '17.0.99'");
|
||||||
'Could not find GraalVM for SemVer 17.0.99. Please check if this version is available at https://download.oracle.com/graalvm'
|
// Verify distribution info is included
|
||||||
);
|
await expect(
|
||||||
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
|
).rejects.toThrow('GraalVM');
|
||||||
|
|
||||||
|
// Verify the hint about checking the base URL is included
|
||||||
|
await expect(
|
||||||
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
|
).rejects.toThrow('https://www.graalvm.org/downloads/');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error for unauthorized access (401)', async () => {
|
it('should throw error for unauthorized access (401)', async () => {
|
||||||
@ -496,12 +509,19 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('23')
|
(distribution as any).findPackageForDownload('23')
|
||||||
).rejects.toThrow("Unable to find latest version for '23-ea'");
|
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
||||||
|
|
||||||
// Verify error logging
|
await expect(
|
||||||
expect(core.error).toHaveBeenCalledWith(
|
(distribution as any).findPackageForDownload('23')
|
||||||
'Available versions: 23-ea-20240716'
|
).rejects.toThrow(
|
||||||
|
'Note: No EA build is marked as latest for this version.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
(distribution as any).findPackageForDownload('23')
|
||||||
|
).rejects.toThrow('23-ea-20240716');
|
||||||
|
|
||||||
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when no matching file for architecture in EA build', async () => {
|
it('should throw error when no matching file for architecture in EA build', async () => {
|
||||||
@ -708,11 +728,19 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
).rejects.toThrow("Unable to find latest version for '23-ea'");
|
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
||||||
|
|
||||||
expect(core.error).toHaveBeenCalledWith(
|
await expect(
|
||||||
'Available versions: 23-ea-20240716, 23-ea-20240709'
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
|
).rejects.toThrow(
|
||||||
|
'Note: No EA build is marked as latest for this version.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
|
).rejects.toThrow('23-ea-20240716');
|
||||||
|
|
||||||
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when no matching file for architecture', async () => {
|
it('should throw error when no matching file for architecture', async () => {
|
||||||
|
|||||||
@ -4,9 +4,11 @@ import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer
|
|||||||
|
|
||||||
import manifestData from '../data/jetbrains.json';
|
import manifestData from '../data/jetbrains.json';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -15,6 +17,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -98,7 +104,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -111,7 +117,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,11 +5,13 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/liberica.json';
|
import manifestData from '../data/liberica.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -18,6 +20,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -209,7 +215,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
||||||
/Could not find satisfied version for semver */
|
/No matching version found for SemVer/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,11 +5,13 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/liberica-linux.json';
|
import manifestData from '../data/liberica-linux.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -18,6 +20,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -209,7 +215,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
||||||
/Could not find satisfied version for semver */
|
/No matching version found for SemVer/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,11 +5,13 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/liberica-windows.json';
|
import manifestData from '../data/liberica-windows.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -18,6 +20,9 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -209,7 +214,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
||||||
/Could not find satisfied version for semver */
|
/No matching version found for SemVer/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -27,6 +27,7 @@ describe('setupJava', () => {
|
|||||||
let spyFsReadDir: jest.SpyInstance;
|
let spyFsReadDir: jest.SpyInstance;
|
||||||
let spyUtilsExtractJdkFile: jest.SpyInstance;
|
let spyUtilsExtractJdkFile: jest.SpyInstance;
|
||||||
let spyPathResolve: jest.SpyInstance;
|
let spyPathResolve: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
const expectedJdkFile = 'JavaLocalJdkFile';
|
const expectedJdkFile = 'JavaLocalJdkFile';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -93,6 +94,10 @@ describe('setupJava', () => {
|
|||||||
// Spy on path methods
|
// Spy on path methods
|
||||||
spyPathResolve = jest.spyOn(path, 'resolve');
|
spyPathResolve = jest.spyOn(path, 'resolve');
|
||||||
spyPathResolve.mockImplementation((path: string) => path);
|
spyPathResolve.mockImplementation((path: string) => path);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -214,7 +219,7 @@ describe('setupJava', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('java is resolved from toolcache including Contents/Home on MacOS', async () => {
|
it('java is resolved from toolcache including Contents/Home on macOS', async () => {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
version: actualJavaVersion,
|
version: actualJavaVersion,
|
||||||
architecture: 'x86',
|
architecture: 'x86',
|
||||||
@ -257,7 +262,7 @@ describe('setupJava', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('java is unpacked from jdkfile including Contents/Home on MacOS', async () => {
|
it('java is unpacked from jdkfile including Contents/Home on macOS', async () => {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
version: '11.0.289',
|
version: '11.0.289',
|
||||||
architecture: 'x86',
|
architecture: 'x86',
|
||||||
|
|||||||
@ -8,6 +8,7 @@ describe('findPackageForDownload', () => {
|
|||||||
let distribution: MicrosoftDistributions;
|
let distribution: MicrosoftDistributions;
|
||||||
let spyGetManifestFromRepo: jest.SpyInstance;
|
let spyGetManifestFromRepo: jest.SpyInstance;
|
||||||
let spyDebug: jest.SpyInstance;
|
let spyDebug: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
distribution = new MicrosoftDistributions({
|
distribution = new MicrosoftDistributions({
|
||||||
@ -26,6 +27,10 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
spyDebug = jest.spyOn(core, 'debug');
|
||||||
spyDebug.mockImplementation(() => {});
|
spyDebug.mockImplementation(() => {});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
@ -174,7 +179,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,6 +8,7 @@ describe('findPackageForDownload', () => {
|
|||||||
let distribution: OracleDistribution;
|
let distribution: OracleDistribution;
|
||||||
let spyDebug: jest.SpyInstance;
|
let spyDebug: jest.SpyInstance;
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
distribution = new OracleDistribution({
|
distribution = new OracleDistribution({
|
||||||
@ -19,6 +20,10 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
spyDebug = jest.spyOn(core, 'debug');
|
||||||
spyDebug.mockImplementation(() => {});
|
spyDebug.mockImplementation(() => {});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
|
import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/sapmachine.json';
|
import manifestData from '../data/sapmachine.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -21,6 +23,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -248,7 +254,7 @@ describe('getAvailableVersions', () => {
|
|||||||
['21.0.3+8-ea', 'linux', 'x64', '21.0.3+8'],
|
['21.0.3+8-ea', 'linux', 'x64', '21.0.3+8'],
|
||||||
['17', 'linux-muse', 'aarch64']
|
['17', 'linux-muse', 'aarch64']
|
||||||
])(
|
])(
|
||||||
'should throw when required version of JDK can not be found in the JSON',
|
'should throw when required version of JDK cannot be found in the JSON',
|
||||||
async (
|
async (
|
||||||
version: string,
|
version: string,
|
||||||
platform: string,
|
platform: string,
|
||||||
@ -266,7 +272,7 @@ describe('getAvailableVersions', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](normalizedVersion)
|
distribution['findPackageForDownload'](normalizedVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${normalizedVersion}" and architecture: "${arch}".`
|
`No matching version found for SemVer '${normalizedVersion}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -4,9 +4,11 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
|
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
|
||||||
|
|
||||||
import manifestData from '../data/semeru.json';
|
import manifestData from '../data/semeru.json';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -15,6 +17,9 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -152,7 +157,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
).rejects.toThrow(/No matching version found for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@ -164,7 +169,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -177,7 +182,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,11 @@ import {
|
|||||||
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
||||||
|
|
||||||
import manifestData from '../data/temurin.json';
|
import manifestData from '../data/temurin.json';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -18,6 +20,9 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -213,7 +218,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
).rejects.toThrow(/No matching version found for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@ -228,7 +233,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -244,7 +249,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,12 +3,14 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/zulu-releases-default.json';
|
import manifestData from '../data/zulu-releases-default.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -23,6 +25,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -225,6 +231,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/Could not find satisfied version for semver */);
|
).rejects.toThrow(/No matching version found for SemVer/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,12 +4,14 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/zulu-linux.json';
|
import manifestData from '../data/zulu-linux.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -24,6 +26,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -228,6 +234,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/Could not find satisfied version for semver */);
|
).rejects.toThrow(/No matching version found for SemVer/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,12 +4,14 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/zulu-windows.json';
|
import manifestData from '../data/zulu-windows.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@ -24,6 +26,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -226,6 +232,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/Could not find satisfied version for semver */);
|
).rejects.toThrow(/No matching version found for SemVer/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
58590
dist/cleanup/index.js
vendored
58590
dist/cleanup/index.js
vendored
File diff suppressed because one or more lines are too long
92775
dist/setup/index.js
vendored
92775
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
@ -34,7 +34,7 @@ Requiring a default version will break users that are pinned to `@main` as they
|
|||||||
|
|
||||||
`setup-java` should be structured in such a way that will allow the open source community to easily add support for extra distributions.
|
`setup-java` should be structured in such a way that will allow the open source community to easily add support for extra distributions.
|
||||||
|
|
||||||
Existing code will be restructured so that distribution specific code will be easily separated. Currently the core download logic is in a single file, `installer.ts`. This file will be split up and abstracted out so that there will be no vendor specified logic. Each distribution will have it's own files under `src/distributions` that will contain the core setup logic for a specific distribution.
|
Existing code will be restructured so that distribution specific code will be easily separated. Currently the core download logic is in a single file, `installer.ts`. This file will be split up and abstracted out so that there will be no vendor specified logic. Each distribution will have its own files under `src/distributions` that will contain the core setup logic for a specific distribution.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
∟ src/
|
∟ src/
|
||||||
|
|||||||
@ -16,4 +16,4 @@ This folder includes ADRs for the setup-java action. ADRs are proposed in the fo
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- More information about ADRs can be found [here](https://github.com/joelparkerhenderson/architecture_decision_record).
|
- See [more information about ADRs](https://github.com/joelparkerhenderson/architecture_decision_record).
|
||||||
@ -176,7 +176,7 @@ steps:
|
|||||||
|
|
||||||
**NOTE:** JetBrains is only available for LTS versions on 11 or later (11, 17, 21, etc.).
|
**NOTE:** JetBrains is only available for LTS versions on 11 or later (11, 17, 21, etc.).
|
||||||
|
|
||||||
Not all minor LTS versions are guarenteed to be available, since JetBrains considers what to ship IntelliJ IDEA with, most commonly on JDK 11.
|
Not all minor LTS versions are guaranteed to be available, since JetBrains considers what to ship IntelliJ IDEA with, most commonly on JDK 11.
|
||||||
For example, `11.0.24` is not available but `11.0.16` is.
|
For example, `11.0.24` is not available but `11.0.16` is.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
3923
package-lock.json
generated
3923
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@ -29,31 +29,31 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^5.0.1",
|
"@actions/cache": "^5.0.5",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^2.0.3",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^2.0.0",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.1",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^3.0.2",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^2.0.0",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^3.0.1",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
"xmlbuilder2": "^2.4.0"
|
"xmlbuilder2": "^4.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^24.1.0",
|
"@types/node": "^25.9.3",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
||||||
"@typescript-eslint/parser": "^8.35.1",
|
"@typescript-eslint/parser": "^8.35.1",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-jest": "^29.0.1",
|
"eslint-plugin-jest": "^29.0.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^30.4.2",
|
||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^30.4.2",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"ts-jest": "^29.3.0",
|
"ts-jest": "^29.4.11",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|||||||
@ -54,15 +54,10 @@ export class AdoptDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableVersionStrings = availableVersionsWithBinaries.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@ -259,6 +259,42 @@ export abstract class JavaBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected createVersionNotFoundError(
|
||||||
|
versionOrRange: string,
|
||||||
|
availableVersions?: string[],
|
||||||
|
additionalContext?: string
|
||||||
|
): Error {
|
||||||
|
const parts = [
|
||||||
|
`No matching version found for SemVer '${versionOrRange}'.`,
|
||||||
|
`Distribution: ${this.distribution}`,
|
||||||
|
`Package type: ${this.packageType}`,
|
||||||
|
`Architecture: ${this.architecture}`
|
||||||
|
];
|
||||||
|
|
||||||
|
// Add additional context if provided (e.g., platform/OS info)
|
||||||
|
if (additionalContext) {
|
||||||
|
parts.push(additionalContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (availableVersions && availableVersions.length > 0) {
|
||||||
|
const maxVersionsToShow = core.isDebug() ? availableVersions.length : 50;
|
||||||
|
const versionsToShow = availableVersions.slice(0, maxVersionsToShow);
|
||||||
|
const truncated = availableVersions.length > maxVersionsToShow;
|
||||||
|
|
||||||
|
parts.push(
|
||||||
|
`Available versions: ${versionsToShow.join(', ')}${truncated ? ', ...' : ''}`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (truncated) {
|
||||||
|
parts.push(
|
||||||
|
`(showing first ${maxVersionsToShow} of ${availableVersions.length} versions, enable debug mode to see all)`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Error(parts.join('\n'));
|
||||||
|
}
|
||||||
|
|
||||||
protected setJavaDefault(version: string, toolPath: string) {
|
protected setJavaDefault(version: string, toolPath: string) {
|
||||||
const majorVersion = version.split('.')[0];
|
const majorVersion = version.split('.')[0];
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
|
|||||||
@ -75,15 +75,10 @@ export class CorrettoDistribution extends JavaBase {
|
|||||||
const resolvedVersion =
|
const resolvedVersion =
|
||||||
matchingVersions.length > 0 ? matchingVersions[0] : null;
|
matchingVersions.length > 0 ? matchingVersions[0] : null;
|
||||||
if (!resolvedVersion) {
|
if (!resolvedVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableVersionStrings = availableVersions.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,9 +51,10 @@ export class DragonwellDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
throw new Error(
|
const availableVersionStrings = availableVersions.map(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`
|
item => item.jdk_version
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import {
|
|||||||
} from '../../util';
|
} from '../../util';
|
||||||
|
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
|
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@ -149,9 +150,10 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
|
|
||||||
if (statusCode === HttpCodes.NotFound) {
|
if (statusCode === HttpCodes.NotFound) {
|
||||||
throw new Error(
|
// Create the standard error with additional hint about checking the download URL
|
||||||
`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`
|
const error = this.createVersionNotFoundError(range);
|
||||||
);
|
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -180,10 +182,12 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
|
|
||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
core.error(
|
const availableVersions = versions.map(v => v.version);
|
||||||
`Available versions: ${versions.map(v => v.version).join(', ')}`
|
throw this.createVersionNotFoundError(
|
||||||
|
javaEaVersion,
|
||||||
|
availableVersions,
|
||||||
|
'Note: No EA build is marked as latest for this version.'
|
||||||
);
|
);
|
||||||
throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
|
|||||||
@ -44,15 +44,10 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = versionsRaw
|
const availableVersionStrings = versionsRaw.map(
|
||||||
.map(item => `${item.tag_name} (${item.semver}+${item.build})`)
|
item => `${item.tag_name} (${item.semver}+${item.build})`
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${range}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@ -69,15 +69,10 @@ export class LibericaDistributions extends JavaBase {
|
|||||||
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||||
|
|
||||||
if (!satisfiedVersion) {
|
if (!satisfiedVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableVersionStrings = availableVersions.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return satisfiedVersion;
|
return satisfiedVersion;
|
||||||
|
|||||||
@ -76,11 +76,8 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
||||||
|
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
throw new Error(
|
const availableVersionStrings = manifest.map(item => item.version);
|
||||||
`Could not find satisfied version for SemVer ${range}.\nAvailable versions: ${manifest
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
.map(item => item.version)
|
|
||||||
.join(', ')}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -112,7 +112,7 @@ export class OracleDistribution extends JavaBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Could not find Oracle JDK for SemVer ${range}`);
|
throw this.createVersionNotFoundError(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
||||||
|
|||||||
@ -49,9 +49,10 @@ export class SapMachineDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
throw new Error(
|
const availableVersionStrings = availableVersions.map(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`
|
item => item.version
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
|||||||
@ -79,14 +79,16 @@ export class SemeruDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableVersionStrings = availableVersionsWithBinaries.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
);
|
||||||
const availableOptionsMessage = availableOptions
|
// Include platform context to help users understand OS-specific version availability
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
// IBM Semeru builds are OS-specific, so platform info aids in troubleshooting
|
||||||
: '';
|
const platformContext = `Platform: ${process.platform}`;
|
||||||
throw new Error(
|
throw this.createVersionNotFoundError(
|
||||||
`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`
|
version,
|
||||||
|
availableVersionStrings,
|
||||||
|
platformContext
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,15 +57,10 @@ export class TemurinDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableVersionStrings = availableVersionsWithBinaries.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
@ -176,6 +171,11 @@ export class TemurinDistribution extends JavaBase {
|
|||||||
return 'mac';
|
return 'mac';
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return 'windows';
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
if (fs.existsSync('/etc/alpine-release')) {
|
||||||
|
return 'alpine-linux';
|
||||||
|
}
|
||||||
|
return 'linux';
|
||||||
default:
|
default:
|
||||||
return process.platform;
|
return process.platform;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,15 +57,10 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableVersionStrings = availableVersions.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for semver ${version}. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user