diff --git a/appveyor.yml b/appveyor.yml index 17925b5db..808851ba0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,25 @@ image: Visual Studio 2017 # prevent the double build when a branch has an active PR skip_branch_with_pr: true +environment: + matrix: + - target_framework: netcoreapp2.0 + is_32bit: False + - target_framework: netcoreapp2.0 + is_32bit: True + - target_framework: net462 + is_32bit: False + - target_framework: net462 + is_32bit: True + - target_framework: net47 + is_32bit: False + - target_framework: net47 + is_32bit: True + - target_framework: net471 + is_32bit: False + - target_framework: net471 + is_32bit: True + before_build: - git submodule -q update --init - cmd: dotnet --version @@ -12,10 +31,7 @@ build_script: - cmd: build.cmd test_script: -- tests\CodeCoverage\CodeCoverage.cmd -- cmd: cd .\tests\ImageSharp.Tests -- .\RunExtendedTests.cmd - +- ps: .\run-tests.ps1 $env:target_framework $env:is_32bit after_test: - cmd: appveyor PushArtifact "artifacts\SixLabors.ImageSharp.%APPVEYOR_BUILD_VERSION%.nupkg" diff --git a/build.ps1 b/build.ps1 index 92ccb012c..4c5a36cae 100644 --- a/build.ps1 +++ b/build.ps1 @@ -100,12 +100,16 @@ dotnet build -c Release /p:packageversion=$version if ($LASTEXITCODE ){ Exit $LASTEXITCODE } -if ( $env:CI -ne "True") { - cd ./tests/ImageSharp.Tests/ - dotnet xunit -nobuild -c Release -f netcoreapp2.0 --fx-version 2.0.0 - ./RunExtendedTests.cmd - cd ../.. -} +# +# TODO: DO WE NEED TO RUN TESTS IMPLICITLY? +# +# if ( $env:CI -ne "True") { +# cd ./tests/ImageSharp.Tests/ +# dotnet xunit -nobuild -c Release -f netcoreapp2.0 --fx-version 2.0.0 +# ./RunExtendedTests.cmd +# cd ../.. +# } +# if ($LASTEXITCODE ){ Exit $LASTEXITCODE } diff --git a/run-tests.ps1 b/run-tests.ps1 new file mode 100644 index 000000000..f006eab1d --- /dev/null +++ b/run-tests.ps1 @@ -0,0 +1,40 @@ +param( + [string]$targetFramework, + [string]$is32Bit = "False" +) + +if (!$targetFramework){ + Write-Host "run-tests.ps1 ERROR: targetFramework is undefined!" + exit 1 +} + +if ( ($targetFramework -eq "netcoreapp2.0") -and ($env:CI -eq "True") -and ($is32Bit -ne "True")) { + # We execute CodeCoverage.cmd only for one specific job on CI (netcoreapp2.0 + 64bit ) + $testRunnerCmd = ".\tests\CodeCoverage\CodeCoverage.cmd" +} +elseif ($targetFramework -eq "mono") { + $testRunnerCmd = "Write-Host '**** placeholder for mono test execution ****'" +} +else { + cd .\tests\ImageSharp.Tests + $xunitArgs = "-c Release -framework $targetFramework" + + if ($targetFramework -eq "netcoreapp2.0") { + # There are issues matching the correct installed runtime if we do not specify it explicitly: + $xunitArgs += " --fx-version 2.0.0" + } + + if ($is32Bit -eq "True") { + $xunitArgs += " -x86" + } + + $testRunnerCmd = "dotnet xunit $xunitArgs" +} + +Write-Host "running:" +Write-Host $testRunnerCmd +Write-Host "..." + +Invoke-Expression $testRunnerCmd + +cd $PSScriptRoot \ No newline at end of file