From 548033df2836789e48e70b6a34e99bd101d198b2 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 01:40:45 +0200 Subject: [PATCH 01/16] Add test action for listing sdks --- .github/workflows/test-dotnet.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index 03b9a294b..87fd241fe 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -12,6 +12,14 @@ on: - '**.md' jobs: + check-installed: + runs-on: 'windows-latest' + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: dotnet --list-sdks setup-version: runs-on: ${{ matrix.operating-system }} strategy: From faa2990a1a9713f0e9e2ca63ecc9a5788c7bc737 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 03:12:46 +0200 Subject: [PATCH 02/16] Update install scripts --- externals/install-dotnet.ps1 | 382 ++++++++++++++++++++--------------- externals/install-dotnet.sh | 69 ++++++- 2 files changed, 282 insertions(+), 169 deletions(-) diff --git a/externals/install-dotnet.ps1 b/externals/install-dotnet.ps1 index c9a30cb3c..c3e0df55d 100644 --- a/externals/install-dotnet.ps1 +++ b/externals/install-dotnet.ps1 @@ -176,6 +176,23 @@ function Measure-Action($name, $block) { Say-Verbose "⏱ Action '$name' took $totalSeconds seconds" } +function Get-Remote-File-Size($zipUri) { + try { + $response = Invoke-WebRequest -Uri $zipUri -Method Head + $fileSize = $response.Headers["Content-Length"] + if ((![string]::IsNullOrEmpty($fileSize))) { + Say "Remote file $zipUri size is $fileSize bytes." + + return $fileSize + } + } + catch { + Say-Verbose "Content-Length header was not extracted for $zipUri." + } + + return $null +} + function Say-Invocation($Invocation) { $command = $Invocation.MyCommand; $args = (($Invocation.BoundParameters.Keys | foreach { "-$_ `"$($Invocation.BoundParameters[$_])`"" }) -join " ") @@ -862,13 +879,15 @@ function DownloadFile($Source, [string]$OutPath) { } $Stream = $null - + try { $Response = GetHTTPResponse -Uri $Source $Stream = $Response.Content.ReadAsStreamAsync().Result $File = [System.IO.File]::Create($OutPath) $Stream.CopyTo($File) $File.Close() + + ValidateRemoteLocalFileSizes -LocalFileOutPath $OutPath -SourceUri $Source } finally { if ($null -ne $Stream) { @@ -877,19 +896,40 @@ function DownloadFile($Source, [string]$OutPath) { } } +function ValidateRemoteLocalFileSizes([string]$LocalFileOutPath, $SourceUri) { + try { + $remoteFileSize = Get-Remote-File-Size -zipUri $SourceUri + $fileSize = [long](Get-Item $LocalFileOutPath).Length + Say "Downloaded file $SourceUri size is $fileSize bytes." + + if ((![string]::IsNullOrEmpty($remoteFileSize)) -and !([string]::IsNullOrEmpty($fileSize)) ) { + if ($remoteFileSize -ne $fileSize) { + Say "The remote and local file sizes are not equal. Remote file size is $remoteFileSize bytes and local size is $fileSize bytes. The local package may be corrupted." + } + else { + Say "The remote and local file sizes are equal." + } + } + else { + Say "Either downloaded or local package size can not be measured. One of them may be corrupted." + } + } + catch { + Say "Either downloaded or local package size can not be measured. One of them may be corrupted." + } +} + function SafeRemoveFile($Path) { try { if (Test-Path $Path) { Remove-Item $Path Say-Verbose "The temporary file `"$Path`" was removed." } - else - { + else { Say-Verbose "The temporary file `"$Path`" does not exist, therefore is not removed." } } - catch - { + catch { Say-Warning "Failed to remove the temporary file: `"$Path`", remove it manually." } } @@ -1100,17 +1140,25 @@ function Resolve-AssetName-And-RelativePath([string] $Runtime) { } function Prepare-Install-Directory { + $diskSpaceWarning = "Failed to check the disk space. Installation will continue, but it may fail if you do not have enough disk space."; + + if ($PSVersionTable.PSVersion.Major -lt 7) { + Say-Verbose $diskSpaceWarning + return + } + New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null $installDrive = $((Get-Item $InstallRoot -Force).PSDrive.Name); $diskInfo = $null - try{ + try { $diskInfo = Get-PSDrive -Name $installDrive } - catch{ - Say-Warning "Failed to check the disk space. Installation will continue, but it may fail if you do not have enough disk space." + catch { + Say-Warning $diskSpaceWarning } - + + # The check is relevant for PS version >= 7, the result can be irrelevant for older versions. See https://github.com/PowerShell/PowerShell/issues/12442. if ( ($null -ne $diskInfo) -and ($diskInfo.Free / 1MB -le 100)) { throw "There is not enough disk space on drive ${installDrive}:" } @@ -1298,42 +1346,42 @@ Say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet Say "Installed version is $($DownloadedLink.effectiveVersion)" Say "Installation finished" # SIG # Begin signature block -# MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBhfTi3SRn7+vyy -# uCXKPjhiawegWZ493EcaOEycbgkZcKCCDXYwggX0MIID3KADAgECAhMzAAACy7d1 -# OfsCcUI2AAAAAALLMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDHUcYiJ7KWN+hZ +# Iks0/BD3PXFcvRIYlRRYfy3L+sVa1aCCDXYwggX0MIID3KADAgECAhMzAAADTrU8 +# esGEb+srAAAAAANOMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD # VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy # b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p -# bmcgUENBIDIwMTEwHhcNMjIwNTEyMjA0NTU5WhcNMjMwNTExMjA0NTU5WjB0MQsw +# bmcgUENBIDIwMTEwHhcNMjMwMzE2MTg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iFzn4svjEqoWpPb4nuPzK8HWLvAlBWx5EDDofXFufOvV4PjRkZI1ReY +# NhDk5f0j+mi5fsmgJWJUDTvQ4kFINKgarrXs+zdmv1dhowLZhW5siIsaaUIt3Y8C +# ijKKd9b9RyH+DI1aSV4xFzOXnD7GAeSmaN9iwi+PUuNxpvB9O4VmmU4QvYySpc4p +# e5LhJLnu80XzASguiFQ= # SIG # End signature block diff --git a/externals/install-dotnet.sh b/externals/install-dotnet.sh index a830583cd..385c7f91c 100755 --- a/externals/install-dotnet.sh +++ b/externals/install-dotnet.sh @@ -546,6 +546,39 @@ is_dotnet_package_installed() { fi } +# args: +# downloaded file - $1 +# remote_file_size - $2 +validate_remote_local_file_sizes() +{ + eval $invocation + + local downloaded_file="$1" + local remote_file_size="$2" + + local file_size='' + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + file_size="$(stat -c '%s' "$downloaded_file")" + elif [[ "$OSTYPE" == "darwin"* ]]; then + file_size="$(stat -f '%z' "$downloaded_file")" + fi + + if [ -n "$file_size" ]; then + say "Downloaded file size is $file_size bytes." + + if [ -n "$remote_file_size" ] && [ -n "$file_size" ]; then + if [ "$file_size" != "$remote_file_size" ]; then + say "The remote and local file sizes are not equal. Remote file size is $remote_file_size bytes and local size is $file_size bytes. The local package may be corrupted." + else + say "The remote and local file sizes are equal." + fi + fi + + else + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi +} + # args: # azure_feed - $1 # channel - $2 @@ -914,14 +947,39 @@ copy_files_or_dirs_from_list() { done } +# args: +# zip_uri - $1 +get_remote_file_size() { + local zip_uri="$1" + + if machine_has "curl"; then + file_size=$(curl -sI "$zip_uri" | grep -i content-length | awk '{print $2}') + elif machine_has "wget"; then + file_size=$(wget --server-response -O /dev/null "$zip_uri" 2>&1 | grep -i '^Content-Length:' | awk '{print $2}') + else + say "Neither curl nor wget is available on this system." + return + fi + + if [ -n "$file_size" ]; then + say "Remote file $zip_uri size is $file_size bytes." + echo "$file_size" + else + say_verbose "Content-Length header was not extracted for $zip_uri." + echo "" + fi +} + # args: # zip_path - $1 # out_path - $2 +# remote_file_size - $3 extract_dotnet_package() { eval $invocation local zip_path="$1" local out_path="$2" + local remote_file_size="$3" local temp_out_path="$(mktemp -d "$temporary_file_template")" @@ -931,7 +989,9 @@ extract_dotnet_package() { local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - + + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" + rm -rf "$temp_out_path" rm -f "$zip_path" && say_verbose "Temporary zip file $zip_path was removed" @@ -1427,6 +1487,7 @@ install_dotnet() { eval $invocation local download_failed=false local download_completed=false + local remote_file_size='' mkdir -p "$install_root" zip_path="$(mktemp "$temporary_file_template")" @@ -1467,8 +1528,10 @@ install_dotnet() { return 1 fi + remote_file_size="$(get_remote_file_size "$download_link")" + say "Extracting zip from $download_link" - extract_dotnet_package "$zip_path" "$install_root" || return 1 + extract_dotnet_package "$zip_path" "$install_root" "$remote_file_size" || return 1 # Check if the SDK version is installed; if not, fail the installation. # if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed. @@ -1743,4 +1806,4 @@ fi say "Note that the script does not resolve dependencies during installation." say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." -say "Installation finished successfully." +say "Installation finished successfully." \ No newline at end of file From e4db8cc43ad0203ec0eac25ad3d0a977fb73f7cf Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 03:22:15 +0200 Subject: [PATCH 03/16] Add feature of prefering already installed versions --- .github/workflows/test-dotnet.yml | 22 ++ action.yml | 4 + dist/cache-save/index.js | 426 +++++++++++++++--------------- dist/setup/index.js | 99 ++++++- src/dotnet-utils.ts | 37 +++ src/installer.ts | 39 ++- src/setup-dotnet.ts | 7 +- 7 files changed, 407 insertions(+), 227 deletions(-) create mode 100644 src/dotnet-utils.ts diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index 87fd241fe..a8b9e2980 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -41,3 +41,25 @@ jobs: shell: pwsh run: | __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" + setup-versions-prefer-installed: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macOS-latest] + dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0'] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} + - name: Setup dotnet ${{ matrix.dotnet-version }} + uses: ./ + with: + dotnet-version: ${{ matrix.dotnet-version }} + prefer-installed: true + - name: Verify installed version + shell: pwsh + run: | + __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" diff --git a/action.yml b/action.yml index bf24aca99..825a18e6f 100644 --- a/action.yml +++ b/action.yml @@ -9,6 +9,10 @@ inputs: description: 'Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x, 3.x, 6.0.2xx' dotnet-quality: description: 'Optional quality of the build. The possible values are: daily, signed, validated, preview, ga.' + prefer-installed: + description: 'Optional flag to prefer an already installed version of the SDK (when partial version syntax is used). If not provided, latest version with specified quality will be installed.' + required: false + default: false global-json-file: description: 'Optional global.json location, if your global.json isn''t located in the root of the repo.' source-url: diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 60557b041..e105a4b39 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -58523,91 +58523,91 @@ exports["default"] = _default; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.run = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const cache = __importStar(__nccwpck_require__(7799)); -const node_fs_1 = __importDefault(__nccwpck_require__(7561)); -const cache_utils_1 = __nccwpck_require__(1678); -const constants_1 = __nccwpck_require__(9042); -// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in -// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to -// throw an uncaught exception. Instead of failing this action, just warn. -process.on('uncaughtException', e => { - const warningPrefix = '[warning]'; - core.info(`${warningPrefix}${e.message}`); -}); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - if (core.getBooleanInput('cache')) { - yield cachePackages(); - } - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.run = run; -const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { - const state = core.getState(constants_1.State.CacheMatchedKey); - const primaryKey = core.getState(constants_1.State.CachePrimaryKey); - if (!primaryKey) { - core.info('Primary key was not generated, not saving cache.'); - return; - } - const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)(); - if (!node_fs_1.default.existsSync(cachePath)) { - throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`); - } - if (primaryKey === state) { - core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); - return; - } - const cacheId = yield cache.saveCache([cachePath], primaryKey); - if (cacheId == -1) { - return; - } - core.info(`Cache saved with the key: ${primaryKey}`); -}); -run(); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.run = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const cache = __importStar(__nccwpck_require__(7799)); +const node_fs_1 = __importDefault(__nccwpck_require__(7561)); +const cache_utils_1 = __nccwpck_require__(1678); +const constants_1 = __nccwpck_require__(9042); +// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in +// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to +// throw an uncaught exception. Instead of failing this action, just warn. +process.on('uncaughtException', e => { + const warningPrefix = '[warning]'; + core.info(`${warningPrefix}${e.message}`); +}); +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + if (core.getBooleanInput('cache')) { + yield cachePackages(); + } + } + catch (error) { + core.setFailed(error.message); + } + }); +} +exports.run = run; +const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { + const state = core.getState(constants_1.State.CacheMatchedKey); + const primaryKey = core.getState(constants_1.State.CachePrimaryKey); + if (!primaryKey) { + core.info('Primary key was not generated, not saving cache.'); + return; + } + const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)(); + if (!node_fs_1.default.existsSync(cachePath)) { + throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`); + } + if (primaryKey === state) { + core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); + return; + } + const cacheId = yield cache.saveCache([cachePath], primaryKey); + if (cacheId == -1) { + return; + } + core.info(`Cache saved with the key: ${primaryKey}`); +}); +run(); /***/ }), @@ -58616,114 +58616,114 @@ run(); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0; -const cache = __importStar(__nccwpck_require__(7799)); -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); -const constants_1 = __nccwpck_require__(9042); -/** - * Get NuGet global packages, cache, and temp folders from .NET CLI. - * @returns (Folder Name)-(Path) mappings - * @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders - * @example - * Windows - * ```json - * { - * "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache", - * "global-packages": "C:\\Users\\user1\\.nuget\\packages\\", - * "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch", - * "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache" - * } - * ``` - * - * Mac/Linux - * ```json - * { - * "http-cache": "/home/user1/.local/share/NuGet/v3-cache", - * "global-packages": "/home/user1/.nuget/packages/", - * "temp": "/tmp/NuGetScratch", - * "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache" - * } - * ``` - */ -const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () { - const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true }); - if (exitCode) { - throw new Error(!stderr.trim() - ? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}` - : stderr); - } - const result = { - 'http-cache': '', - 'global-packages': '', - temp: '', - 'plugins-cache': '' - }; - const regex = /(?:^|\s)(?[a-z-]+): (?.+[/\\].+)$/gm; - let match; - while ((match = regex.exec(stdout)) !== null) { - const key = match.groups.key; - if (key in result) { - result[key] = match.groups.path; - } - } - return result; -}); -exports.getNuGetFolderPath = getNuGetFolderPath; -function isCacheFeatureAvailable() { - if (cache.isFeatureAvailable()) { - return true; - } - if (isGhes()) { - core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); - return false; - } - core.warning('The runner was not able to contact the cache service. Caching will be skipped'); - return false; -} -exports.isCacheFeatureAvailable = isCacheFeatureAvailable; -/** - * Returns this action runs on GitHub Enterprise Server or not. - * (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134) - */ -function isGhes() { - const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; - return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'; -} + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0; +const cache = __importStar(__nccwpck_require__(7799)); +const core = __importStar(__nccwpck_require__(2186)); +const exec = __importStar(__nccwpck_require__(1514)); +const constants_1 = __nccwpck_require__(9042); +/** + * Get NuGet global packages, cache, and temp folders from .NET CLI. + * @returns (Folder Name)-(Path) mappings + * @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders + * @example + * Windows + * ```json + * { + * "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache", + * "global-packages": "C:\\Users\\user1\\.nuget\\packages\\", + * "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch", + * "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache" + * } + * ``` + * + * Mac/Linux + * ```json + * { + * "http-cache": "/home/user1/.local/share/NuGet/v3-cache", + * "global-packages": "/home/user1/.nuget/packages/", + * "temp": "/tmp/NuGetScratch", + * "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache" + * } + * ``` + */ +const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true }); + if (exitCode) { + throw new Error(!stderr.trim() + ? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}` + : stderr); + } + const result = { + 'http-cache': '', + 'global-packages': '', + temp: '', + 'plugins-cache': '' + }; + const regex = /(?:^|\s)(?[a-z-]+): (?.+[/\\].+)$/gm; + let match; + while ((match = regex.exec(stdout)) !== null) { + const key = match.groups.key; + if (key in result) { + result[key] = match.groups.path; + } + } + return result; +}); +exports.getNuGetFolderPath = getNuGetFolderPath; +function isCacheFeatureAvailable() { + if (cache.isFeatureAvailable()) { + return true; + } + if (isGhes()) { + core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); + return false; + } + core.warning('The runner was not able to contact the cache service. Caching will be skipped'); + return false; +} +exports.isCacheFeatureAvailable = isCacheFeatureAvailable; +/** + * Returns this action runs on GitHub Enterprise Server or not. + * (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134) + */ +function isGhes() { + const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; + return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'; +} /***/ }), @@ -58732,26 +58732,26 @@ function isGhes() { /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0; -/** NuGet lock file patterns */ -exports.lockFilePatterns = ['packages.lock.json']; -/** - * .NET CLI command to list local NuGet resources. - * @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals - */ -exports.cliCommand = 'dotnet nuget locals all --list --force-english-output'; -var State; -(function (State) { - State["CachePrimaryKey"] = "CACHE_KEY"; - State["CacheMatchedKey"] = "CACHE_RESULT"; -})(State = exports.State || (exports.State = {})); -var Outputs; -(function (Outputs) { - Outputs["CacheHit"] = "cache-hit"; - Outputs["DotnetVersion"] = "dotnet-version"; -})(Outputs = exports.Outputs || (exports.Outputs = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0; +/** NuGet lock file patterns */ +exports.lockFilePatterns = ['packages.lock.json']; +/** + * .NET CLI command to list local NuGet resources. + * @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals + */ +exports.cliCommand = 'dotnet nuget locals all --list --force-english-output'; +var State; +(function (State) { + State["CachePrimaryKey"] = "CACHE_KEY"; + State["CacheMatchedKey"] = "CACHE_RESULT"; +})(State = exports.State || (exports.State = {})); +var Outputs; +(function (Outputs) { + Outputs["CacheHit"] = "cache-hit"; + Outputs["DotnetVersion"] = "dotnet-version"; +})(Outputs = exports.Outputs || (exports.Outputs = {})); /***/ }), diff --git a/dist/setup/index.js b/dist/setup/index.js index 2cb466866..97ddf8491 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -72745,6 +72745,77 @@ var Outputs; })(Outputs = exports.Outputs || (exports.Outputs = {})); +/***/ }), + +/***/ 2971: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.matchVersionToList = exports.listSdks = void 0; +const exec = __importStar(__nccwpck_require__(1514)); +const listSdks = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout, exitCode } = yield exec.getExecOutput('dotnet', ['--list-sdks'], { + ignoreReturnCode: true + }); + if (exitCode) { + return []; + } + return (stdout + .trim() + .split('\n') + .map(versionInfo => versionInfo.trim()) + .map(versionInfo => versionInfo.split(' ')[0]) + // reverses output so newer versions are first + .reverse()); +}); +exports.listSdks = listSdks; +/** + * Function that matches string like that + * '3.1', '3.1.x', '3', '3.x', '6.0.4xx' to + * correct version number like '3.1.201', '3.1.201', '3.1.201', '3.1.201', '6.0.402' + */ +const matchVersionToList = (version, versions) => { + const versionRegex = new RegExp(`^${version.replace(/x/g, '\\d+')}`); + const matchedVersion = versions.find(v => versionRegex.test(v)); + return matchedVersion; +}; +exports.matchVersionToList = matchVersionToList; + + /***/ }), /***/ 2574: @@ -72799,10 +72870,12 @@ const path_1 = __importDefault(__nccwpck_require__(1017)); const os_1 = __importDefault(__nccwpck_require__(2037)); const semver_1 = __importDefault(__nccwpck_require__(5911)); const utils_1 = __nccwpck_require__(1314); +const dotnet_utils_1 = __nccwpck_require__(2971); const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6; const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5; class DotnetVersionResolver { - constructor(version) { + constructor(version, preferInstalled = false) { + this.preferInstalled = preferInstalled; this.inputVersion = version.trim(); this.resolvedArgument = { type: '', value: '', qualityFlag: false }; } @@ -72813,10 +72886,20 @@ class DotnetVersionResolver { } if (semver_1.default.valid(this.inputVersion)) { this.createVersionArgument(); + return; } - else { + if (!this.preferInstalled) { yield this.createChannelArgument(); + return; + } + const requestedVersion = this.inputVersion; + const installedVersions = yield (0, dotnet_utils_1.listSdks)(); + const matchingInstalledVersion = (0, dotnet_utils_1.matchVersionToList)(requestedVersion, installedVersions); + if (matchingInstalledVersion === undefined) { + this.createChannelArgument(); + return; } + this.createVersionArgument(matchingInstalledVersion); }); } isNumericTag(versionTag) { @@ -72831,9 +72914,9 @@ class DotnetVersionResolver { } return majorTag ? true : false; } - createVersionArgument() { + createVersionArgument(updatedVersion) { this.resolvedArgument.type = 'version'; - this.resolvedArgument.value = this.inputVersion; + this.resolvedArgument.value = updatedVersion !== null && updatedVersion !== void 0 ? updatedVersion : this.inputVersion; } createChannelArgument() { return __awaiter(this, void 0, void 0, function* () { @@ -72993,13 +73076,14 @@ DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR'] ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) : DotnetInstallDir.default[utils_1.PLATFORM]; class DotnetCoreInstaller { - constructor(version, quality) { + constructor(version, quality, preferInstalled = false) { this.version = version; this.quality = quality; + this.preferInstalled = preferInstalled; } installDotnet() { return __awaiter(this, void 0, void 0, function* () { - const versionResolver = new DotnetVersionResolver(this.version); + const versionResolver = new DotnetVersionResolver(this.version, this.preferInstalled); const dotnetVersion = yield versionResolver.createDotnetVersion(); /** * Install dotnet runitme first in order to get @@ -73148,13 +73232,14 @@ function run() { } if (versions.length) { const quality = core.getInput('dotnet-quality'); + const preferInstalled = core.getBooleanInput('prefer-installed'); if (quality && !qualityOptions.includes(quality)) { throw new Error(`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`); } let dotnetInstaller; const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { - dotnetInstaller = new installer_1.DotnetCoreInstaller(version, quality); + dotnetInstaller = new installer_1.DotnetCoreInstaller(version, quality, preferInstalled); const installedVersion = yield dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); } diff --git a/src/dotnet-utils.ts b/src/dotnet-utils.ts new file mode 100644 index 000000000..a4e45b628 --- /dev/null +++ b/src/dotnet-utils.ts @@ -0,0 +1,37 @@ +import * as exec from '@actions/exec'; + +export const listSdks = async () => { + const {stdout, exitCode} = await exec.getExecOutput( + 'dotnet', + ['--list-sdks'], + { + ignoreReturnCode: true + } + ); + + if (exitCode) { + return []; + } + + return ( + stdout + .trim() + .split('\n') + .map(versionInfo => versionInfo.trim()) + .map(versionInfo => versionInfo.split(' ')[0]) + // reverses output so newer versions are first + .reverse() + ); +}; + +/** + * Function that matches string like that + * '3.1', '3.1.x', '3', '3.x', '6.0.4xx' to + * correct version number like '3.1.201', '3.1.201', '3.1.201', '3.1.201', '6.0.402' + */ +export const matchVersionToList = (version: string, versions: string[]) => { + const versionRegex = new RegExp(`^${version.replace(/x/g, '\\d+')}`); + const matchedVersion = versions.find(v => versionRegex.test(v)); + + return matchedVersion; +}; diff --git a/src/installer.ts b/src/installer.ts index 4900afa3a..cd1f7edee 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -9,6 +9,7 @@ import os from 'os'; import semver from 'semver'; import {IS_WINDOWS, PLATFORM} from './utils'; import {QualityOptions} from './setup-dotnet'; +import {listSdks, matchVersionToList} from './dotnet-utils'; export interface DotnetVersion { type: string; @@ -22,7 +23,7 @@ export class DotnetVersionResolver { private inputVersion: string; private resolvedArgument: DotnetVersion; - constructor(version: string) { + constructor(version: string, private preferInstalled = false) { this.inputVersion = version.trim(); this.resolvedArgument = {type: '', value: '', qualityFlag: false}; } @@ -33,11 +34,30 @@ export class DotnetVersionResolver { `The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x, A.B.Cxx` ); } + if (semver.valid(this.inputVersion)) { this.createVersionArgument(); - } else { + return; + } + + if (!this.preferInstalled) { await this.createChannelArgument(); + return; } + + const requestedVersion = this.inputVersion; + const installedVersions = await listSdks(); + const matchingInstalledVersion = matchVersionToList( + requestedVersion, + installedVersions + ); + + if (matchingInstalledVersion === undefined) { + this.createChannelArgument(); + return; + } + + this.createVersionArgument(matchingInstalledVersion); } private isNumericTag(versionTag): boolean { @@ -59,9 +79,9 @@ export class DotnetVersionResolver { return majorTag ? true : false; } - private createVersionArgument() { + private createVersionArgument(updatedVersion?: string) { this.resolvedArgument.type = 'version'; - this.resolvedArgument.value = this.inputVersion; + this.resolvedArgument.value = updatedVersion ?? this.inputVersion; } private async createChannelArgument() { @@ -253,10 +273,17 @@ export class DotnetCoreInstaller { DotnetInstallDir.setEnvironmentVariable(); } - constructor(private version: string, private quality: QualityOptions) {} + constructor( + private version: string, + private quality: QualityOptions, + private preferInstalled = false + ) {} public async installDotnet(): Promise { - const versionResolver = new DotnetVersionResolver(this.version); + const versionResolver = new DotnetVersionResolver( + this.version, + this.preferInstalled + ); const dotnetVersion = await versionResolver.createDotnetVersion(); /** diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 2a628a5ab..292e6daac 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -59,6 +59,7 @@ export async function run() { if (versions.length) { const quality = core.getInput('dotnet-quality') as QualityOptions; + const preferInstalled = core.getBooleanInput('prefer-installed'); if (quality && !qualityOptions.includes(quality)) { throw new Error( @@ -69,7 +70,11 @@ export async function run() { let dotnetInstaller: DotnetCoreInstaller; const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { - dotnetInstaller = new DotnetCoreInstaller(version, quality); + dotnetInstaller = new DotnetCoreInstaller( + version, + quality, + preferInstalled + ); const installedVersion = await dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); } From 14b07e8557b734de23eaf2cfabe07289eb5c682f Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 03:35:07 +0200 Subject: [PATCH 04/16] Update integration tests --- .github/workflows/test-dotnet.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index a8b9e2980..c031904f6 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -41,20 +41,10 @@ jobs: shell: pwsh run: | __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" - setup-versions-prefer-installed: - runs-on: ${{ matrix.operating-system }} - strategy: - fail-fast: false - matrix: - operating-system: [ubuntu-latest, windows-latest, macOS-latest] - dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0'] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Clear toolcache + - name: List installed versions shell: pwsh - run: __tests__/clear-toolcache.ps1 ${{ runner.os }} - - name: Setup dotnet ${{ matrix.dotnet-version }} + run: dotnet --list-sdks + - name: Run setup again with prefer installed option uses: ./ with: dotnet-version: ${{ matrix.dotnet-version }} @@ -63,3 +53,6 @@ jobs: shell: pwsh run: | __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" + - name: List installed versions + shell: pwsh + run: dotnet --list-sdks From 131be14d587db9d206a02b3866f1afc029b3bcd1 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 03:47:21 +0200 Subject: [PATCH 05/16] Update e2e tests --- .github/workflows/test-dotnet.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index c031904f6..320876a98 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -26,33 +26,42 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest, windows-latest, macOS-latest] - dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0'] + dotnet-version: [ + ['2.1', '2.x'], + ['2.2', '2.x'], + ['3.0', '3.x'], + ['3.1', '3.x'], + ['5.0','5.x'], + ['6.0', '6.x'], + ['7.0', '7.x'], + ['8.0', '8.x'] + ] steps: - name: Checkout uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} - - name: Setup dotnet ${{ matrix.dotnet-version }} + - name: Setup dotnet ${{ matrix.dotnet-version[0] }} uses: ./ with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: ${{ matrix.dotnet-version[0] }} - name: Verify installed version shell: pwsh run: | - __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" + __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version[0] }}" - name: List installed versions shell: pwsh run: dotnet --list-sdks - name: Run setup again with prefer installed option uses: ./ with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: ${{ matrix.dotnet-version[1] }} prefer-installed: true - name: Verify installed version shell: pwsh run: | - __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" + __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version[0] }}" - name: List installed versions shell: pwsh run: dotnet --list-sdks From 9246a37d284977d3c2af44727c9cdd1ef88af531 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 03:47:39 +0200 Subject: [PATCH 06/16] Update e2e tests --- .github/workflows/test-dotnet.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index 320876a98..c073af943 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -26,16 +26,17 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest, windows-latest, macOS-latest] - dotnet-version: [ - ['2.1', '2.x'], - ['2.2', '2.x'], - ['3.0', '3.x'], - ['3.1', '3.x'], - ['5.0','5.x'], - ['6.0', '6.x'], - ['7.0', '7.x'], - ['8.0', '8.x'] - ] + dotnet-version: + [ + ['2.1', '2.x'], + ['2.2', '2.x'], + ['3.0', '3.x'], + ['3.1', '3.x'], + ['5.0', '5.x'], + ['6.0', '6.x'], + ['7.0', '7.x'], + ['8.0', '8.x'] + ] steps: - name: Checkout uses: actions/checkout@v3 From 07be99e939b585febc0291ecfd945dfc18e1196c Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 04:05:45 +0200 Subject: [PATCH 07/16] Add additional e2e test --- .github/workflows/test-dotnet.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index c073af943..a45bce357 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -66,3 +66,24 @@ jobs: - name: List installed versions shell: pwsh run: dotnet --list-sdks + setup-version-already-installed: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} + - name: Setup dotnet 6.0 + uses: ./ + with: + dotnet-version: '6.0' + prefer-installed: true + - name: Verify installed version + shell: pwsh + run: | + __tests__/verify-dotnet.ps1 -Patterns "^6.0" From cae98c4b9e127298f443c0be9ef94d290700e67d Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 04:22:05 +0200 Subject: [PATCH 08/16] Update listSdks to not fail when dotnet util is not installed --- src/dotnet-utils.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/dotnet-utils.ts b/src/dotnet-utils.ts index a4e45b628..6ba129701 100644 --- a/src/dotnet-utils.ts +++ b/src/dotnet-utils.ts @@ -1,13 +1,11 @@ import * as exec from '@actions/exec'; export const listSdks = async () => { - const {stdout, exitCode} = await exec.getExecOutput( - 'dotnet', - ['--list-sdks'], - { + const {stdout, exitCode} = await exec + .getExecOutput('dotnet', ['--list-sdks'], { ignoreReturnCode: true - } - ); + }) + .catch(() => ({stdout: '', exitCode: 1})); if (exitCode) { return []; From 507e1363641eb4e7ed08548dbf8e7b14356b8594 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 04:24:08 +0200 Subject: [PATCH 09/16] Update build --- dist/setup/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 97ddf8491..284fea07d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -72788,9 +72788,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.matchVersionToList = exports.listSdks = void 0; const exec = __importStar(__nccwpck_require__(1514)); const listSdks = () => __awaiter(void 0, void 0, void 0, function* () { - const { stdout, exitCode } = yield exec.getExecOutput('dotnet', ['--list-sdks'], { + const { stdout, exitCode } = yield exec + .getExecOutput('dotnet', ['--list-sdks'], { ignoreReturnCode: true - }); + }) + .catch(() => ({ stdout: '', exitCode: 1 })); if (exitCode) { return []; } From 7b20bfa88d3b9568e21f85a14b045d9a0f64d79d Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 05:13:00 +0200 Subject: [PATCH 10/16] Update dotnet utils, to handle more cases --- dist/setup/index.js | 10 +++++++++- src/dotnet-utils.ts | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 284fea07d..015e4ca7d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -72811,7 +72811,15 @@ exports.listSdks = listSdks; * correct version number like '3.1.201', '3.1.201', '3.1.201', '3.1.201', '6.0.402' */ const matchVersionToList = (version, versions) => { - const versionRegex = new RegExp(`^${version.replace(/x/g, '\\d+')}`); + if (!version || version === 'x' || version === '*') { + return versions.at(0); + } + const versionArray = version.split('.'); + if (versionArray.length < 3) { + versionArray.push(...Array(3 - versionArray.length).fill('x')); + } + const normalizedVersion = versionArray.join('.'); + const versionRegex = new RegExp(`^${normalizedVersion.replace(/x/g, '\\d+')}`); const matchedVersion = versions.find(v => versionRegex.test(v)); return matchedVersion; }; diff --git a/src/dotnet-utils.ts b/src/dotnet-utils.ts index 6ba129701..8a4436944 100644 --- a/src/dotnet-utils.ts +++ b/src/dotnet-utils.ts @@ -28,7 +28,21 @@ export const listSdks = async () => { * correct version number like '3.1.201', '3.1.201', '3.1.201', '3.1.201', '6.0.402' */ export const matchVersionToList = (version: string, versions: string[]) => { - const versionRegex = new RegExp(`^${version.replace(/x/g, '\\d+')}`); + if (!version || version === 'x' || version === '*') { + return versions.at(0); + } + + const versionArray = version.split('.'); + + if (versionArray.length < 3) { + versionArray.push(...Array(3 - versionArray.length).fill('x')); + } + + const normalizedVersion = versionArray.join('.'); + + const versionRegex = new RegExp( + `^${normalizedVersion.replace(/x/g, '\\d+')}` + ); const matchedVersion = versions.find(v => versionRegex.test(v)); return matchedVersion; From b995d232e6611fabb8410ac98d768bf4f717981e Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 05:13:13 +0200 Subject: [PATCH 11/16] Add unit tests --- __tests__/dotnet-utils.test.ts | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 __tests__/dotnet-utils.test.ts diff --git a/__tests__/dotnet-utils.test.ts b/__tests__/dotnet-utils.test.ts new file mode 100644 index 000000000..b4d86a57e --- /dev/null +++ b/__tests__/dotnet-utils.test.ts @@ -0,0 +1,79 @@ +import * as dotnetUtils from '../src/dotnet-utils'; +import * as exec from '@actions/exec'; + +describe('dotnet-utils', () => { + describe('matchVersionToList', () => { + it('matches all versions with all syntaxes correctly', () => { + expect( + dotnetUtils.matchVersionToList('3.1', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.matchVersionToList('3.1.x', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.matchVersionToList('3', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.matchVersionToList('3.x', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.matchVersionToList('6.0.4xx', ['3.1.201', '6.0.402']) + ).toEqual('6.0.402'); + }); + + it('returns undefined if no version is matched', () => { + expect( + dotnetUtils.matchVersionToList('6.0.5xx', ['3.1.201', '6.0.403']) + ).toEqual(undefined); + expect(dotnetUtils.matchVersionToList('6.0.5xx', [])).toEqual(undefined); + }); + + it("returns the first version if 'x' or '*' version is provided", () => { + expect( + dotnetUtils.matchVersionToList('x', ['3.1.201', '6.0.403']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.matchVersionToList('*', ['3.1.201', '6.0.403']) + ).toEqual('3.1.201'); + }); + + it('returns undefined if empty version list is provided', () => { + expect(dotnetUtils.matchVersionToList('6.0.4xx', [])).toEqual(undefined); + }); + }); + + describe('listSdks', () => { + const execSpy = jest.spyOn(exec, 'getExecOutput'); + + it('correctly parses versions from output and sorts them from newest to oldest', async () => { + const stdout = ` + 2.2.207 [C:\\Users\\User_Name\\AppData\\Local\\Microsoft\\dotnet\\sdk] + 6.0.413 [C:\\Users\\User_Name\\AppData\\Local\\Microsoft\\dotnet\\sdk] + 6.0.414 [C:\\Users\\User_Name\\AppData\\Local\\Microsoft\\dotnet\\sdk] + `; + + execSpy.mockImplementationOnce(() => + Promise.resolve({stdout, exitCode: 0, stderr: ''}) + ); + expect(await dotnetUtils.listSdks()).toEqual([ + '6.0.414', + '6.0.413', + '2.2.207' + ]); + }); + + it('returns empty array if exit code is not 0', async () => { + execSpy.mockImplementationOnce(() => + Promise.resolve({stdout: '', exitCode: 1, stderr: 'arbitrary error'}) + ); + expect(await dotnetUtils.listSdks()).toEqual([]); + }); + + it('returns empty array on error', async () => { + execSpy.mockImplementationOnce(() => + Promise.reject(new Error('arbitrary error')) + ); + expect(await dotnetUtils.listSdks()).toEqual([]); + }); + }); +}); From f44ad15e921b8c1c66157ab90445ab40c3d45b01 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 05:37:08 +0200 Subject: [PATCH 12/16] Move e2e test to appropriate workflow --- .github/workflows/e2e-tests.yml | 28 ++++++++++++++ .github/workflows/test-dotnet.yml | 62 ++----------------------------- 2 files changed, 32 insertions(+), 58 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 332eebccb..01b980fc0 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -481,3 +481,31 @@ jobs: - name: Verify dotnet (higher version) shell: pwsh run: __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.lower-version }}$", "^${{ matrix.higher-version }}$" + + test-version-already-installed: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macos-latest] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.sh ${{ runner.os }} + - name: Setup dotnet (first) + uses: ./ + with: + dotnet-version: '6.0' + - name: Verify dotnet (first) + shell: pwsh + run: __tests__/verify-dotnet.ps1 -Patterns "^6.0" + - name: Setup dotnet (same major, any minor) + uses: ./ + with: + dotnet-version: '6.x' + prefer-installed: true + - name: Verify dotnet (same major, any minor) + shell: pwsh + run: __tests__/verify-dotnet.ps1 -Patterns "^6.0" diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index a45bce357..03b9a294b 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -12,78 +12,24 @@ on: - '**.md' jobs: - check-installed: - runs-on: 'windows-latest' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Clear toolcache - shell: pwsh - run: dotnet --list-sdks setup-version: runs-on: ${{ matrix.operating-system }} strategy: fail-fast: false matrix: operating-system: [ubuntu-latest, windows-latest, macOS-latest] - dotnet-version: - [ - ['2.1', '2.x'], - ['2.2', '2.x'], - ['3.0', '3.x'], - ['3.1', '3.x'], - ['5.0', '5.x'], - ['6.0', '6.x'], - ['7.0', '7.x'], - ['8.0', '8.x'] - ] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Clear toolcache - shell: pwsh - run: __tests__/clear-toolcache.ps1 ${{ runner.os }} - - name: Setup dotnet ${{ matrix.dotnet-version[0] }} - uses: ./ - with: - dotnet-version: ${{ matrix.dotnet-version[0] }} - - name: Verify installed version - shell: pwsh - run: | - __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version[0] }}" - - name: List installed versions - shell: pwsh - run: dotnet --list-sdks - - name: Run setup again with prefer installed option - uses: ./ - with: - dotnet-version: ${{ matrix.dotnet-version[1] }} - prefer-installed: true - - name: Verify installed version - shell: pwsh - run: | - __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version[0] }}" - - name: List installed versions - shell: pwsh - run: dotnet --list-sdks - setup-version-already-installed: - runs-on: ${{ matrix.operating-system }} - strategy: - fail-fast: false - matrix: - operating-system: [ubuntu-latest, windows-latest, macOS-latest] + dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0'] steps: - name: Checkout uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} - - name: Setup dotnet 6.0 + - name: Setup dotnet ${{ matrix.dotnet-version }} uses: ./ with: - dotnet-version: '6.0' - prefer-installed: true + dotnet-version: ${{ matrix.dotnet-version }} - name: Verify installed version shell: pwsh run: | - __tests__/verify-dotnet.ps1 -Patterns "^6.0" + __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}" From 9191e7ea2f17204a3a2c21a6164caed21449a661 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 05:49:20 +0200 Subject: [PATCH 13/16] Fix typo in e2e test --- .github/workflows/e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 01b980fc0..0c9146ca9 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -493,7 +493,7 @@ jobs: uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh - run: __tests__/clear-toolcache.sh ${{ runner.os }} + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} - name: Setup dotnet (first) uses: ./ with: From d903b6184b64332470a09a17d00cb52809f6c87a Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 06:03:28 +0200 Subject: [PATCH 14/16] Eliminate hard dependency on version resolver in installer --- src/installer.ts | 11 ++--------- src/setup-dotnet.ts | 8 +++++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index cd1f7edee..c46b9b930 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -274,18 +274,11 @@ export class DotnetCoreInstaller { } constructor( - private version: string, + private dotnetVersion: DotnetVersion, private quality: QualityOptions, - private preferInstalled = false ) {} public async installDotnet(): Promise { - const versionResolver = new DotnetVersionResolver( - this.version, - this.preferInstalled - ); - const dotnetVersion = await versionResolver.createDotnetVersion(); - /** * Install dotnet runitme first in order to get * the latest stable version of dotnet CLI @@ -321,7 +314,7 @@ export class DotnetCoreInstaller { IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files' ) // Use version provided by user - .useVersion(dotnetVersion, this.quality) + .useVersion(this.dotnetVersion, this.quality) .execute(); if (dotnetInstallOutput.exitCode) { diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 292e6daac..3ade9d96e 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -1,5 +1,5 @@ import * as core from '@actions/core'; -import {DotnetCoreInstaller, DotnetInstallDir} from './installer'; +import {DotnetCoreInstaller, DotnetInstallDir, DotnetVersionResolver} from './installer'; import * as fs from 'fs'; import path from 'path'; import semver from 'semver'; @@ -68,12 +68,14 @@ export async function run() { } let dotnetInstaller: DotnetCoreInstaller; + let dotnetVersionResolver: DotnetVersionResolver; + const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { + dotnetVersionResolver = new DotnetVersionResolver(version, preferInstalled); dotnetInstaller = new DotnetCoreInstaller( - version, + await dotnetVersionResolver.createDotnetVersion(), quality, - preferInstalled ); const installedVersion = await dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); From 67c4cb799b2940e0ce8962a9f1c103e75c0374f5 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 06:14:01 +0200 Subject: [PATCH 15/16] Format & build --- dist/setup/index.js | 13 ++++++------- src/installer.ts | 2 +- src/setup-dotnet.ts | 13 ++++++++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 015e4ca7d..b01f1671f 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -73086,15 +73086,12 @@ DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR'] ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) : DotnetInstallDir.default[utils_1.PLATFORM]; class DotnetCoreInstaller { - constructor(version, quality, preferInstalled = false) { - this.version = version; + constructor(dotnetVersion, quality) { + this.dotnetVersion = dotnetVersion; this.quality = quality; - this.preferInstalled = preferInstalled; } installDotnet() { return __awaiter(this, void 0, void 0, function* () { - const versionResolver = new DotnetVersionResolver(this.version, this.preferInstalled); - const dotnetVersion = yield versionResolver.createDotnetVersion(); /** * Install dotnet runitme first in order to get * the latest stable version of dotnet CLI @@ -73122,7 +73119,7 @@ class DotnetCoreInstaller { // Don't overwrite CLI because it should be already installed .useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') // Use version provided by user - .useVersion(dotnetVersion, this.quality) + .useVersion(this.dotnetVersion, this.quality) .execute(); if (dotnetInstallOutput.exitCode) { throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`); @@ -73247,9 +73244,11 @@ function run() { throw new Error(`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`); } let dotnetInstaller; + let dotnetVersionResolver; const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { - dotnetInstaller = new installer_1.DotnetCoreInstaller(version, quality, preferInstalled); + dotnetVersionResolver = new installer_1.DotnetVersionResolver(version, preferInstalled); + dotnetInstaller = new installer_1.DotnetCoreInstaller(yield dotnetVersionResolver.createDotnetVersion(), quality); const installedVersion = yield dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); } diff --git a/src/installer.ts b/src/installer.ts index c46b9b930..b31ebd993 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -275,7 +275,7 @@ export class DotnetCoreInstaller { constructor( private dotnetVersion: DotnetVersion, - private quality: QualityOptions, + private quality: QualityOptions ) {} public async installDotnet(): Promise { diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 3ade9d96e..2b8c6a689 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -1,5 +1,9 @@ import * as core from '@actions/core'; -import {DotnetCoreInstaller, DotnetInstallDir, DotnetVersionResolver} from './installer'; +import { + DotnetCoreInstaller, + DotnetInstallDir, + DotnetVersionResolver +} from './installer'; import * as fs from 'fs'; import path from 'path'; import semver from 'semver'; @@ -72,10 +76,13 @@ export async function run() { const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { - dotnetVersionResolver = new DotnetVersionResolver(version, preferInstalled); + dotnetVersionResolver = new DotnetVersionResolver( + version, + preferInstalled + ); dotnetInstaller = new DotnetCoreInstaller( await dotnetVersionResolver.createDotnetVersion(), - quality, + quality ); const installedVersion = await dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); From cd87e994308c0a0349f9260b50b2bdf064f19b2f Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Mon, 4 Sep 2023 06:53:11 +0200 Subject: [PATCH 16/16] Update tests according to new api --- __tests__/installer.test.ts | 57 +++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 84aea3200..e1bcf2843 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -42,6 +42,10 @@ describe('installer tests', () => { const inputQuality = '' as QualityOptions; const errorMessage = 'fictitious error message!'; + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 1, @@ -51,7 +55,7 @@ describe('installer tests', () => { }); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); await expect(dotnetInstaller.installDotnet()).rejects.toThrow( @@ -63,6 +67,11 @@ describe('installer tests', () => { const inputVersion = '3.1.100'; const inputQuality = '' as QualityOptions; const stdout = `Fictitious dotnet version ${inputVersion} is installed`; + + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 0, @@ -73,7 +82,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); const installedVersion = await dotnetInstaller.installDotnet(); @@ -86,6 +95,10 @@ describe('installer tests', () => { const inputQuality = '' as QualityOptions; const stdout = `Fictitious dotnet version ${inputVersion} is installed`; + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 0, @@ -96,7 +109,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); @@ -123,6 +136,11 @@ describe('installer tests', () => { const inputVersion = '6.0.300'; const inputQuality = 'ga' as QualityOptions; const stdout = `Fictitious dotnet version ${inputVersion} is installed`; + + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 0, @@ -133,7 +151,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); @@ -149,6 +167,10 @@ describe('installer tests', () => { const inputQuality = 'ga' as QualityOptions; const stdout = `Fictitious dotnet version 3.1.100 is installed`; + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 0, @@ -159,7 +181,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); @@ -173,6 +195,10 @@ describe('installer tests', () => { each(['6', '6.0', '6.0.x', '6.0.*', '6.0.X']).test( `should supply 'quality' argument to the installation script if quality input is set and version (%s) is not in A.B.C syntax`, async inputVersion => { + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + const inputQuality = 'ga' as QualityOptions; const exitCode = 0; const stdout = `Fictitious dotnet version 6.0.0 is installed`; @@ -186,7 +212,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); @@ -216,6 +242,11 @@ describe('installer tests', () => { const inputQuality = '' as QualityOptions; const exitCode = 0; const stdout = `Fictitious dotnet version 6.0.0 is installed`; + + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: exitCode, @@ -226,7 +257,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); @@ -257,6 +288,10 @@ describe('installer tests', () => { const inputQuality = '' as QualityOptions; const stdout = `Fictitious dotnet version ${inputVersion} is installed`; + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 0, @@ -267,7 +302,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality ); @@ -295,6 +330,10 @@ describe('installer tests', () => { const inputQuality = '' as QualityOptions; const stdout = `Fictitious dotnet version 6.0.0 is installed`; + const resolvedVersion = await new installer.DotnetVersionResolver( + inputVersion + ).createDotnetVersion(); + getExecOutputSpy.mockImplementation(() => { return Promise.resolve({ exitCode: 0, @@ -305,7 +344,7 @@ describe('installer tests', () => { maxSatisfyingSpy.mockImplementation(() => inputVersion); const dotnetInstaller = new installer.DotnetCoreInstaller( - inputVersion, + resolvedVersion, inputQuality );