Compare commits

..
Author SHA1 Message Date
“gowridurgad” 8be1e72903 commit 2025-06-04 15:09:45 +05:30
“gowridurgad” 46a44325a7 error handling 2025-04-25 12:42:02 +05:30
Haritha f4f1212c88 Update publish-immutable-actions.yml (#798) 2025-04-16 11:13:56 -05:00
35 changed files with 26074 additions and 39610 deletions
@@ -30,7 +30,7 @@ jobs:
id: setup-java
with:
distribution: 'adopt'
java-version: '17'
java-version: '11'
cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Create files to cache
@@ -57,7 +57,7 @@ jobs:
id: setup-java
with:
distribution: 'adopt'
java-version: '17'
java-version: '11'
cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Confirm that ~/.gradle/caches directory has been made
@@ -82,7 +82,7 @@ jobs:
id: setup-java
with:
distribution: 'adopt'
java-version: '17'
java-version: '11'
cache: gradle
cache-dependency-path: __tests__/cache/gradle2/*.gradle*
- name: Confirm that ~/.gradle/caches directory has not been made
+10 -10
View File
@@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -30,7 +30,7 @@ jobs:
id: setup-java
with:
distribution: 'adopt'
java-version: '17'
java-version: '11'
cache: gradle
- name: Create files to cache
# Need to avoid using Gradle daemon to stabilize the save process on Windows
@@ -46,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
needs: gradle-save
steps:
- name: Checkout
@@ -70,7 +70,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -93,7 +93,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
needs: maven-save
steps:
- name: Checkout
@@ -121,7 +121,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-22.04]
os: [macos-13, windows-latest, ubuntu-22.04]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -133,7 +133,7 @@ jobs:
java-version: '11'
cache: sbt
- name: Setup SBT
if: matrix.os == 'macos-15-intel'
if: matrix.os == 'macos-13'
run: |
echo ""Installing SBT...""
brew install sbt
@@ -141,7 +141,7 @@ jobs:
run: sbt update
- name: Check files to cache on macos-latest
if: matrix.os == 'macos-15-intel'
if: matrix.os == 'macos-13'
run: |
if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
@@ -170,7 +170,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-22.04]
os: [macos-13, windows-latest, ubuntu-22.04]
needs: sbt-save
steps:
- name: Checkout
@@ -184,7 +184,7 @@ jobs:
cache: sbt
- name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-15-intel'
if: matrix.os == 'macos-13'
run: |
if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
+5 -5
View File
@@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
distribution: [
'temurin',
'adopt',
@@ -39,10 +39,10 @@ jobs:
- distribution: microsoft
version: 8
- distribution: dragonwell
os: macos-15-intel
os: macos-13
include:
- distribution: oracle
os: macos-15-intel
os: macos-13
version: 17
- distribution: oracle
os: windows-latest
@@ -220,7 +220,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
version: ['17-ea', '15.0.0-ea.14']
steps:
- name: Checkout
@@ -286,7 +286,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
os: [macos-13, windows-latest, ubuntu-latest]
distribution:
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
java-package: ['jre']
@@ -2,7 +2,8 @@ name: 'Publish Immutable Action Version'
on:
release:
types: [published]
types: [released]
workflow_dispatch:
jobs:
publish:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+3 -3
View File
@@ -100,8 +100,8 @@ Currently, the following distributions are supported:
|-|-|-|-|
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](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/) |
| `adopt` or `adopt-hotspot` (deprecated; use `temurin`) | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
| `adopt-openj9` (deprecated; use `semeru`) | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
| `adopt` or `adopt-hotspot` | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
| `adopt-openj9` | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](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/)
@@ -114,7 +114,7 @@ Currently, the following distributions are supported:
**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 legacy AdoptOpenJDK distributions are deprecated and will be removed in setup-java v6. Migrate `adopt` and `adopt-hotspot` to `temurin`, and `adopt-openj9` to `semeru`, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
**NOTE:** AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` and `adopt-openj9`, to `temurin` and `semeru` respectively, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
@@ -1,51 +0,0 @@
import * as core from '@actions/core';
import {
AdoptDistribution,
AdoptImplementation
} from '../../src/distributions/adopt/installer';
import {JavaInstallerOptions} from '../../src/distributions/base-models';
import {getJavaDistribution} from '../../src/distributions/distribution-factory';
describe('getJavaDistribution', () => {
const installerOptions: JavaInstallerOptions = {
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
};
afterEach(() => {
jest.restoreAllMocks();
});
it.each([
['adopt', AdoptImplementation.Hotspot, 'temurin'],
['adopt-hotspot', AdoptImplementation.Hotspot, 'temurin'],
['adopt-openj9', AdoptImplementation.OpenJ9, 'semeru']
])(
'warns that %s is deprecated while preserving its installer',
(
distributionName: string,
implementation: AdoptImplementation,
replacement: string
) => {
const warningSpy = jest
.spyOn(core, 'warning')
.mockImplementation(() => {});
const distribution = getJavaDistribution(
distributionName,
installerOptions
);
expect(distribution).toBeInstanceOf(AdoptDistribution);
if (!(distribution instanceof AdoptDistribution)) {
throw new Error(`Expected an Adopt installer for ${distributionName}`);
}
expect(distribution['jvmImpl']).toBe(implementation);
expect(warningSpy).toHaveBeenCalledWith(
`The '${distributionName}' legacy AdoptOpenJDK distribution is deprecated and will be removed in setup-java v6. Please migrate to the '${replacement}' distribution.`
);
}
);
});
+1 -2
View File
@@ -1,7 +1,6 @@
name: 'Setup Java JDK'
description: 'Set up a specific version of the Java JDK and add the
command-line tools to the PATH'
deprecationMessage: 'setup-java v4 is deprecated and will no longer receive updates. Please migrate to actions/setup-java@v5.'
author: 'GitHub'
inputs:
java-version:
@@ -9,7 +8,7 @@ inputs:
java-version-file:
description: 'The path to the `.java-version` file. See examples of supported syntax in README file'
distribution:
description: 'Java distribution. See the list of supported distributions in README file. Legacy AdoptOpenJDK values (adopt, adopt-hotspot, adopt-openj9) are deprecated and will be removed in setup-java v6.'
description: 'Java distribution. See the list of supported distributions in README file'
required: true
java-package:
description: 'The package type (jdk, jre, jdk+fx, jre+fx)'
+12677 -19200
View File
File diff suppressed because one or more lines are too long
+12699 -19256
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -40,7 +40,7 @@ steps:
```
### Adopt
**NOTE:** The legacy `adopt`, `adopt-hotspot`, and `adopt-openj9` distributions are deprecated and will be removed in setup-java v6. Migrate `adopt` and `adopt-hotspot` to `temurin`, and `adopt-openj9` to `semeru`, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
**NOTE:** Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` to `temurin` to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
```yaml
steps:
+340 -748
View File
File diff suppressed because it is too large Load Diff
+4 -12
View File
@@ -8,8 +8,8 @@
"build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint --config ./.eslintrc.js --ext .ts .",
"lint:fix": "eslint --config ./.eslintrc.js --ext .ts . --fix",
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"",
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix",
"prerelease": "npm run-script build",
"release": "git add -f dist/setup/index.js dist/cleanup/index.js",
"test": "jest"
@@ -30,20 +30,12 @@
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.4",
"@actions/glob": "^0.5.0",
"@actions/http-client": "^3.0.2",
"@actions/http-client": "^2.2.3",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.2",
"@actions/tool-cache": "^2.0.1",
"semver": "^7.6.0",
"xmlbuilder2": "^2.4.0"
},
"overrides": {
"@actions/http-client": "$@actions/http-client",
"minimatch": "10.2.6",
"test-exclude": "7.0.2",
"xmlbuilder2": {
"js-yaml": "3.15.0"
}
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^20.11.24",
+26
View File
@@ -51,6 +51,7 @@ export abstract class JavaBase {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else {
core.info('Trying to resolve the latest version from remote');
try {
const javaRelease = await this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
if (foundJava?.version === javaRelease.version) {
@@ -60,6 +61,31 @@ export abstract class JavaBase {
foundJava = await this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
}
} catch (error: any) {
if (error instanceof tc.HTTPError && error.httpStatusCode === 403) {
core.error(
`Received HTTP 403: Permission denied or restricted access.`
);
} else if (
error instanceof tc.HTTPError &&
error.httpStatusCode === 429
) {
core.warning(
`Received HTTP 429: Rate limit exceeded. Try again later.`
);
} else {
const message =
error instanceof Error ? error.message : JSON.stringify(error);
core.error(
`Failed to set up Java due to a network issue or timeout: ${message}`
);
}
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
throw error;
}
}
// JDK folder may contain postfix "Contents/Home" on macOS
-12
View File
@@ -1,4 +1,3 @@
import * as core from '@actions/core';
import {JavaBase} from './base-installer';
import {JavaInstallerOptions} from './base-models';
import {LocalDistribution} from './local/installer';
@@ -43,13 +42,11 @@ export function getJavaDistribution(
return new LocalDistribution(installerOptions, jdkFile);
case JavaDistribution.Adopt:
case JavaDistribution.AdoptHotspot:
warnIfAdoptDistributionIsDeprecated(distributionName, 'temurin');
return new AdoptDistribution(
installerOptions,
AdoptImplementation.Hotspot
);
case JavaDistribution.AdoptOpenJ9:
warnIfAdoptDistributionIsDeprecated(distributionName, 'semeru');
return new AdoptDistribution(
installerOptions,
AdoptImplementation.OpenJ9
@@ -83,12 +80,3 @@ export function getJavaDistribution(
return null;
}
}
function warnIfAdoptDistributionIsDeprecated(
distributionName: string,
replacement: string
): void {
core.warning(
`The '${distributionName}' legacy AdoptOpenJDK distribution is deprecated and will be removed in setup-java v6. Please migrate to the '${replacement}' distribution.`
);
}
+4 -2
View File
@@ -8,6 +8,7 @@ import {
convertVersionToSemver,
extractJdkFile,
getDownloadArchiveExtension,
getGitHubHttpHeaders,
isVersionSatisfies,
renameWinArchive
} from '../../util';
@@ -63,12 +64,13 @@ export class SapMachineDistribution extends JavaBase {
const arch = this.distributionArchitecture();
let fetchedReleasesJson = await this.fetchReleasesFromUrl(
'https://sapmachine.io/assets/data/sapmachine-releases-all.json'
'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'
);
if (!fetchedReleasesJson) {
fetchedReleasesJson = await this.fetchReleasesFromUrl(
'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'
'https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages',
getGitHubHttpHeaders()
);
}
-5
View File
@@ -13,13 +13,8 @@ import * as path from 'path';
import {getJavaDistribution} from './distributions/distribution-factory';
import {JavaInstallerOptions} from './distributions/base-models';
const DEPRECATION_WARNING =
'setup-java v4 is deprecated and will no longer receive updates. Please migrate to actions/setup-java@v5.';
async function run() {
try {
core.warning(DEPRECATION_WARNING);
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
const distributionName = core.getInput(constants.INPUT_DISTRIBUTION, {
required: true