From 3e4bb40ad3486e41df360e0c69ceb02fa30c0dae Mon Sep 17 00:00:00 2001 From: La'Kaleigh Harris <35268101+Xlient@users.noreply.github.com> Date: Thu, 11 Nov 2021 22:39:29 +0000 Subject: [PATCH] add wildcard to testcase - updated README & action.yml - moved addToPath -> getDotet in installer.test --- .github/workflows/workflow.yml | 1 + README.md | 6 ++++-- __tests__/installer.test.ts | 4 +--- action.yml | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index da93b0a..8e83602 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -51,6 +51,7 @@ jobs: dotnet-version: | 2.2.402 3.1.404 + 3.0.x - name: Verify dotnet shell: pwsh run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404 diff --git a/README.md b/README.md index 94016c1..2a61109 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for use in actions by: -- optionally downloading and caching a version of dotnet by SDK version and adding to PATH +- optionally downloading and caching a version(s) of dotnet by SDK version(s) and adding to PATH - registering problem matchers for error output - setting up authentication to private package sources like GitHub Packages @@ -30,6 +30,8 @@ steps: - run: dotnet build ``` Multiple versions: +> Note: In case multiple versions are installed, the latest .NET version will be used by default unless another version is specified in the `global.json` file. + ```yml steps: - name: Setup dotnet @@ -37,8 +39,8 @@ steps: - uses: actions/setup-dotnet@v1 with: dotnet-version: | + 5.0.402 3.1.201 - 2.2.207 - run: dotnet build ``` Preview version: diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index aa7eb74..532da18 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -38,7 +38,6 @@ describe('installer tests', () => { for (const version of versions) { await getDotnet(version); } - installer.DotnetCoreInstaller.addToPath(); expect(fs.existsSync(path.join(toolDir, 'sdk', '2.2.207'))).toBe(true); expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.120'))).toBe(true); @@ -56,7 +55,6 @@ describe('installer tests', () => { it('Acquires version of dotnet if no matching version is installed', async () => { await getDotnet('3.1.201'); - installer.DotnetCoreInstaller.addToPath(); expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true); if (IS_WINDOWS) { expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true); @@ -72,7 +70,6 @@ describe('installer tests', () => { it('Acquires generic version of dotnet if no matching version is installed', async () => { await getDotnet('3.1'); - installer.DotnetCoreInstaller.addToPath(); var directory = fs .readdirSync(path.join(toolDir, 'sdk')) .filter(fn => fn.startsWith('3.1.')); @@ -150,4 +147,5 @@ function normalizeFileContents(contents: string): string { async function getDotnet(version: string): Promise { const dotnetInstaller = new installer.DotnetCoreInstaller(version); await dotnetInstaller.installDotnet(); + installer.DotnetCoreInstaller.addToPath(); } diff --git a/action.yml b/action.yml index 635e9d8..45199d3 100644 --- a/action.yml +++ b/action.yml @@ -6,7 +6,7 @@ branding: color: green inputs: dotnet-version: - description: 'Optional SDK version to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x' + 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' source-url: description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword' owner: