testing: add possible fixes

This commit is contained in:
Dmitry Shibanov 2022-10-13 16:23:29 +02:00
parent 20838dd977
commit ee9cdf3888
2 changed files with 12 additions and 7 deletions

6
dist/setup/index.js vendored
View File

@ -73239,7 +73239,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
// Try download from internal distribution (popular versions only) // Try download from internal distribution (popular versions only)
// //
try { try {
info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest); info = yield getInfoFromManifest(versionSpec, !isNightly, auth, osArch, manifest);
if (info) { if (info) {
core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`); core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`);
downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth); downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth);
@ -73416,7 +73416,7 @@ function evaluateVersions(versions, versionSpec) {
core.debug(`evaluating ${versions.length} versions`); core.debug(`evaluating ${versions.length} versions`);
core.debug(`version 1 is ${versions[0]}`); core.debug(`version 1 is ${versions[0]}`);
core.debug(`version spec is ${versionSpec}`); core.debug(`version spec is ${versionSpec}`);
versions = versions.map(item => item.replace('-nightly', '+nightly.')).sort((a, b) => { versions = versions.sort((a, b) => {
if (semver.gt(a, b)) { if (semver.gt(a, b)) {
return 1; return 1;
} }
@ -73424,7 +73424,7 @@ function evaluateVersions(versions, versionSpec) {
}); });
for (let i = versions.length - 1; i >= 0; i--) { for (let i = versions.length - 1; i >= 0; i--) {
const potential = versions[i]; const potential = versions[i];
const satisfied = semver.satisfies(potential, versionSpec.replace('-', '+')); const satisfied = semver.satisfies(potential.replace('-nightly', '+nightly.'), versionSpec.replace('-nightly', '+nightly.'));
if (satisfied) { if (satisfied) {
version = potential; version = potential;
break; break;

View File

@ -99,7 +99,7 @@ export async function getNode(
try { try {
info = await getInfoFromManifest( info = await getInfoFromManifest(
versionSpec, versionSpec,
stable, !isNightly,
auth, auth,
osArch, osArch,
manifest manifest
@ -353,7 +353,7 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
core.debug(`evaluating ${versions.length} versions`); core.debug(`evaluating ${versions.length} versions`);
core.debug(`version 1 is ${versions[0]}`); core.debug(`version 1 is ${versions[0]}`);
core.debug(`version spec is ${versionSpec}`); core.debug(`version spec is ${versionSpec}`);
versions = versions.map(item => item.replace('-nightly', '+nightly.')).sort((a, b) => { versions = versions.sort((a, b) => {
if (semver.gt(a, b)) { if (semver.gt(a, b)) {
return 1; return 1;
} }
@ -361,7 +361,10 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
}); });
for (let i = versions.length - 1; i >= 0; i--) { for (let i = versions.length - 1; i >= 0; i--) {
const potential: string = versions[i]; const potential: string = versions[i];
const satisfied: boolean = semver.satisfies(potential, versionSpec.replace('-', '+')); const satisfied: boolean = semver.satisfies(
potential.replace('-nightly', '+nightly.'),
versionSpec.replace('-nightly', '+nightly.')
);
if (satisfied) { if (satisfied) {
version = potential; version = potential;
break; break;
@ -436,7 +439,9 @@ async function queryDistForMatch(
return version; return version;
} }
export async function getVersionsFromDist(versionSpec: string): Promise<INodeVersion[]> { export async function getVersionsFromDist(
versionSpec: string
): Promise<INodeVersion[]> {
const initialUrl = getNodejsDistUrl(versionSpec); const initialUrl = getNodejsDistUrl(versionSpec);
const dataUrl = `${initialUrl}/index.json`; const dataUrl = `${initialUrl}/index.json`;
let httpClient = new hc.HttpClient('setup-node', [], { let httpClient = new hc.HttpClient('setup-node', [], {