Compare commits

..

3 Commits

Author SHA1 Message Date
priya-kinthali cbf9b8df1b
Merge bf96286433 into de5a937a1d 2025-11-07 09:41:05 +05:30
priya-kinthali bf96286433 refactored code based on Copilot suggestions 2025-11-07 09:40:56 +05:30
priya-kinthali 07e4e83111 Replace macos-13 with macos-15-intel 2025-11-07 07:56:34 +05:30
4 changed files with 47 additions and 24 deletions

View File

@ -21,7 +21,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
@ -46,7 +46,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
needs: gradle-save needs: gradle-save
steps: steps:
- name: Checkout - name: Checkout
@ -70,7 +70,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
@ -93,7 +93,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
needs: maven-save needs: maven-save
steps: steps:
- name: Checkout - name: Checkout
@ -121,7 +121,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-22.04] os: [macos-15-intel, windows-latest, ubuntu-22.04]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
@ -133,7 +133,7 @@ jobs:
java-version: '11' java-version: '11'
cache: sbt cache: sbt
- name: Setup SBT - name: Setup SBT
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
echo ""Installing SBT..."" echo ""Installing SBT...""
brew install sbt brew install sbt
@ -141,7 +141,7 @@ jobs:
run: sbt update run: sbt update
- name: Check files to cache on macos-latest - name: Check files to cache on macos-latest
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
@ -170,7 +170,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-22.04] os: [macos-15-intel, windows-latest, ubuntu-22.04]
needs: sbt-save needs: sbt-save
steps: steps:
- name: Checkout - name: Checkout
@ -184,7 +184,7 @@ jobs:
cache: sbt cache: sbt
- name: Confirm that ~/Library/Caches/Coursier directory has been made - name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"

View File

