diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 06627c139..ca28dda98 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -14,25 +14,25 @@ jobs:
Build:
strategy:
matrix:
- opts:
+ options:
# - os: ubuntu-latest
# framework: netcoreapp2.1
- # runtime: x64
- # cover: false
+ # runtime: -x64
+ # codecov: false
- os: windows-latest
framework: netcoreapp2.1
- runtime: x64 # Not currently used. See https://github.com/actions/setup-dotnet/issues/72
- cover: true
+ runtime: -x64
+ codecov: true
- os: windows-latest
framework: net472
- runtime: x64
- cover: false
+ runtime: -x64
+ codecov: false
- os: windows-latest
framework: net472
- runtime: x86
- cover: false
+ runtime: -x86
+ codecov: false
- runs-on: ${{ matrix.opts.os }}
+ runs-on: ${{ matrix.options.os }}
steps:
- uses: actions/checkout@v1
@@ -52,22 +52,20 @@ jobs:
shell: pwsh
run: |
$DebugPreference = "Continue"
- ./build.ps1 "${{matrix.opts.framework}}"
+ ./build.ps1 "${{matrix.options.framework}}"
- - name: Test no Coverage
- if: matrix.opts.cover == false
- run: dotnet test -c Release -f "${{matrix.opts.framework}}" --no-build --filter Sandbox
-
- - name: Test with Coverage
- if: matrix.opts.cover == true
- run: dotnet test -c Release -f "${{matrix.opts.framework}}" --no-build --filter Sandbox /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
+ - name: Test
+ shell: pwsh
+ run: ./test.ps1 "${{ matrix.options.os }}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
+ env:
+ XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
- name: Update Codecov
uses: iansu/codecov-action-node@v1.0.0
- if: matrix.opts.cover == true
+ if: matrix.options.cover == true
with:
token: ${{secrets.CODECOV_TOKEN}}
- file: "coverage.xml"
+ file: "coverage.${{matrix.options.framework}}.xml"
flags: unittests
# Publish:
# runs-on: windows-latest
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 82712c3f8..349ee4b3d 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -15,6 +15,13 @@
$(DefineConstants);$(OS)
+
+
+
+
+
+
+
@@ -31,19 +38,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/build.cmd b/build.cmd
deleted file mode 100644
index 6372b4125..000000000
--- a/build.cmd
+++ /dev/null
@@ -1,17 +0,0 @@
-@echo Off
-
-PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '.\build.ps1'"
-
-if not "%errorlevel%"=="0" goto failure
-
-:success
-ECHO successfully built project
-REM exit 0
-goto end
-
-:failure
-ECHO failed to build.
-REM exit -1
-goto end
-
-:end
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
index 94580c091..07920aca1 100644
--- a/build.ps1
+++ b/build.ps1
@@ -8,14 +8,6 @@ $version = ''
$tagRegex = '^v?(\d+\.\d+\.\d+)(?:-([a-zA-Z]+)\.?(\d*))?$'
-$skipFullFramework = 'false'
-
-# If we are trying to build only netcoreapp versions for testings then skip building the full framework targets
-if ("$targetFramework".StartsWith("netcoreapp")) {
- Write-Debug "Skipping Full Framework"
- $skipFullFramework = 'true'
-}
-
function ToBuildNumber {
param( $date )
@@ -99,7 +91,7 @@ else {
Write-Debug "Discovered base version from tags '${version}'"
}
- # Create a build number based on the current time.
+ # Create a build number based on the current datetime.
$buildNumber = ""
if ( "$env:GITHUB_SHA" -ne '') {
@@ -133,20 +125,26 @@ else {
}
Write-Host "Building version '${version}'"
-dotnet restore /p:packageversion=$version /p:DisableImplicitNuGetFallbackFolder=true /p:skipFullFramework=$skipFullFramework
-$repositoryUrl = "https://github.com/SixLabors/"
+if ($targetFramework -ne 'ALL') {
+ $targetFramework = "-f $targetFramework"
+}
+
+dotnet restore $targetFramework /p:packageversion=$version /p:DisableImplicitNuGetFallbackFolder=true
+
+$repositoryUrl = ""
if ("$env:GITHUB_REPOSITORY" -ne "") {
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
}
Write-Host "Building projects"
-dotnet build -c Release /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl
+
+dotnet build -c Release $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
if ($LASTEXITCODE ) { Exit $LASTEXITCODE }
-Write-Host "Packaging projects"
+# Write-Host "Packaging projects"
-dotnet pack -c Release --output "$PSScriptRoot/artifacts" --no-build /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl
-if ($LASTEXITCODE ) { Exit $LASTEXITCODE }
+# dotnet pack -c Release --output "$PSScriptRoot/artifacts" --no-build /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl
+# if ($LASTEXITCODE ) { Exit $LASTEXITCODE }
diff --git a/run-tests.ps1 b/run-tests.ps1
deleted file mode 100644
index c35649544..000000000
--- a/run-tests.ps1
+++ /dev/null
@@ -1,101 +0,0 @@
-param(
- [string]$os,
- [string]$targetFramework,
- [string]$doCoverage = "False",
- [string]$is32Bit = "False"
-)
-
-if (!$os) {
- Write-Host "run-tests.ps1 ERROR: os is undefined!"
- exit 1
-}
-
-if (!$targetFramework) {
- Write-Host "run-tests.ps1 ERROR: targetFramework is undefined!"
- exit 1
-}
-
-function VerifyPath($path, $errorMessage) {
- if (!(Test-Path -Path $path)) {
- Write-Host "run-tests.ps1 $errorMessage `n $xunitRunnerPath"
- exit 1
- }
-}
-
-function CheckSubmoduleStatus() {
- $submoduleStatus = (git submodule status) | Out-String
- # if the result string is empty, the command failed to run (we didn't capture the error stream)
- if ($submoduleStatus) {
- # git has been called successfully, what about the status?
- if (($submoduleStatus -match "\-") -or ($submoduleStatus -match "\(\(null\)\)")) {
- # submodule has not been initialized!
- return 2;
- }
- elseif ($submoduleStatus -match "\+") {
- # submodule is not synced:
- return 1;
- }
- else {
- # everything fine:
- return 0;
- }
- }
- else {
- # git call failed, so we should warn
- return 3;
- }
-}
-
-if (($os -eq "windows-latest") -and ($doCoverage -eq "True") -and ($env:CI -eq "True") -and ($is32Bit -ne "True")) {
- # We execute CodeCoverage.cmd only for one specific job on CI (windows + coverageTargetFramework + 64bit )
- $testRunnerCmd = ".\tests\CodeCoverage\CodeCoverage.cmd"
-}
-else {
- Set-Location .\tests
- $xunitArgs = "-nobuild -c Release -framework $targetFramework"
-
- $coreTargetFrameworkRegex = '^netcoreapp(\d+\.\d+)$'
- if ($targetFramework -match $coreTargetFrameworkRegex) {
- # There were issues matching the correct installed runtime if we do not specify it explicitly:
- $fxVersion = $matches[1] + ".0"
- $xunitArgs += " --fx-version $fxVersion"
- }
-
- if ($is32Bit -eq "True") {
- $xunitArgs += " -x86"
- }
-
- $testRunnerCmd = "dotnet xunit $xunitArgs"
-}
-
-Write-Host "running:"
-Write-Host $testRunnerCmd
-Write-Host "..."
-
-Invoke-Expression $testRunnerCmd
-
-Set-Location $PSScriptRoot
-
-$exitCodeOfTests = $LASTEXITCODE;
-
-if (0 -ne ([int]$exitCodeOfTests)) {
- # check submodule status
- $submoduleStatus = CheckSubmoduleStatus
- if ([int]$submoduleStatus -eq 1) {
- # not synced
- Write-Host -ForegroundColor Yellow "Check if submodules are up to date. You can use 'git submodule update' to fix this";
- }
- elseif ($submoduleStatus -eq 2) {
- # not initialized
- Write-Host -ForegroundColor Yellow "Check if submodules are initialized. You can run 'git submodule init' to initialize them."
- }
- elseif ($submoduleStatus -eq 3) {
- # git not found, maybe submodules not synced?
- Write-Host -ForegroundColor Yellow "Could not check if submodules are initialized correctly. Maybe git is not installed?"
- }
- else {
- #Write-Host "Submodules are up to date";
- }
-}
-
-exit $exitCodeOfTests
diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj
index 8ca1f2ba5..4d354d3cc 100644
--- a/src/ImageSharp/ImageSharp.csproj
+++ b/src/ImageSharp/ImageSharp.csproj
@@ -10,8 +10,6 @@
$(packageversion)
0.0.1
- netcoreapp2.1;netstandard1.3;netstandard2.0
- $(TargetFrameworks);net472
netcoreapp2.1;netstandard2.0;netstandard1.3;net472
true
diff --git a/test.ps1 b/test.ps1
new file mode 100644
index 000000000..ebee0a7f0
--- /dev/null
+++ b/test.ps1
@@ -0,0 +1,34 @@
+param(
+ [Parameter(Mandatory, Position = 0)]
+ [string]$os,
+ [Parameter(Mandatory, Position = 1)]
+ [string]$targetFramework,
+ [Parameter(Mandatory, Position = 2)]
+ [string]$platform,
+ [Parameter(Mandatory, Position = 3)]
+ [bool]$codecov
+)
+
+if ($codecov -eq $TRUE) {
+
+ # xunit doesn't understand the CollectCoverage params
+ dotnet clean -c Debug
+ dotnet test -c Debug -f $targetFramework /p:codecov=true /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../../coverage.xml'
+}
+else {
+
+ # There were issues matching the correct installed runtime if we do not specify it explicitly:
+ # https://github.com/xunit/xunit/issues/1476
+ # This fix assumes the base version is installed.
+ $coreTargetFrameworkRegex = '^netcoreapp(\d+\.\d+)$'
+ if ($targetFramework -match $coreTargetFrameworkRegex) {
+ $fxVersion = "--fx-version ${matches[1]}.0"
+ }
+
+ Set-Location $env:XUNIT_PATH
+
+ dotnet clean -c Release
+ dotnet xunit -c Release -f $targetFramework $fxVersion $platform
+
+ Set-Location $PSScriptRoot
+}
diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props
index 9c6fdae3d..48ffbf315 100644
--- a/tests/Directory.Build.props
+++ b/tests/Directory.Build.props
@@ -26,7 +26,8 @@
-
+
diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets
index f8a4936e2..f7b70fe94 100644
--- a/tests/Directory.Build.targets
+++ b/tests/Directory.Build.targets
@@ -15,5 +15,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
index a25b548f2..bac4ad71c 100644
--- a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
+++ b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
@@ -5,9 +5,9 @@
ImageSharp.Benchmarks
Exe
SixLabors.ImageSharp.Benchmarks
- netcoreapp2.1
- $(TargetFrameworks);net472
+ netcoreapp2.1;net472
false
+ false
diff --git a/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj b/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
index f7959df6a..289d2d850 100644
--- a/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
+++ b/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
@@ -8,9 +8,9 @@
false
SixLabors.ImageSharp.Sandbox46
win7-x64
- netcoreapp2.1
- $(TargetFrameworks);net472
+ netcoreapp2.1;net472
SixLabors.ImageSharp.Sandbox46.Program
+ false
@@ -22,5 +22,5 @@
-
+
diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
index 842582c2f..6a78ef21e 100644
--- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
+++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
@@ -2,8 +2,7 @@
- netcoreapp2.1
- $(TargetFrameworks);net462;net472
+ netcoreapp2.1;net462;net472
True
latest
full
@@ -12,12 +11,22 @@
SixLabors.ImageSharp.Tests
AnyCPU;x64;x86
SixLabors.ImageSharp.Tests
+
+
+ true
+
+
+
+
+
+
+