mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-20 07:35:10 +00:00
Add test cases to workflow for install generic
This commit is contained in:
parent
8796bdbb05
commit
2f30b86ee7
77
.github/workflows/workflow.yml
vendored
77
.github/workflows/workflow.yml
vendored
@ -75,7 +75,82 @@ jobs:
|
||||
run: __tests__/verify-dotnet.sh 3.1.201 2.2.402
|
||||
- name: Verify dotnet (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: __tests__/verify-dotnet.ps1 3.1.201
|
||||
run: __tests__/verify-dotnet.ps1 3.1.201 2.2.402
|
||||
|
||||
# Clear cache before 2 digit install
|
||||
- name: Clear tool cache (macOS)
|
||||
if: runner.os == 'macos'
|
||||
run: |
|
||||
rm -rf "/Users/runner/.dotnet"
|
||||
- name: Clear tool cache (Ubuntu)
|
||||
if: runner.os == 'linux'
|
||||
run: |
|
||||
rm -rf "/usr/share/dotnet"
|
||||
- name: Clear tool cache (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: |
|
||||
Remove-Item $env:LocalAppData\Microsoft\dotnet/* -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item "$env:ProgramFiles\dotnet/*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
- name: Setup dotnet 2.0
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 2.0
|
||||
- name: Verify dotnet
|
||||
if: runner.os != 'windows'
|
||||
run: __tests__/verify-dotnet-version.sh 2.0.9
|
||||
- name: Verify dotnet (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: __tests__/verify-dotnet-version.ps1 2.0.9
|
||||
|
||||
# Clear cache before .x version install
|
||||
- name: Clear tool cache (macOS)
|
||||
if: runner.os == 'macos'
|
||||
run: |
|
||||
rm -rf "/Users/runner/.dotnet"
|
||||
- name: Clear tool cache (Ubuntu)
|
||||
if: runner.os == 'linux'
|
||||
run: |
|
||||
rm -rf "/usr/share/dotnet"
|
||||
- name: Clear tool cache (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: |
|
||||
Remove-Item $env:LocalAppData\Microsoft\dotnet/* -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item "$env:ProgramFiles\dotnet/*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
- name: Setup dotnet 2.0.x
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 2.0.x
|
||||
- name: Verify dotnet
|
||||
if: runner.os != 'windows'
|
||||
run: __tests__/verify-dotnet-version.sh 2.0.9
|
||||
- name: Verify dotnet (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: __tests__/verify-dotnet-version.ps1 2.0.9
|
||||
|
||||
# Clear cache before .* version install
|
||||
- name: Clear tool cache (macOS)
|
||||
if: runner.os == 'macos'
|
||||
run: |
|
||||
rm -rf "/Users/runner/.dotnet"
|
||||
- name: Clear tool cache (Ubuntu)
|
||||
if: runner.os == 'linux'
|
||||
run: |
|
||||
rm -rf "/usr/share/dotnet"
|
||||
- name: Clear tool cache (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: |
|
||||
Remove-Item $env:LocalAppData\Microsoft\dotnet/* -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item "$env:ProgramFiles\dotnet/*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
- name: Setup dotnet 2.0.*
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 2.0.*
|
||||
- name: Verify dotnet
|
||||
if: runner.os != 'windows'
|
||||
run: __tests__/verify-dotnet-version.sh 2.0.9
|
||||
- name: Verify dotnet (Windows)
|
||||
if: runner.os == 'windows'
|
||||
run: __tests__/verify-dotnet-version.ps1 2.0.9
|
||||
|
||||
test-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
|
27
__tests__/verify-dotnet-version.ps1
Normal file
27
__tests__/verify-dotnet-version.ps1
Normal file
@ -0,0 +1,27 @@
|
||||
if (!$args[0])
|
||||
{
|
||||
throw "Must supply dotnet version argument"
|
||||
}
|
||||
|
||||
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
|
||||
Write-Host "Found '$dotnet'"
|
||||
|
||||
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
|
||||
Write-Host "Version $version"
|
||||
if ($version -ne $args[0])
|
||||
{
|
||||
Write-Host "PATH='$env:path'"
|
||||
throw "Unexpected version"
|
||||
}
|
||||
|
||||
if ($args[1])
|
||||
{
|
||||
# SDKs are listed on multiple lines with the path afterwards in square brackets
|
||||
$version = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
|
||||
Write-Host "Version $version"
|
||||
if (-not ($version -contains $args[1]))
|
||||
{
|
||||
Write-Host "PATH='$env:path'"
|
||||
throw "Unexpected version"
|
||||
}
|
||||
}
|
20
__tests__/verify-dotnet-version.sh
Normal file
20
__tests__/verify-dotnet-version.sh
Normal file
@ -0,0 +1,20 @@
|
||||
if [ -z "$1" ]; then
|
||||
echo "Must supply dotnet version argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dotnet_version="$(dotnet --version)"
|
||||
echo "Found dotnet version '$dotnet_version'"
|
||||
if [ -z "$(echo $dotnet_version | grep $1)" ]; then
|
||||
echo "Unexpected version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
dotnet_version="$(dotnet --list-sdks)"
|
||||
echo "Found dotnet version '$dotnet_version'"
|
||||
if [ -z "$(echo $dotnet_version | grep $2)" ]; then
|
||||
echo "Unexpected version"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user