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 {
info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest);
info = yield getInfoFromManifest(versionSpec, !isNightly, auth, osArch, manifest);
if (info) {
core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`);
downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth);
@ -73416,7 +73416,7 @@ function evaluateVersions(versions, versionSpec) {
core.debug(`evaluating ${versions.length} versions`);
core.debug(`version 1 is ${versions[0]}`);
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)) {
return 1;
}
@ -73424,7 +73424,7 @@ function evaluateVersions(versions, versionSpec) {
});
for (let i = versions.length - 1; i >= 0; 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) {
version = potential;
break;

View file

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