Compare commits

...

8 Commits
v4.7.0 ... main

Author SHA1 Message Date
rak
ddcafbea28 Fix cache-hit state boolean cast 2025-03-18 23:14:54 +01:00
rak
6e3ec0f06d Fix cache-hit state boolean cast 2025-03-18 23:08:20 +01:00
rak
2875322ba9 Fix cache-hit state boolean cast 2025-03-18 22:58:58 +01:00
rak
65a31a6cfe Fix cache-hit state boolean cast 2025-03-18 22:54:28 +01:00
rak
78f53588f3 Fix cache-hit state boolean cast 2025-03-18 22:41:09 +01:00
rak
5a1d04e5f3 Fix incorrect cache-hit check 2025-03-18 21:53:50 +01:00
rak
555aead9ed Fix for Gitea 2025-03-18 21:06:18 +01:00
aparnajyothi-y
799ee7c97e Add Documentation to Recommend Using GraalVM JDK 17 Version to 17.0.12 to Align with GFTC License Terms (#704)
* Update the graalvm documentation

* update the documentation
2025-03-03 16:27:48 -06:00
4 changed files with 30 additions and 12 deletions

View File

@@ -118,6 +118,8 @@ Currently, the following distributions are supported:
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness. **NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
**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.
### 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:

12
dist/cleanup/index.js vendored
View File

@@ -96552,6 +96552,7 @@ const cache = __importStar(__nccwpck_require__(7799));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const glob = __importStar(__nccwpck_require__(8090)); const glob = __importStar(__nccwpck_require__(8090));
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key'; const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
const STATE_CACHE_HIT = 'cache-hit';
const CACHE_MATCHED_KEY = 'cache-matched-key'; const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java'; const CACHE_KEY_PREFIX = 'setup-java';
const supportedPackageManager = [ const supportedPackageManager = [
@@ -96642,10 +96643,12 @@ function restore(id, cacheDependencyPath) {
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey); const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey);
if (matchedKey) { if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey); core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey); core.saveState(STATE_CACHE_HIT, true);
core.setOutput('cache-hit', true);
core.info(`Cache restored from key: ${matchedKey}`); core.info(`Cache restored from key: ${matchedKey}`);
} }
else { else {
core.saveState(STATE_CACHE_HIT, false);
core.setOutput('cache-hit', false); core.setOutput('cache-hit', false);
core.info(`${packageManager.id} cache is not found`); core.info(`${packageManager.id} cache is not found`);
} }
@@ -96659,16 +96662,17 @@ exports.restore = restore;
function save(id) { function save(id) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const packageManager = findPackageManager(id); const packageManager = findPackageManager(id);
const matchedKey = core.getState(CACHE_MATCHED_KEY);
// Inputs are re-evaluated before the post action, so we want the original key used for restore // Inputs are re-evaluated before the post action, so we want the original key used for restore
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHit = core.getState(STATE_CACHE_HIT);
core.info(`Cache-hit state: ${cacheHit}`);
if (!primaryKey) { if (!primaryKey) {
core.warning('Error retrieving key from state.'); core.warning('Error retrieving key from state.');
return; return;
} }
else if (matchedKey === primaryKey) { if (cacheHit === 'true') {
// no change in target directories // no change in target directories
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); core.info(`${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
return; return;
} }
try { try {

12
dist/setup/index.js vendored
View File

@@ -131801,6 +131801,7 @@ const cache = __importStar(__nccwpck_require__(27799));
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const glob = __importStar(__nccwpck_require__(28090)); const glob = __importStar(__nccwpck_require__(28090));
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key'; const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
const STATE_CACHE_HIT = 'cache-hit';
const CACHE_MATCHED_KEY = 'cache-matched-key'; const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java'; const CACHE_KEY_PREFIX = 'setup-java';
const supportedPackageManager = [ const supportedPackageManager = [
@@ -131891,10 +131892,12 @@ function restore(id, cacheDependencyPath) {
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey); const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey);
if (matchedKey) { if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey); core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey); core.saveState(STATE_CACHE_HIT, true);
core.setOutput('cache-hit', true);
core.info(`Cache restored from key: ${matchedKey}`); core.info(`Cache restored from key: ${matchedKey}`);
} }
else { else {
core.saveState(STATE_CACHE_HIT, false);
core.setOutput('cache-hit', false); core.setOutput('cache-hit', false);
core.info(`${packageManager.id} cache is not found`); core.info(`${packageManager.id} cache is not found`);
} }
@@ -131908,16 +131911,17 @@ exports.restore = restore;
function save(id) { function save(id) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const packageManager = findPackageManager(id); const packageManager = findPackageManager(id);
const matchedKey = core.getState(CACHE_MATCHED_KEY);
// Inputs are re-evaluated before the post action, so we want the original key used for restore // Inputs are re-evaluated before the post action, so we want the original key used for restore
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHit = core.getState(STATE_CACHE_HIT);
core.info(`Cache-hit state: ${cacheHit}`);
if (!primaryKey) { if (!primaryKey) {
core.warning('Error retrieving key from state.'); core.warning('Error retrieving key from state.');
return; return;
} }
else if (matchedKey === primaryKey) { if (cacheHit === 'true') {
// no change in target directories // no change in target directories
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); core.info(`${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
return; return;
} }
try { try {

View File

@@ -9,6 +9,7 @@ import * as core from '@actions/core';
import * as glob from '@actions/glob'; import * as glob from '@actions/glob';
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key'; const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
const STATE_CACHE_HIT = 'cache-hit';
const CACHE_MATCHED_KEY = 'cache-matched-key'; const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java'; const CACHE_KEY_PREFIX = 'setup-java';
@@ -116,9 +117,11 @@ export async function restore(id: string, cacheDependencyPath: string) {
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey); const matchedKey = await cache.restoreCache(packageManager.path, primaryKey);
if (matchedKey) { if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey); core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey); core.saveState(STATE_CACHE_HIT, true);
core.setOutput('cache-hit', true);
core.info(`Cache restored from key: ${matchedKey}`); core.info(`Cache restored from key: ${matchedKey}`);
} else { } else {
core.saveState(STATE_CACHE_HIT, false);
core.setOutput('cache-hit', false); core.setOutput('cache-hit', false);
core.info(`${packageManager.id} cache is not found`); core.info(`${packageManager.id} cache is not found`);
} }
@@ -130,18 +133,23 @@ export async function restore(id: string, cacheDependencyPath: string) {
*/ */
export async function save(id: string) { export async function save(id: string) {
const packageManager = findPackageManager(id); const packageManager = findPackageManager(id);
const matchedKey = core.getState(CACHE_MATCHED_KEY);
// Inputs are re-evaluated before the post action, so we want the original key used for restore // Inputs are re-evaluated before the post action, so we want the original key used for restore
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHit = core.getState(STATE_CACHE_HIT);
core.info(
`Cache-hit state: ${cacheHit}`
);
if (!primaryKey) { if (!primaryKey) {
core.warning('Error retrieving key from state.'); core.warning('Error retrieving key from state.');
return; return;
} else if (matchedKey === primaryKey) { }
if (cacheHit === 'true') {
// no change in target directories // no change in target directories
core.info( core.info(
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.` `${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
); );
return; return;
} }