@ -20,7 +20,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
distribution: [ distribution: [
'temurin', 'temurin',
'adopt', 'adopt',
@ -39,7 +39,7 @@ jobs:
- distribution: microsoft - distribution: microsoft
version: 8 version: 8
- distribution: dragonwell - distribution: dragonwell
os: macos-13 os: macos-15-intel
include: include:
- distribution: microsoft - distribution: microsoft
os: windows-latest os: windows-latest
@ -51,7 +51,7 @@ jobs:
os: macos-latest os: macos-latest
version: 25 version: 25
- distribution: oracle - distribution: oracle
os: macos-13 os: macos-15-intel
version: 17 version: 17
- distribution: oracle - distribution: oracle
os: windows-latest os: windows-latest
@ -229,7 +229,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
version: ['17-ea', '15.0.0-ea.14'] version: ['17-ea', '15.0.0-ea.14']
steps: steps:
- name: Checkout - name: Checkout
@ -295,7 +295,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
distribution: distribution:
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains'] ['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
java-package: ['jre'] java-package: ['jre']

21
dist/setup/index.js vendored
View File

@ -129864,17 +129864,19 @@ class JavaBase {
} }
else { else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
let retries = 4; const MAX_RETRIES = 4;
const RETRY_DELAY_MS = 2000;
const retryableCodes = [ const retryableCodes = [
'ETIMEDOUT', 'ETIMEDOUT',
'ECONNRESET', 'ECONNRESET',
'ENOTFOUND', 'ENOTFOUND',
'ECONNREFUSED' 'ECONNREFUSED'
]; ];
let retries = MAX_RETRIES;
while (retries > 0) { while (retries > 0) {
try { try {
// Clear console timers before each attempt to prevent conflicts // Clear console timers before each attempt to prevent conflicts
if (retries < 4 && core.isDebug()) { if (retries < MAX_RETRIES && core.isDebug()) {
const consoleAny = console; const consoleAny = console;
(_b = (_a = consoleAny._times) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a); (_b = (_a = consoleAny._times) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
} }
@ -129902,7 +129904,7 @@ class JavaBase {
error.errors.some((err) => retryableCodes.includes(err === null || err === void 0 ? void 0 : err.code))); error.errors.some((err) => retryableCodes.includes(err === null || err === void 0 ? void 0 : err.code)));
if (retries > 0 && isRetryable) { if (retries > 0 && isRetryable) {
core.debug(`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`); core.debug(`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`);
yield new Promise(r => setTimeout(r, 2000)); yield new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue; continue;
} }
if (error instanceof tc.HTTPError) { if (error instanceof tc.HTTPError) {
@ -129925,7 +129927,13 @@ class JavaBase {
const endpoint = (err === null || err === void 0 ? void 0 : err.address) || (err === null || err === void 0 ? void 0 : err.hostname) || ''; const endpoint = (err === null || err === void 0 ? void 0 : err.address) || (err === null || err === void 0 ? void 0 : err.hostname) || '';
const port = (err === null || err === void 0 ? void 0 : err.port) ? `:${err.port}` : ''; const port = (err === null || err === void 0 ? void 0 : err.port) ? `:${err.port}` : '';
const message = (err === null || err === void 0 ? void 0 : err.message) || 'Aggregate error'; const message = (err === null || err === void 0 ? void 0 : err.message) || 'Aggregate error';
const logMessage = `${message}${!message.includes(endpoint) ? ` ${endpoint}${port}` : ''}${err.localAddress && err.localPort ? ` - Local (${err.localAddress}:${err.localPort})` : ''}`; const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo = err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage); core.error(logMessage);
core.debug(`${err.stack || err.message}`); core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => { Object.entries(err).forEach(([key, value]) => {
@ -129941,7 +129949,10 @@ class JavaBase {
} }
const errorDetails = Object.assign({ name: error.name, message: error.message }, Object.getOwnPropertyNames(error) const errorDetails = Object.assign({ name: error.name, message: error.message }, Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop)) .filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce((acc, prop) => (Object.assign(Object.assign({}, acc), { [prop]: error[prop] })), {})); .reduce((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {}));
Object.entries(errorDetails).forEach(([key, value]) => { Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`); core.debug(`"${key}": ${JSON.stringify(value)}`);
}); });

View File

@ -51,17 +51,19 @@ export abstract class JavaBase {
core.info(`Resolved Java ${foundJava.version} from tool-cache`); core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else { } else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
let retries = 4; const MAX_RETRIES = 4;
const RETRY_DELAY_MS = 2000;
const retryableCodes = [ const retryableCodes = [
'ETIMEDOUT', 'ETIMEDOUT',
'ECONNRESET', 'ECONNRESET',
'ENOTFOUND', 'ENOTFOUND',
'ECONNREFUSED' 'ECONNREFUSED'
]; ];
let retries = MAX_RETRIES;
while (retries > 0) { while (retries > 0) {
try { try {
// Clear console timers before each attempt to prevent conflicts // Clear console timers before each attempt to prevent conflicts
if (retries < 4 && core.isDebug()) { if (retries < MAX_RETRIES && core.isDebug()) {
const consoleAny = console as any; const consoleAny = console as any;
consoleAny._times?.clear?.(); consoleAny._times?.clear?.();
} }
@ -92,7 +94,7 @@ export abstract class JavaBase {
core.debug( core.debug(
`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)` `Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`
); );
await new Promise(r => setTimeout(r, 2000)); await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue; continue;
} }
if (error instanceof tc.HTTPError) { if (error instanceof tc.HTTPError) {
@ -116,7 +118,14 @@ export abstract class JavaBase {
const endpoint = err?.address || err?.hostname || ''; const endpoint = err?.address || err?.hostname || '';
const port = err?.port ? `:${err.port}` : ''; const port = err?.port ? `:${err.port}` : '';
const message = err?.message || 'Aggregate error'; const message = err?.message || 'Aggregate error';
const logMessage = `${message}${!message.includes(endpoint) ? ` ${endpoint}${port}` : ''}${err.localAddress && err.localPort ? ` - Local (${err.localAddress}:${err.localPort})` : ''}`; const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo =
err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage); core.error(logMessage);
core.debug(`${err.stack || err.message}`); core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => { Object.entries(err).forEach(([key, value]) => {
@ -135,7 +144,10 @@ export abstract class JavaBase {
message: error.message, message: error.message,
...Object.getOwnPropertyNames(error) ...Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop)) .filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce((acc, prop) => ({...acc, [prop]: error[prop]}), {}) .reduce<{[key: string]: any}>((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {})
}; };
Object.entries(errorDetails).forEach(([key, value]) => { Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`); core.debug(`"${key}": ${JSON.stringify(value)}`);