mirror of
https://github.com/actions/setup-java.git
synced 2024-11-26 02:10:58 -05:00
Merge branch 'main' of https://github.com/akv-platform/setup-java into apply-reusable-workflows
This commit is contained in:
commit
8a24ed99d8
5 changed files with 29 additions and 32 deletions
|
@ -31,7 +31,7 @@ This action allows you to work with Java and Scala projects.
|
||||||
|
|
||||||
- `java-package`: The packaging variant of the choosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`.
|
- `java-package`: The packaging variant of the choosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`.
|
||||||
|
|
||||||
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: `x64`.
|
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
|
||||||
|
|
||||||
- `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM.
|
- `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM.
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,13 @@ describe('isVersionSatisfies', () => {
|
||||||
describe('isCacheFeatureAvailable', () => {
|
describe('isCacheFeatureAvailable', () => {
|
||||||
it('isCacheFeatureAvailable disabled on GHES', () => {
|
it('isCacheFeatureAvailable disabled on GHES', () => {
|
||||||
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
||||||
|
const infoMock = jest.spyOn(core, 'warning');
|
||||||
|
const message =
|
||||||
|
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.';
|
||||||
try {
|
try {
|
||||||
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
||||||
isCacheFeatureAvailable();
|
expect(isCacheFeatureAvailable()).toBeFalsy();
|
||||||
} catch (error) {
|
expect(infoMock).toHaveBeenCalledWith(message);
|
||||||
expect(error).toHaveProperty(
|
|
||||||
'message',
|
|
||||||
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
delete process.env['GITHUB_SERVER_URL'];
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
}
|
}
|
||||||
|
|
15
dist/cleanup/index.js
vendored
15
dist/cleanup/index.js
vendored
|
@ -68708,16 +68708,15 @@ function isGhes() {
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable()) {
|
||||||
if (isGhes()) {
|
return true;
|
||||||
throw new Error('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.');
|
}
|
||||||
}
|
if (isGhes()) {
|
||||||
else {
|
core.warning('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.');
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
function getVersionFromFileContent(content, distributionName) {
|
function getVersionFromFileContent(content, distributionName) {
|
||||||
|
|
15
dist/setup/index.js
vendored
15
dist/setup/index.js
vendored
|
@ -105436,16 +105436,15 @@ function isGhes() {
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable()) {
|
||||||
if (isGhes()) {
|
return true;
|
||||||
throw new Error('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.');
|
}
|
||||||
}
|
if (isGhes()) {
|
||||||
else {
|
core.warning('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.');
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
function getVersionFromFileContent(content, distributionName) {
|
function getVersionFromFileContent(content, distributionName) {
|
||||||
|
|
18
src/util.ts
18
src/util.ts
|
@ -85,19 +85,19 @@ export function isGhes(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCacheFeatureAvailable(): boolean {
|
export function isCacheFeatureAvailable(): boolean {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable()) {
|
||||||
if (isGhes()) {
|
return true;
|
||||||
throw new Error(
|
}
|
||||||
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (isGhes()) {
|
||||||
|
core.warning(
|
||||||
|
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVersionFromFileContent(
|
export function getVersionFromFileContent(
|
||||||
|
|
Loading…
Reference in a new issue