From 8909fd9b2f4c247a5226feef1007fc4075907d6b Mon Sep 17 00:00:00 2001 From: Zachary Eisinger Date: Wed, 23 Sep 2020 11:52:39 -0700 Subject: [PATCH] Simple test on install version --- .github/workflows/workflow.yml | 24 +++--------------------- __tests__/verify-dotnet-version.ps1 | 27 --------------------------- __tests__/verify-dotnet-version.sh | 20 -------------------- 3 files changed, 3 insertions(+), 68 deletions(-) delete mode 100644 __tests__/verify-dotnet-version.ps1 delete mode 100644 __tests__/verify-dotnet-version.sh diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5bd454e..5ac9fa6 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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 diff --git a/__tests__/verify-dotnet-version.ps1 b/__tests__/verify-dotnet-version.ps1 deleted file mode 100644 index aa83d78..0000000 --- a/__tests__/verify-dotnet-version.ps1 +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/__tests__/verify-dotnet-version.sh b/__tests__/verify-dotnet-version.sh deleted file mode 100644 index 6c7ccea..0000000 --- a/__tests__/verify-dotnet-version.sh +++ /dev/null @@ -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 \ No newline at end of file