parent
4051f74532
commit
c5ee7a1134
|
@ -3,6 +3,7 @@ import fs = require('fs');
|
||||||
import os = require('os');
|
import os = require('os');
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import hc = require('@actions/http-client');
|
import hc = require('@actions/http-client');
|
||||||
|
|
||||||
import each from 'jest-each';
|
import each from 'jest-each';
|
||||||
|
|
||||||
const toolDir = path.join(__dirname, 'runner', 'tools');
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
|
@ -119,7 +120,7 @@ describe('installer tests', () => {
|
||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
}, 400000);
|
}, 400000); //This needs some time to download on "slower" internet connections
|
||||||
|
|
||||||
it('Throws if no location contains correct dotnet version', async () => {
|
it('Throws if no location contains correct dotnet version', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
|
|
|
@ -29,27 +29,21 @@ if (!tempDirectory) {
|
||||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the inputted version information
|
||||||
|
*/
|
||||||
export class DotNetVersionInfo {
|
export class DotNetVersionInfo {
|
||||||
|
|
||||||
private fullversion : string;
|
private fullversion : string;
|
||||||
private isExactVersionSet: boolean = false;
|
private isExactVersionSet: boolean = false;
|
||||||
|
|
||||||
private major: number;
|
|
||||||
private minor: number;
|
|
||||||
private patch?: number;
|
|
||||||
|
|
||||||
constructor(version: string) {
|
constructor(version: string) {
|
||||||
|
|
||||||
// Check for exact match
|
// Check for exact match
|
||||||
if(semver.valid(semver.clean(version) || '') != null) {
|
if(semver.valid(semver.clean(version) || '') != null) {
|
||||||
|
|
||||||
this.fullversion = semver.clean(version) as string;
|
this.fullversion = semver.clean(version) as string;
|
||||||
this.isExactVersionSet = true;
|
this.isExactVersionSet = true;
|
||||||
|
|
||||||
this.major = semver.major(this.fullversion);
|
|
||||||
this.minor = semver.minor(this.fullversion);
|
|
||||||
this.patch = semver.patch(this.fullversion);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,21 +57,10 @@ export class DotNetVersionInfo {
|
||||||
this.throwInvalidVersionFormat();
|
this.throwInvalidVersionFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.major = this.getVersionNumberOrThrow(parts[0]);
|
let major = this.getVersionNumberOrThrow(parts[0]);
|
||||||
this.minor = this.getVersionNumberOrThrow(parts[1]);
|
let minor = this.getVersionNumberOrThrow(parts[1]);
|
||||||
|
|
||||||
/*
|
this.fullversion = major + '.' + minor;
|
||||||
let regexResult = version.match(/^(\d+\.)(\d+)?(\.\*|\.x|)$/);
|
|
||||||
if(regexResult == null) {
|
|
||||||
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
|
|
||||||
}
|
|
||||||
|
|
||||||
let parts : string[] = (regexResult as RegExpMatchArray).slice(1);
|
|
||||||
|
|
||||||
this.major = +(parts[0].replace('.',''));
|
|
||||||
this.minor = +(parts[1].replace('.',''));*/
|
|
||||||
|
|
||||||
this.fullversion = this.major + '.' + this.minor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getVersionNumberOrThrow(input: string) : number {
|
private getVersionNumberOrThrow(input: string) : number {
|
||||||
|
@ -114,6 +97,9 @@ export class DotNetVersionInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a resolved version from the Web-Api
|
||||||
|
*/
|
||||||
class ResolvedVersionInfo {
|
class ResolvedVersionInfo {
|
||||||
downloadUrls: string[];
|
downloadUrls: string[];
|
||||||
resolvedVersion: string;
|
resolvedVersion: string;
|
||||||
|
@ -292,7 +278,7 @@ export class DotnetCoreInstaller {
|
||||||
|
|
||||||
// OsSuffixes - The suffix which is a part of the file name ex- linux-x64, windows-x86
|
// OsSuffixes - The suffix which is a part of the file name ex- linux-x64, windows-x86
|
||||||
// Type - SDK / Runtime
|
// Type - SDK / Runtime
|
||||||
// Version - Version of the SDK/Runtime
|
// versionInfo - versionInfo of the SDK/Runtime
|
||||||
async resolveInfos(
|
async resolveInfos(
|
||||||
osSuffixes: string[],
|
osSuffixes: string[],
|
||||||
versionInfo: DotNetVersionInfo
|
versionInfo: DotNetVersionInfo
|
||||||
|
|
Loading…
Reference in New Issue