diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 332eebccb..0c9146ca9 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.ps1 ${{ 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/__tests__/dotnet-utils.test.ts b/__tests__/dotnet-utils.test.ts new file mode 100644 index 000000000..7305985a5 --- /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('findMatchingVersion', () => { + it('matches all versions with all syntaxes correctly', () => { + expect( + dotnetUtils.findMatchingVersion('3.1', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.findMatchingVersion('3.1.x', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.findMatchingVersion('3', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.findMatchingVersion('3.x', ['3.1.201', '6.0.402']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.findMatchingVersion('6.0.4xx', ['3.1.201', '6.0.402']) + ).toEqual('6.0.402'); + }); + + it('returns undefined if no version is matched', () => { + expect( + dotnetUtils.findMatchingVersion('6.0.5xx', ['3.1.201', '6.0.403']) + ).toEqual(undefined); + expect(dotnetUtils.findMatchingVersion('6.0.5xx', [])).toEqual(undefined); + }); + + it("returns the first version if 'x' or '*' version is provided", () => { + expect( + dotnetUtils.findMatchingVersion('x', ['3.1.201', '6.0.403']) + ).toEqual('3.1.201'); + expect( + dotnetUtils.findMatchingVersion('*', ['3.1.201', '6.0.403']) + ).toEqual('3.1.201'); + }); + + it('returns undefined if empty version list is provided', () => { + expect(dotnetUtils.findMatchingVersion('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([]); + }); + }); +}); 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 ); 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..77cb395c7 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -72745,6 +72745,86 @@ 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.findMatchingVersion = 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 + }) + .catch(() => ({ stdout: '', exitCode: 1 })); + 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 findMatchingVersion = (versionPattern, versions) => { + if (!versionPattern || versionPattern === 'x' || versionPattern === '*') { + return versions.at(0); + } + const versionArray = versionPattern.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+')}`); + return versions.find(v => versionRegex.test(v)); +}; +exports.findMatchingVersion = findMatchingVersion; + + /***/ }), /***/ 2574: @@ -72799,10 +72879,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 }; } @@ -72812,11 +72894,21 @@ class DotnetVersionResolver { throw new Error(`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_1.default.valid(this.inputVersion)) { - this.createVersionArgument(); + this.createVersionArgument(this.inputVersion); + 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.findMatchingVersion)(requestedVersion, installedVersions); + if (matchingInstalledVersion) { + this.createVersionArgument(matchingInstalledVersion); + return; + } + this.createChannelArgument(); }); } isNumericTag(versionTag) { @@ -72831,9 +72923,9 @@ class DotnetVersionResolver { } return majorTag ? true : false; } - createVersionArgument() { + createVersionArgument(version) { this.resolvedArgument.type = 'version'; - this.resolvedArgument.value = this.inputVersion; + this.resolvedArgument.value = version; } createChannelArgument() { return __awaiter(this, void 0, void 0, function* () { @@ -72993,14 +73085,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) { - this.version = version; + constructor(dotnetVersion, quality) { + this.dotnetVersion = dotnetVersion; this.quality = quality; } installDotnet() { return __awaiter(this, void 0, void 0, function* () { - const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = yield versionResolver.createDotnetVersion(); /** * Install dotnet runitme first in order to get * the latest stable version of dotnet CLI @@ -73028,7 +73118,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}`); @@ -73148,13 +73238,16 @@ 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; + let dotnetVersionResolver; const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { - dotnetInstaller = new installer_1.DotnetCoreInstaller(version, quality); + 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/externals/install-dotnet.ps1 b/externals/install-dotnet.ps1 index c9a30cb3c..e58412b56 100644 --- a/externals/install-dotnet.ps1 +++ b/externals/install-dotnet.ps1 @@ -98,6 +98,10 @@ .PARAMETER DownloadTimeout Determines timeout duration in seconds for dowloading of the SDK file Default: 1200 seconds (20 minutes) +.PARAMETER KeepZip + If set, downloaded file is kept +.PARAMETER ZipPath + Use that path to store installer, generated by default #> [cmdletbinding()] param( @@ -121,7 +125,9 @@ param( [string[]]$ProxyBypassList=@(), [switch]$SkipNonVersionedFiles, [switch]$NoCdn, - [int]$DownloadTimeout=1200 + [int]$DownloadTimeout=1200, + [switch]$KeepZip, + [string]$ZipPath=[System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) ) Set-StrictMode -Version Latest @@ -176,6 +182,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 +885,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 +902,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 +1146,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}:" } @@ -1216,7 +1270,6 @@ if ($DryRun) { Measure-Action "Installation directory preparation" { Prepare-Install-Directory } -$ZipPath = [System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) Say-Verbose "Zip path: $ZipPath" $DownloadSucceeded = $false @@ -1289,7 +1342,9 @@ if (!$isAssetInstalled) { throw "`"$assetName`" with version = $($DownloadedLink.effectiveVersion) failed to install with an unknown error." } -SafeRemoveFile -Path $ZipPath +if (-not $KeepZip) { + SafeRemoveFile -Path $ZipPath +} Measure-Action "Setting up shell environment" { Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot } @@ -1300,40 +1355,40 @@ Say "Installation finished" # SIG # Begin signature block # MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEA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VrxwkOWKzHlnFo1qGz0Iq9ImHVqr2dOC5bDVMu+jlOA1LiZC5aHxuxaHWBN73Wp7 +# Hjy8h73drsmmiXovOWly7lWLatIuPJh00iiyBXdDtjmeDjso3aadUII5FQ1QWZ4F +# 4VWo161Gx+TxGlUt//4Hns5bn4UEGE43g9OCQuQ/WFMqdb3dHCzkkHDhWHbdpBy7 +# oHHEsAdgjMdQHWfnxhCj0ZHEOupc9j1CXpQtN/B6uzsQQ/Mp34Rhsgn+/REVAwpS +# O7G69KWZrePZJiNrV/+eRn8ya6s8WNQAGB5zIQc8o+K9RGctLBOWcsRya9sqvL6r +# xUQ2 # SIG # End signature block diff --git a/externals/install-dotnet.sh b/externals/install-dotnet.sh index a830583cd..4547589b5 100755 --- a/externals/install-dotnet.sh +++ b/externals/install-dotnet.sh @@ -314,6 +314,10 @@ get_machine_architecture() { echo "ppc64le" return 0 ;; + loongarch64) + echo "loongarch64" + return 0 + ;; esac fi @@ -355,6 +359,10 @@ get_normalized_architecture_from_architecture() { echo "ppc64le" return 0 ;; + loongarch64) + echo "loongarch64" + return 0 + ;; esac say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" @@ -546,6 +554,40 @@ 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 + # hardcode in order to avoid conflicts with GNU stat + file_size="$(/usr/bin/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 [ "$remote_file_size" -ne "$file_size" ]; then + say "The remote and local file sizes are not equal. The remote file size is $remote_file_size bytes and the 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 +956,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 '{ num = $2 + 0; print num }') + elif machine_has "wget"; then + file_size=$(wget --spider --server-response -O /dev/null "$zip_uri" 2>&1 | grep -i 'Content-Length:' | awk '{ num = $2 + 0; print num }') + 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,9 +998,13 @@ 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" + if [ -z ${keep_zip+x} ]; then + rm -f "$zip_path" && say_verbose "Temporary zip file $zip_path was removed" + fi if [ "$failed" = true ]; then say_err "Extraction failed" @@ -1427,9 +1498,10 @@ install_dotnet() { eval $invocation local download_failed=false local download_completed=false + local remote_file_size=0 mkdir -p "$install_root" - zip_path="$(mktemp "$temporary_file_template")" + zip_path="${zip_path:-$(mktemp "$temporary_file_template")}" say_verbose "Zip path: $zip_path" for link_index in "${!download_links[@]}" @@ -1467,8 +1539,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. @@ -1618,6 +1692,14 @@ do override_non_versioned_files=false non_dynamic_parameters+=" $name" ;; + --keep-zip|-[Kk]eep[Zz]ip) + keep_zip=true + non_dynamic_parameters+=" $name" + ;; + --zip-path|-[Zz]ip[Pp]ath) + shift + zip_path="$1" + ;; -?|--?|-h|--help|-[Hh]elp) script_name="$(basename "$0")" echo ".NET Tools Installer" @@ -1663,7 +1745,7 @@ do echo " -InstallDir" echo " --architecture Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." echo " --arch,-Architecture,-Arch" - echo " Possible values: x64, arm, arm64, s390x and ppc64le" + echo " Possible values: x64, arm, arm64, s390x, ppc64le and loongarch64" echo " --os Specifies operating system to be used when selecting the installer." echo " Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6." echo " In case any other value is provided, the platform will be determined by the script based on machine configuration." @@ -1688,6 +1770,8 @@ do echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly." echo " --jsonfile Determines the SDK version from a user specified global.json file." echo " Note: global.json must have a value for 'SDK:Version'" + echo " --keep-zip,-KeepZip If set, downloaded file is kept." + echo " --zip-path, -ZipPath If set, downloaded file is stored at the specified path." echo " -?,--?,-h,--help,-Help Shows this help message" echo "" echo "Install Location:" diff --git a/src/dotnet-utils.ts b/src/dotnet-utils.ts new file mode 100644 index 000000000..bb15f4d81 --- /dev/null +++ b/src/dotnet-utils.ts @@ -0,0 +1,51 @@ +import * as exec from '@actions/exec'; + +export const listSdks = async () => { + const {stdout, exitCode} = await exec + .getExecOutput('dotnet', ['--list-sdks'], { + ignoreReturnCode: true + }) + .catch(() => ({stdout: '', exitCode: 1})); + + 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 findMatchingVersion = ( + versionPattern: string, + versions: string[] +): string | undefined => { + if (!versionPattern || versionPattern === 'x' || versionPattern === '*') { + return versions.at(0); + } + + const versionArray = versionPattern.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+')}` + ); + + return versions.find(v => versionRegex.test(v)); +}; diff --git a/src/installer.ts b/src/installer.ts index 4900afa3a..365956ec2 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, findMatchingVersion} 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 { + this.createVersionArgument(this.inputVersion); + return; + } + + if (!this.preferInstalled) { await this.createChannelArgument(); + return; } + + const requestedVersion = this.inputVersion; + const installedVersions = await listSdks(); + const matchingInstalledVersion = findMatchingVersion( + requestedVersion, + installedVersions + ); + + if (matchingInstalledVersion) { + this.createVersionArgument(matchingInstalledVersion); + return; + } + + this.createChannelArgument(); } private isNumericTag(versionTag): boolean { @@ -59,9 +79,9 @@ export class DotnetVersionResolver { return majorTag ? true : false; } - private createVersionArgument() { + private createVersionArgument(version: string) { this.resolvedArgument.type = 'version'; - this.resolvedArgument.value = this.inputVersion; + this.resolvedArgument.value = version; } private async createChannelArgument() { @@ -253,12 +273,12 @@ export class DotnetCoreInstaller { DotnetInstallDir.setEnvironmentVariable(); } - constructor(private version: string, private quality: QualityOptions) {} + constructor( + private readonly dotnetVersion: DotnetVersion, + private readonly quality: QualityOptions + ) {} public async installDotnet(): Promise { - const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = await versionResolver.createDotnetVersion(); - /** * Install dotnet runitme first in order to get * the latest stable version of dotnet CLI @@ -294,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 2a628a5ab..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} from './installer'; +import { + DotnetCoreInstaller, + DotnetInstallDir, + DotnetVersionResolver +} from './installer'; import * as fs from 'fs'; import path from 'path'; import semver from 'semver'; @@ -59,6 +63,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( @@ -67,9 +72,18 @@ export async function run() { } let dotnetInstaller: DotnetCoreInstaller; + let dotnetVersionResolver: DotnetVersionResolver; + const uniqueVersions = new Set(versions); for (const version of uniqueVersions) { - dotnetInstaller = new DotnetCoreInstaller(version, quality); + dotnetVersionResolver = new DotnetVersionResolver( + version, + preferInstalled + ); + dotnetInstaller = new DotnetCoreInstaller( + await dotnetVersionResolver.createDotnetVersion(), + quality + ); const installedVersion = await dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); }