Simple test on install version

This commit is contained in:
Zachary Eisinger 2020-09-23 11:52:39 -07:00
parent 54563ab4b0
commit 8909fd9b2f
3 changed files with 3 additions and 68 deletions

View File

@ -85,7 +85,7 @@ jobs:
- name: Clear tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
rm -rf "/usr/share/dotnet"
rm -rf "/home/runner/.dotnet"
- name: Clear tool cache (Windows)
if: runner.os == 'windows'
run: |
@ -96,12 +96,6 @@ jobs:
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)
@ -111,7 +105,7 @@ jobs:
- name: Clear tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
rm -rf "/usr/share/dotnet"
rm -rf "/home/runner/.dotnet"
- name: Clear tool cache (Windows)
if: runner.os == 'windows'
run: |
@ -121,12 +115,6 @@ jobs:
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)
@ -136,7 +124,7 @@ jobs:
- name: Clear tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
rm -rf "/usr/share/dotnet"
rm -rf "/home/runner/.dotnet"
- name: Clear tool cache (Windows)
if: runner.os == 'windows'
run: |
@ -146,12 +134,6 @@ jobs:
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

@ -1,27 +0,0 @@
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

@ -1,20 +0,0 @@
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