commit
bea420f2fd
|
@ -0,0 +1,37 @@
|
||||||
|
name: Validate dotnet
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/*
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup-version:
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Clear toolcache
|
||||||
|
shell: pwsh
|
||||||
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
|
- name: Setup dotnet ${{ matrix.dotnet-version }}
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: ${{ matrix.dotnet-version }}
|
||||||
|
- name: Check installed version
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$version = & dotnet --version
|
||||||
|
Write-Host "Installed version: $version"
|
||||||
|
if (-not $version.StartsWith("${{ matrix.dotnet-version }}")) { throw "Unexpected version" }
|
|
@ -2,10 +2,14 @@ name: Main workflow
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- releases/*
|
- releases/*
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -29,7 +33,7 @@ jobs:
|
||||||
if: runner.os != 'windows'
|
if: runner.os != 'windows'
|
||||||
run: __tests__/verify-no-unstaged-changes.sh
|
run: __tests__/verify-no-unstaged-changes.sh
|
||||||
|
|
||||||
test:
|
test-setup-full-version:
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -38,25 +42,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Clear tool cache (macOS)
|
- name: Clear toolcache
|
||||||
if: runner.os == 'macos'
|
shell: pwsh
|
||||||
run: |
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
echo $PATH
|
|
||||||
dotnet --info
|
|
||||||
rm -rf "/Users/runner/.dotnet"
|
|
||||||
- name: Clear tool cache (Ubuntu)
|
|
||||||
if: runner.os == 'linux'
|
|
||||||
run: |
|
|
||||||
echo $PATH
|
|
||||||
dotnet --info
|
|
||||||
rm -rf "/usr/share/dotnet"
|
|
||||||
- name: Clear tool cache (Windows)
|
|
||||||
if: runner.os == 'windows'
|
|
||||||
run: |
|
|
||||||
echo $env:PATH
|
|
||||||
dotnet --info
|
|
||||||
Remove-Item $env:LocalAppData\Microsoft\dotnet/* -Recurse -Force -ErrorAction SilentlyContinue
|
|
||||||
Remove-Item "$env:ProgramFiles\dotnet/*" -Recurse -Force -ErrorAction SilentlyContinue
|
|
||||||
# Side-by-side install of 2.2 and 3.1 used for the test project
|
# Side-by-side install of 2.2 and 3.1 used for the test project
|
||||||
- name: Setup dotnet 2.2.402
|
- name: Setup dotnet 2.2.402
|
||||||
uses: ./
|
uses: ./
|
||||||
|
@ -70,70 +58,86 @@ jobs:
|
||||||
source-url: https://api.nuget.org/v3/index.json
|
source-url: https://api.nuget.org/v3/index.json
|
||||||
env:
|
env:
|
||||||
NUGET_AUTH_TOKEN: NOTATOKEN
|
NUGET_AUTH_TOKEN: NOTATOKEN
|
||||||
|
- name: Verify nuget config file
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
if (-Not (Test-Path "../nuget.config")) { throw "nuget file not generated correctly" }
|
||||||
- name: Verify dotnet
|
- name: Verify dotnet
|
||||||
if: runner.os != 'windows'
|
shell: pwsh
|
||||||
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 2.2.402
|
run: __tests__/verify-dotnet.ps1 3.1.201 2.2.402
|
||||||
|
|
||||||
# Set new cache before 2 digit install
|
test-setup-without-patch-version:
|
||||||
- name: Set new tool cache (macOS)
|
runs-on: ${{ matrix.operating-system }}
|
||||||
if: runner.os == 'macos'
|
strategy:
|
||||||
run: |
|
fail-fast: false
|
||||||
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet2" >> $GITHUB_ENV
|
matrix:
|
||||||
- name: Set new tool cache (Ubuntu)
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
if: runner.os == 'linux'
|
steps:
|
||||||
run: |
|
- name: Checkout
|
||||||
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet2" >> $GITHUB_ENV
|
uses: actions/checkout@v2
|
||||||
- name: Set new tool cache (Windows)
|
- name: Clear toolcache
|
||||||
if: runner.os == 'windows'
|
shell: pwsh
|
||||||
shell: bash
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet2" >> $GITHUB_ENV
|
|
||||||
# 2.0, 3.0, 5.0 needs to be in single quotes to interpret as a string instead of as an integer
|
# 2.0, 3.0, 5.0 needs to be in single quotes to interpret as a string instead of as an integer
|
||||||
- name: Setup dotnet '2.0'
|
- name: Setup dotnet '3.1'
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
dotnet-version: '2.0'
|
dotnet-version: '3.1'
|
||||||
|
- name: Setup dotnet '2.2'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: '2.2'
|
||||||
|
- name: Verify dotnet
|
||||||
|
shell: pwsh
|
||||||
|
run: __tests__/verify-dotnet.ps1 3.1 2.2
|
||||||
|
|
||||||
|
test-setup-latest-patch-version:
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Clear toolcache
|
||||||
|
shell: pwsh
|
||||||
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
|
- name: Setup dotnet 3.1.x
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 3.1.x
|
||||||
|
- name: Setup dotnet 2.2.x
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 2.2.x
|
||||||
|
- name: Verify dotnet
|
||||||
|
shell: pwsh
|
||||||
|
run: __tests__/verify-dotnet.ps1 3.1 2.2
|
||||||
|
|
||||||
# Clear cache before .x version install
|
test-setup-with-wildcard:
|
||||||
- name: Set new tool cache (macOS)
|
runs-on: ${{ matrix.operating-system }}
|
||||||
if: runner.os == 'macos'
|
strategy:
|
||||||
run: |
|
fail-fast: false
|
||||||
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet3" >> $GITHUB_ENV
|
matrix:
|
||||||
- name: Set new tool cache (Ubuntu)
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
if: runner.os == 'linux'
|
steps:
|
||||||
run: |
|
- name: Checkout
|
||||||
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet3" >> $GITHUB_ENV
|
uses: actions/checkout@v2
|
||||||
- name: Set new tool cache (Windows)
|
- name: Clear toolcache
|
||||||
if: runner.os == 'windows'
|
shell: pwsh
|
||||||
shell: bash
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
run: |
|
- name: Setup dotnet 3.1.*
|
||||||
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet3" >> $GITHUB_ENV
|
|
||||||
- name: Setup dotnet 2.0.x
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
dotnet-version: 2.0.x
|
dotnet-version: 3.1.*
|
||||||
|
- name: Setup dotnet 2.2.*
|
||||||
# Clear cache before .* version install
|
|
||||||
- name: Set new tool cache (macOS)
|
|
||||||
if: runner.os == 'macos'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet4" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Ubuntu)
|
|
||||||
if: runner.os == 'linux'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet4" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Windows)
|
|
||||||
if: runner.os == 'windows'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet4" >> $GITHUB_ENV
|
|
||||||
- name: Setup dotnet 2.0.*
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
dotnet-version: 2.0.*
|
dotnet-version: 2.2.*
|
||||||
|
- name: Verify dotnet
|
||||||
|
shell: pwsh
|
||||||
|
run: __tests__/verify-dotnet.ps1 3.1 2.2
|
||||||
|
|
||||||
test-proxy:
|
test-proxy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
$dotnetPaths = @{
|
||||||
|
Linux = @("/usr/share/dotnet")
|
||||||
|
macOS = @("$env:HOME/.dotnet")
|
||||||
|
Windows = @("$env:ProgramFiles\dotnet/*",
|
||||||
|
"$env:LocalAppData\Microsoft\dotnet/*")
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($path in $dotnetPaths[$args[0]]) {
|
||||||
|
if (Test-Path $path) {
|
||||||
|
Write-Host "Clear $path path"
|
||||||
|
Remove-Item $path -Recurse -Force
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,30 +3,34 @@ if (!$args[0])
|
||||||
throw "Must supply dotnet version argument"
|
throw "Must supply dotnet version argument"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-Not (Test-Path "../nuget.config"))
|
|
||||||
{
|
|
||||||
throw "nuget file not generated correctly"
|
|
||||||
}
|
|
||||||
|
|
||||||
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
|
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
|
||||||
Write-Host "Found '$dotnet'"
|
Write-Host "Found '$dotnet'"
|
||||||
|
|
||||||
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
|
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
|
||||||
Write-Host "Version $version"
|
Write-Host "Version $version"
|
||||||
if ($version -ne $args[0])
|
if (-not ($version.StartsWith($args[0].ToString())))
|
||||||
{
|
{
|
||||||
Write-Host "PATH='$env:path'"
|
Write-Host "PATH='$env:PATH'"
|
||||||
throw "Unexpected version"
|
throw "Unexpected version"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args[1])
|
if ($args[1])
|
||||||
{
|
{
|
||||||
# SDKs are listed on multiple lines with the path afterwards in square brackets
|
# SDKs are listed on multiple lines with the path afterwards in square brackets
|
||||||
$version = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
|
$versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
|
||||||
Write-Host "Version $version"
|
Write-Host "Installed versions: $versions"
|
||||||
if (-not ($version -contains $args[1]))
|
$isInstalledVersion = $false
|
||||||
|
foreach ($version in $versions)
|
||||||
{
|
{
|
||||||
Write-Host "PATH='$env:path'"
|
if ($version.StartsWith($args[1].ToString()))
|
||||||
|
{
|
||||||
|
$isInstalledVersion = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not $isInstalledVersion)
|
||||||
|
{
|
||||||
|
Write-Host "PATH='$env:PATH'"
|
||||||
throw "Unexpected version"
|
throw "Unexpected version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue