Compare commits
8 Commits
dependabot
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ddcafbea28 | |||
| 6e3ec0f06d | |||
| 2875322ba9 | |||
| 65a31a6cfe | |||
| 78f53588f3 | |||
| 5a1d04e5f3 | |||
| 555aead9ed | |||
|
|
799ee7c97e |
@@ -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
12
dist/cleanup/index.js
vendored
@@ -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
12
dist/setup/index.js
vendored
@@ -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 {
|
||||||
|
|||||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -12,7 +12,7 @@
|
|||||||
"@actions/cache": "^4.0.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.4.0",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^2.2.3",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
@@ -100,10 +100,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/glob": {
|
"node_modules/@actions/glob": {
|
||||||
"version": "0.5.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz",
|
||||||
"integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
|
"integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==",
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.9.1",
|
"@actions/core": "^1.9.1",
|
||||||
"minimatch": "^3.0.4"
|
"minimatch": "^3.0.4"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"@actions/cache": "^4.0.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.4.0",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^2.2.3",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
|
|||||||
16
src/cache.ts
16
src/cache.ts
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user