Add test cases to workflow for install generic

This commit is contained in:
Zachary Eisinger 2020-09-23 11:28:35 -07:00
parent 8796bdbb05
commit 2f30b86ee7
3 changed files with 123 additions and 1 deletions

View File

@ -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

View 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"
}
}

View 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