mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-20 23:50:19 +00:00
add wildcard to testcase
- updated README & action.yml - moved addToPath -> getDotet in installer.test
This commit is contained in:
parent
fe6123a5c5
commit
3e4bb40ad3
1
.github/workflows/workflow.yml
vendored
1
.github/workflows/workflow.yml
vendored
@ -51,6 +51,7 @@ jobs:
|
|||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
2.2.402
|
2.2.402
|
||||||
3.1.404
|
3.1.404
|
||||||
|
3.0.x
|
||||||
- name: Verify dotnet
|
- name: Verify dotnet
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404
|
run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for use in actions by:
|
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
|
- registering problem matchers for error output
|
||||||
- setting up authentication to private package sources like GitHub Packages
|
- setting up authentication to private package sources like GitHub Packages
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ steps:
|
|||||||
- run: dotnet build <my project>
|
- run: dotnet build <my project>
|
||||||
```
|
```
|
||||||
Multiple versions:
|
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
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
@ -37,8 +39,8 @@ steps:
|
|||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
|
5.0.402
|
||||||
3.1.201
|
3.1.201
|
||||||
2.2.207
|
|
||||||
- run: dotnet build <my project>
|
- run: dotnet build <my project>
|
||||||
```
|
```
|
||||||
Preview version:
|
Preview version:
|
||||||
|
@ -38,7 +38,6 @@ describe('installer tests', () => {
|
|||||||
for (const version of versions) {
|
for (const version of versions) {
|
||||||
await getDotnet(version);
|
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', '2.2.207'))).toBe(true);
|
||||||
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.120'))).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 () => {
|
it('Acquires version of dotnet if no matching version is installed', async () => {
|
||||||
await getDotnet('3.1.201');
|
await getDotnet('3.1.201');
|
||||||
installer.DotnetCoreInstaller.addToPath();
|
|
||||||
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
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 () => {
|
it('Acquires generic version of dotnet if no matching version is installed', async () => {
|
||||||
await getDotnet('3.1');
|
await getDotnet('3.1');
|
||||||
installer.DotnetCoreInstaller.addToPath();
|
|
||||||
var directory = fs
|
var directory = fs
|
||||||
.readdirSync(path.join(toolDir, 'sdk'))
|
.readdirSync(path.join(toolDir, 'sdk'))
|
||||||
.filter(fn => fn.startsWith('3.1.'));
|
.filter(fn => fn.startsWith('3.1.'));
|
||||||
@ -150,4 +147,5 @@ function normalizeFileContents(contents: string): string {
|
|||||||
async function getDotnet(version: string): Promise<void> {
|
async function getDotnet(version: string): Promise<void> {
|
||||||
const dotnetInstaller = new installer.DotnetCoreInstaller(version);
|
const dotnetInstaller = new installer.DotnetCoreInstaller(version);
|
||||||
await dotnetInstaller.installDotnet();
|
await dotnetInstaller.installDotnet();
|
||||||
|
installer.DotnetCoreInstaller.addToPath();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ branding:
|
|||||||
color: green
|
color: green
|
||||||
inputs:
|
inputs:
|
||||||
dotnet-version:
|
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:
|
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'
|
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:
|
owner:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user