Browse Source

Use dotnet test

af/merge-core
James Jackson-South 6 years ago
parent
commit
07f9a2c27d
  1. 208
      .github/workflows/build-and-test.yml
  2. 116
      .github/workflows/build-and-test.yml.bak
  3. 28
      .vscode/launch.json
  4. 31
      .vscode/tasks.json
  5. 27
      Directory.Build.targets
  6. 26
      ImageSharp.sln
  7. 128
      build.ps1
  8. 3
      build/icons/imagesharp-logo-128.png
  9. 3
      build/icons/imagesharp-logo-256.png
  10. 3
      build/icons/imagesharp-logo-32.png
  11. 3
      build/icons/imagesharp-logo-512.png
  12. 3
      build/icons/imagesharp-logo-64.png
  13. 3
      build/icons/imagesharp-logo.png
  14. 1
      build/icons/imagesharp-logo.svg
  15. 146
      run-tests.ps1
  16. 4
      src/ImageSharp/ImageSharp.csproj
  17. 4
      tests/CodeCoverage/CodeCoverage.cmd
  18. 6
      tests/Directory.Build.props
  19. 5
      tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
  20. 6
      tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
  21. 8
      tests/ImageSharp.Tests/ImageSharp.Tests.csproj

208
.github/workflows/build-and-test.yml

@ -1,116 +1,98 @@
name: Build
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
on:
push:
branches:
- master
tags:
- "v*"
pull_request:
branches:
- master
jobs:
Coverage:
runs-on: windows-latest
needs: [Build]
steps:
- uses: actions/checkout@v1
- name: Enable long file paths
run: git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init
- name: Generate Test Coverage
shell: pwsh
run: ./tests/CodeCoverage/CodeCoverage.ps1
env:
CI : True
- name: Update codecov
uses: iansu/codecov-action-node@v1.0.0
with:
token: ${{secrets.CODECOV_TOKEN}}
file: "ImageSharp.Coverage.xml"
flags: unittests
Build:
strategy:
matrix:
options:
- os : ubuntu-latest
framework: netcoreapp2.1
is32Bit: False
- os : windows-latest
framework: netcoreapp2.1
is32Bit: False
- os : windows-latest
framework: net472
is32Bit: False
- os : windows-latest
framework: net472
is32Bit: True
runs-on: ${{ matrix.options.os }}
steps:
- uses: actions/checkout@v1
- name: Enable long file paths
run: |
git config --global core.autocrlf false
git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init
- name: Build
shell: pwsh
run: |
$DebugPreference = "Continue"
./build.ps1 "${{matrix.options.framework}}"
- name: Test
shell: pwsh
run: ./run-tests.ps1 "${{matrix.options.framework}}" "${{matrix.options.is32Bit}}" true
env:
CI : True
Publish:
runs-on: windows-latest
needs: [Build]
if : github.event_name == 'push'
steps:
- uses: actions/checkout@v1
- name: Enable long file paths
run: git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init
- name: Build
shell: pwsh
run: |
$DebugPreference = "Continue"
./build.ps1
- name : install nuget
if: success()
uses: warrenbuckley/Setup-Nuget@v1
- name: Configure feed
if: success()
run: nuget.exe source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/sixlabors/index.json" -UserName ${{github.actor}} -Password ${{ secrets.GITHUB_TOKEN }}
- name: Publish to nightly feed - github
if: success()
run: nuget.exe push -Source "GitHub" .\artifacts\*.nupkg
- name: Publish to nightly feed -myget
if: success()
run: nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
# todo if github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org
Build:
strategy:
matrix:
opts:
- os: ubuntu-latest
framework: netcoreapp2.1
runtime: linux-x64
cover: False
- os: windows-latest
framework: netcoreapp2.1
runtime: win-x64
cover: True
- os: windows-latest
framework: net472
runtime: win-x64
cover: False
- os: windows-latest
framework: net472
runtime: win-x86
cover: False
runs-on: ${{ matrix.opts.os }}
steps:
- uses: actions/checkout@v1
- name: Install nuget
uses: NuGet/setup-nuget@v1
- name: Enable long file paths
run: |
git config --global core.autocrlf false
git config --global core.longpaths true
- name: Update Submodules
run: git submodule -q update --init --recursive
- name: Build
shell: pwsh
run: |
$DebugPreference = "Continue"
./build.ps1 "${{matrix.opts.framework}}"
- name: Test no Coverage
if: matrix.opts.cover != 'True'
run: dotnet test **/*tests/*.csproj -c Release -f "${{matrix.opt.framework}}" -r "${{matrix.opt.runtime}}" --no-build --filter Sandbox
- name: Test with Coverage
if: matrix.opts.cover == 'True'
run: dotnet test **/*tests/*.csproj -c Release -f "${{matrix.opt.framework}}" -r "${{matrix.opt.runtime}}" --no-build --filter Sandbox /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Update Codecov
uses: iansu/codecov-action-node@v1.0.0
if: matrix.opts.cover == 'True'
with:
token: ${{secrets.CODECOV_TOKEN}}
file: "coverage.xml"
flags: unittests
# Publish:
runs-on: windows-latest
needs: [Build]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v1
- name: install nuget
uses: NuGet/setup-nuget@v1
- name: Enable long file paths
run: git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init --recursive
- name: Build
shell: pwsh
run: |
$DebugPreference = "Continue"
./build.ps1
- name: Publish to nightly feed -myget
if: success()
run: nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
# TODO: if github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org

116
.github/workflows/build-and-test.yml.bak

@ -0,0 +1,116 @@
name: Build
on:
push:
branches:
- master
tags:
- "v*"
pull_request:
branches:
- master
jobs:
Coverage:
runs-on: windows-latest
needs: [Build]
steps:
- uses: actions/checkout@v1
- name: Install nuget
uses: NuGet/setup-nuget@v1
- name: Enable long file paths
run: git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init --recursive
- name: Generate Test Coverage
shell: pwsh
run: ./tests/CodeCoverage/CodeCoverage.ps1
env:
CI: True
- name: Update codecov
uses: iansu/codecov-action-node@v1.0.0
with:
token: ${{secrets.CODECOV_TOKEN}}
file: "ImageSharp.Coverage.xml"
flags: unittests
Build:
strategy:
matrix:
opts:
- os: ubuntu-latest
framework: netcoreapp2.1
is32Bit: False
doCoverage: False
- os: windows-latest
framework: netcoreapp2.1
is32Bit: False
doCoverage: True
- os: windows-latest
framework: net472
is32Bit: False
doCoverage: False
- os: windows-latest
framework: net472
is32Bit: True
doCoverage: False
runs-on: ${{ matrix.opts.os }}
steps:
- uses: actions/checkout@v1
- name: install nuget
uses: NuGet/setup-nuget@v1
- name: Enable long file paths
run: |
git config --global core.autocrlf false
git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init
- name: Build
shell: pwsh
run: |
$DebugPreference = "Continue"
./build.ps1 "${{matrix.opts.framework}}"
- name: Test
shell: pwsh
run: ./run-tests.ps1 "${{ matrix.opts.os }}" "${{matrix.opts.framework}}" "${{matrix.opts.is32Bit}}" "${{matrix.opts.doCoverage}}"
env:
CI: True
Publish:
runs-on: windows-latest
needs: [Build]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v1
- name: install nuget
uses: NuGet/setup-nuget@v1
- name: Enable long file paths
run: git config --global core.longpaths true
- name: Update submodules
run: git submodule -q update --init --recursive
- name: Build
shell: pwsh
run: |
$DebugPreference = "Continue"
./build.ps1
- name: Publish to nightly feed -myget
if: success()
run: nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
# TODO: if github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org

28
.vscode/launch.json

@ -1,28 +0,0 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceRoot}/tests/ImageSharp.Benchmarks/bin/Debug/netcoreapp2.0/ImageSharp.Benchmarks.dll",
"args": [],
"cwd": "${workspaceRoot}/samples/AvatarWithRoundedCorner",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

31
.vscode/tasks.json

@ -1,31 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [ "ImageSharp.sln" ],
"isBuildCommand": true,
"showOutput": "always",
"problemMatcher": "$msCompile"
},
{
"taskName": "build benchmark",
"suppressTaskName": true,
"args": [ "build", "tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj", "-f", "netcoreapp2.0", "-c", "Release" ],
"showOutput": "always",
"problemMatcher": "$msCompile"
},
{
"taskName": "test",
"args": ["tests/ImageSharp.Tests/ImageSharp.Tests.csproj", "-c", "release", "-f", "netcoreapp2.0"],
"isTestCommand": true,
"showOutput": "always",
"problemMatcher": "$msCompile"
}
]
}

27
Directory.Build.targets

@ -15,33 +15,34 @@
<DefineConstants>$(DefineConstants);$(OS)</DefineConstants>
</PropertyGroup>
<!-- Tool versions for tool references across all projects -->
<ItemGroup>
<DotNetCliToolReference Update="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageReference Update="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Update="Colourful" Version="2.0.3" />
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="7.14.4" />
<!--Global Dependencies-->
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.3.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Update="Moq" Version="4.10.0" />
<PackageReference Update="Pfim" Version="0.9.1" />
<!--Src Dependencies-->
<PackageReference Update="SixLabors.Core" Version="1.0.0-beta0008" />
<PackageReference Update="SixLabors.Fonts" Version="1.0.0-beta0009" />
<PackageReference Update="SixLabors.Shapes" Version="1.0.0-beta0009" />
<PackageReference Update="SixLabors.Shapes.Text" Version="1.0.0-beta0009" />
<PackageReference Update="StyleCop.Analyzers" Version="1.1.118" />
<PackageReference Update="System.Drawing.Common" Version="4.7.0" />
<PackageReference Update="System.IO.Compression" Version="4.3.0" />
<PackageReference Update="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
<PackageReference Update="System.Runtime.CompilerServices.Unsafe" Version="4.5.1" />
<PackageReference Update="System.Threading.Tasks.Parallel" Version="4.3.0" />
<PackageReference Update="System.ValueTuple" Version="4.5.0" />
<!--Test Dependencies-->
<PackageReference Update="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Update="Colourful" Version="2.0.3" />
<PackageReference Include="coverlet.collector" Version="1.1.0" />
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="7.14.4" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Update="Moq" Version="4.10.0" />
<PackageReference Update="Pfim" Version="0.9.1" />
<PackageReference Update="System.Drawing.Common" Version="4.7.0" />
<!--TODO: Fix implicit conversion issues so we can move to 2.4.1-->
<PackageReference Update="xunit" Version="2.3.1" />
<PackageReference Update="xunit.runner.console" Version="2.3.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>

26
ImageSharp.sln

@ -36,25 +36,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEM
.github\ISSUE_TEMPLATE\feature-request.md = .github\ISSUE_TEMPLATE\feature-request.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vscode", ".vscode", "{0274D4CF-9932-47CC-8E89-54DC05B8F06E}"
ProjectSection(SolutionItems) = preProject
.vscode\launch.json = .vscode\launch.json
.vscode\tasks.json = .vscode\tasks.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E919DF0B-2607-4462-8FC0-5C98FE50F8C9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "icons", "icons", "{2B02E303-7CC6-4E15-97EE-DBE86B287553}"
ProjectSection(SolutionItems) = preProject
build\icons\imagesharp-logo-128.png = build\icons\imagesharp-logo-128.png
build\icons\imagesharp-logo-256.png = build\icons\imagesharp-logo-256.png
build\icons\imagesharp-logo-32.png = build\icons\imagesharp-logo-32.png
build\icons\imagesharp-logo-512.png = build\icons\imagesharp-logo-512.png
build\icons\imagesharp-logo-64.png = build\icons\imagesharp-logo-64.png
build\icons\imagesharp-logo.png = build\icons\imagesharp-logo.png
build\icons\imagesharp-logo.svg = build\icons\imagesharp-logo.svg
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{815C0625-CD3D-440F-9F80-2D83856AB7AE}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
@ -354,6 +335,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Benchmarks", "te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Sandbox46", "tests\ImageSharp.Sandbox46\ImageSharp.Sandbox46.csproj", "{561B880A-D9EE-44EF-90F5-817C54A9D9AB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{C0D7754B-5277-438E-ABEB-2BA34401B5A7}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -418,7 +404,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FBE8C1AD-5AEC-4514-9B64-091D8E145865} = {1799C43E-5C54-4A8F-8D64-B1475241DB0D}
{2B02E303-7CC6-4E15-97EE-DBE86B287553} = {E919DF0B-2607-4462-8FC0-5C98FE50F8C9}
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
{D4C5EC58-F8E6-4636-B9EE-C99D2578E5C6} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{FA55F5DE-11A6-487D-ABA4-BC93A02717DD} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
@ -438,6 +423,7 @@ Global
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{2BF743D8-2A06-412D-96D7-F448F00C5EA5} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{561B880A-D9EE-44EF-90F5-817C54A9D9AB} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{C0D7754B-5277-438E-ABEB-2BA34401B5A7} = {1799C43E-5C54-4A8F-8D64-B1475241DB0D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5F8B9D1F-CD8B-4CC5-8216-D531E25BD795}

128
build.ps1

@ -2,7 +2,7 @@ param(
[string]$targetFramework = 'ALL'
)
# lets calulat the correct version here
# Lets calculate the correct version here
$fallbackVersion = "1.0.0";
$version = ''
@ -10,13 +10,14 @@ $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 we are trying to build only netcoreapp versions for testings then skip building the full framework targets
if ("$targetFramework".StartsWith("netcoreapp")) {
$skipFullFramework = 'true'
}
function ToBuildNumber {
param( $date )
if ("$date" -eq "") {
$date = [System.DateTime]::Now
}
@ -25,32 +26,14 @@ function ToBuildNumber {
$date = [System.DateTime]::Parse($date)
}
return $date.ToString("yyyyMMddhhmmss")
}
# if($IsWindows){
# $skipFullFramework = 'true'
# Write-Info "Building full framework targets - Running windows"
# }else{
# if (Get-Command "mono" -ErrorAction SilentlyContinue)
# {
# Write-Info "Building full framework targets - mono installed"
# $skipFullFramework = 'true'
# }
# }
# We are running on the build server
$isVersionTag = "$env:GITHUB_REF".replace("refs/tags/", "") -match $tagRegex
# we are running on the build server
$isVersionTag = $env:APPVEYOR_REPO_TAG_NAME -match $tagRegex
if ($isVersionTag -eq $false) {
$isVersionTag = "$env:GITHUB_REF".replace("refs/tags/", "") -match $tagRegex
if ($isVersionTag) {
Write-Debug "Github tagged build"
}
}
else {
Write-Debug "Appveyor tagged build"
if ($isVersionTag) {
Write-Debug "Github tagged build"
}
if ($isVersionTag -eq $false) {
@ -75,13 +58,16 @@ if ($isVersionTag) {
$version = $matches[1]
$postTag = $matches[2]
$count = $matches[3]
Write-Debug "version number: ${version} post tag: ${postTag} count: ${count}"
Write-Debug "Version number: ${version} post tag: ${postTag} count: ${count}"
if ("$postTag" -ne "") {
$version = "${version}-${postTag}"
}
if ("$count" -ne "") {
# for consistancy with previous releases we pad the counter to only 4 places
$padded = $count.Trim().Trim('0').PadLeft(4, "0");
# For consistancy with previous releases we pad the counter to only 4 places
$padded = $count.Trim().PadLeft(4, "0");
Write-Debug "count '$count', padded '${padded}'"
$version = "${version}${padded}"
@ -94,10 +80,10 @@ else {
$list = $lastTag.Split("`n")
foreach ($tag in $list) {
Write-Debug "testing ${tag}"
Write-Debug "Testing ${tag}"
$tag = $tag.Trim();
if ($tag -match $tagRegex) {
Write-Debug "matched ${tag}"
Write-Debug "Matched ${tag}"
$version = $matches[1];
break;
}
@ -112,71 +98,43 @@ else {
Write-Debug "Discovered base version from tags '${version}'"
}
$buildNumber = $env:APPVEYOR_BUILD_NUMBER
# Create a build number based on the current time.
$buildNumber = ""
if ("$buildNumber" -eq "") {
# no counter availible in this environment
# let make one up based on time
if ( "$env:GITHUB_SHA" -ne '') {
$buildNumber = ToBuildNumber (git show -s --format=%ci $env:GITHUB_SHA)
}
elseif ( "$(git diff --stat)" -eq '') {
$buildNumber = ToBuildNumber (git show -s --format=%ci HEAD)
}
else {
$buildNumber = ToBuildNumber
}
$buildNumber = "$buildNumber".Trim().Trim('0').PadLeft(12, "0");
if ( "$env:GITHUB_SHA" -ne '') {
$buildNumber = ToBuildNumber (git show -s --format=%ci $env:GITHUB_SHA)
}
else {
# build number replacement is padded to 6 places
$buildNumber = "$buildNumber".Trim().Trim('0').PadLeft(6, "0");
}
if ("$env:APPVEYOR_PULL_REQUEST_NUMBER" -ne "") {
Write-Debug "building a PR"
$prNumber = "$env:APPVEYOR_PULL_REQUEST_NUMBER".Trim().Trim('0').PadLeft(5, "0");
# this is a PR
$version = "${version}-PullRequest${prNumber}${buildNumber}";
elseif ( "$(git diff --stat)" -eq '') {
$buildNumber = ToBuildNumber (git show -s --format=%ci HEAD)
}
else {
Write-Debug "building a branch commit"
$buildNumber = ToBuildNumber
}
# this is a general branch commit
$branch = $env:APPVEYOR_REPO_BRANCH
$buildNumber = "$buildNumber".Trim().PadLeft(12, "0");
if ("$branch" -eq "") {
$branch = ((git rev-parse --abbrev-ref HEAD) | Out-String).Trim()
Write-Debug "Building a branch commit"
if ("$branch" -eq "") {
$branch = "unknown"
}
}
# This is a general branch commit
$branch = ((git rev-parse --abbrev-ref HEAD) | Out-String).Trim()
$branch = $branch.Replace("/", "-").ToLower()
if ("$branch" -eq "") {
$branch = "unknown"
}
if ($branch.ToLower() -eq "master" -or $branch.ToLower() -eq "head") {
$branch = "dev"
}
$branch = $branch.Replace("/", "-").ToLower()
$version = "${version}-${branch}${buildNumber}";
if ($branch.ToLower() -eq "master" -or $branch.ToLower() -eq "head") {
$branch = "dev"
}
}
if ("$env:APPVEYOR_API_URL" -ne "") {
# update appveyor build number for this build
Invoke-RestMethod -Method "PUT" `
-Uri "${env:APPVEYOR_API_URL}api/build" `
-Body "{version:'${version}'}" `
-ContentType "application/json"
$version = "${version}-${branch}${buildNumber}";
}
Write-Host "Building version '${version}'"
dotnet restore /p:packageversion=$version /p:DisableImplicitNuGetFallbackFolder=true /p:skipFullFramework=$skipFullFramework
$repositoryUrl = "https://github.com/SixLabors/ImageSharp/"
$repositoryUrl = "https://github.com/SixLabors/"
if ("$env:GITHUB_REPOSITORY" -ne "") {
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
@ -187,19 +145,7 @@ dotnet build -c Release /p:packageversion=$version /p:skipFullFramework=$skipFul
if ($LASTEXITCODE ) { Exit $LASTEXITCODE }
#
# 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 }
Write-Host "Packaging projects"
dotnet pack ./src/ImageSharp/ -c Release --output "$PSScriptRoot/artifacts" --no-build /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl
dotnet pack -c Release --output "$PSScriptRoot/artifacts" --no-build /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl
if ($LASTEXITCODE ) { Exit $LASTEXITCODE }

3
build/icons/imagesharp-logo-128.png

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:148a268c589b628f5d0b5af0e86911a0b393c35b8b25233c71553657c88e0b96
size 7568

3
build/icons/imagesharp-logo-256.png

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7e4b2ff72aef1979500cd130c28490a00be116bb833bc96ca30c85dc0596099c
size 15413

3
build/icons/imagesharp-logo-32.png

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:021c12313afbdc65f58bfea8c7b436d5c2102513bb63d9e64ee2b61a1344c56a
size 1799

3
build/icons/imagesharp-logo-512.png

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3ae54ae0035df1f8f1459081e2f1d5cceda6f88cca6ec015d8c0209bf0d34edf
size 32534

3
build/icons/imagesharp-logo-64.png

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92896854265693f28f9a503b9093cb2c9a4a9b329f310732efdd9c6f6c3761bc
size 3736

3
build/icons/imagesharp-logo.png

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3ae54ae0035df1f8f1459081e2f1d5cceda6f88cca6ec015d8c0209bf0d34edf
size 32534

1
build/icons/imagesharp-logo.svg

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M955.19-89.12c1.71.76 2.92 2.23 4.1 3.64-2.36.5-4.63-1.09-4.1-3.64z" fill="#f3f3f3"/><path d="M955.99 795.86c-.55-2.11 1.59-3.28 3.42-2.81-.92 1.17-1.92 2.39-3.42 2.81zm-824.02-1.84c2.01-.67 3.78.88 3.23 2.98-1.34-.69-2.38-1.78-3.23-2.98z" fill="#f4f4f4"/><g transform="translate(3 77.213) scale(.84333)"><path d="M360.394-81.917C332.176-34.178 310.797 7.886 286.16 51.626c-38.852 5.81-87.766 35.358-108.462 53.536-23.27-39.522-47.319-80.984-72.065-121.732 48.75-44.512 145.286-87.984 254.761-65.347z" fill="#fcee21"/><path d="M585.941 121.39a63184.8 63184.8 0 0 1-162.904-.018c-26.67-31.213-61.232-56.836-94.452-65.342 23.084-40.89 47.898-86.085 70.744-127.125 75.877 25.617 155.261 90.42 186.612 192.486z" fill="#ed7124"/><path d="M78.958 9.17c27.048 46.86 52.248 90.395 75.86 129.989-17.584 46.554-19.429 90.024-5.9 130.23-50.04.125-100.355.347-143.226.41-17.334-90.382 6.06-188.551 73.266-260.63z" fill="#35a849"/><path d="M331.618 50.646c39.7 5.695 90.586 40.866 105.695 70.748-44.912-.15-107.006-.198-146.153-.135 13.192-22.859 29.853-51.82 40.458-70.613z" fill="#cd5911"/><path d="M234.715 269.473c-28.712.242-63.776.092-89.229-.09-17.285-42.947-11.055-100.462 8.472-131.656 27.3 45.036 56.142 92.792 80.757 131.746z" fill="#298138"/><path d="M444.344 158.743c49.347.175 101.697.11 150.938.113 18.912 93.176-15.004 195.992-76.919 258.997-27.185-46.24-51.866-89.439-77.095-132.613l.15-.34c10.485-22.85 15.306-48.2 14.153-73.303-1.531-18.873-5.622-37.733-11.227-52.854z" fill="#cb202d"/><path d="M367.352 158.939c26.614.068 65.477-.264 88.655-.172 17.291 42.172 7.163 95.713-11.41 132.164-24.437-42.171-54.894-93.243-77.245-131.992z" fill="#9f1923"/><path d="M165.551 305.827c23.184 34.257 60.157 58.85 100.814 66.88-25.464 42.621-47.314 80.025-70.74 120.477C108.02 463.19 42.056 388.03 15.05 305.822a79196.89 79196.89 0 0 1 150.5.005z" fill="#085ba7"/><path d="M418.737 319.328l.11.18c24.153 41.18 48.356 82.328 72.668 123.418-71.641 59.524-168.65 81.977-254.913 62.306 25.735-44.76 51.465-88.751 77.103-133.568 41.19-8.196 81.388-26.52 105.046-52.336z" fill="#5f2c83"/><path d="M164.496 305.822c47.886.079 95.948-.024 140.829.009-12.442 22.552-39.753 68.221-39.3 67.463-40.85-7.405-79.046-31.74-101.53-67.472z" fill="#064076"/><path d="M380.797 255.307c12.77 21.268 27.863 46.872 40.484 68.227-26.416 30.286-70.536 50.076-110.301 52.908 21.612-38.994 48.471-86.745 69.817-121.135z" fill="#431f5d"/><ellipse ry="59.777" rx="59.861" cy="212.001" cx="300.001" fill="#e3018f"/><path d="M288.47 47.639c-22.376 38.536-52.246 89.024-71.803 122.212-13.891-22.894-28.313-46.46-40.324-66.915 15.85-17.392 51.175-48.759 112.127-55.297z" fill="#e7d803"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

146
run-tests.ps1

@ -1,86 +1,71 @@
param(
[string]$targetFramework,
[string]$is32Bit = "False",
[string]$skipCodeCov = $false
[string]$os,
[string]$targetFramework,
[string]$doCoverage = "False",
[string]$is32Bit = "False"
)
if (!$targetFramework){
Write-Host "run-tests.ps1 ERROR: targetFramework is undefined!"
exit 1
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
}
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;
$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;
}
}
if ( ($targetFramework -eq "netcoreapp2.1") -and ($env:CI -eq "True") -and ($is32Bit -ne "True") -and $skipCodeCov -ne $true) {
# We execute CodeCoverage.cmd only for one specific job on CI (netcoreapp2.1 + 64bit )
$testRunnerCmd = "./tests/CodeCoverage/CodeCoverage.ps1"
}
elseif ($targetFramework -eq "mono") {
$testDllPath = "$PSScriptRoot\tests\ImageSharp.Tests\bin\Release\net462\SixLabors.ImageSharp.Tests.dll"
VerifyPath($testDllPath, "test dll missing:")
$xunitRunnerPath = "${env:HOMEPATH}\.nuget\packages\xunit.runner.console\2.3.1\tools\net452\"
VerifyPath($xunitRunnerPath, "xunit console runner is missing on path:")
cd "$xunitRunnerPath"
if ($is32Bit -ne "True") {
$monoPath = "${env:PROGRAMFILES}\Mono\bin\mono.exe"
elseif ($submoduleStatus -match "\+") {
# submodule is not synced:
return 1;
}
else {
$monoPath = "${env:ProgramFiles(x86)}\Mono\bin\mono.exe"
# everything fine:
return 0;
}
}
else {
# git call failed, so we should warn
return 3;
}
}
VerifyPath($monoPath, "mono runtime missing:")
$testRunnerCmd = "& `"${monoPath}`" .\xunit.console.exe `"${testDllPath}`""
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 {
cd .\tests\ImageSharp.Tests
$xunitArgs = "-nobuild -c Release -framework $targetFramework"
Set-Location .\tests
$xunitArgs = "-nobuild -c Release -framework $targetFramework"
if ($targetFramework -eq "netcoreapp2.1") {
# There were issues matching the correct installed runtime if we do not specify it explicitly:
$xunitArgs += " --fx-version 2.1.0"
}
$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"
}
if ($is32Bit -eq "True") {
$xunitArgs += " -x86"
}
$testRunnerCmd = "dotnet xunit $xunitArgs"
$testRunnerCmd = "dotnet xunit $xunitArgs"
}
Write-Host "running:"
@ -89,25 +74,28 @@ Write-Host "..."
Invoke-Expression $testRunnerCmd
cd $PSScriptRoot
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";
}
# 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

4
src/ImageSharp/ImageSharp.csproj

@ -118,10 +118,6 @@
</Compile>
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="SixLabors.ImageSharp.Drawing" />
</ItemGroup>
<ItemGroup>
<None Update="Formats\Jpeg\Components\Block8x8F.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>

4
tests/CodeCoverage/CodeCoverage.cmd

@ -12,10 +12,10 @@ dotnet restore ImageSharp.sln
rem Clean the solution to force a rebuild with /p:codecov=true
dotnet clean ImageSharp.sln -c Release
rem The -threshold options prevents this taking ages...
tests\CodeCoverage\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"dotnet.exe" -targetargs:"test tests\ImageSharp.Tests\ImageSharp.Tests.csproj -c Release -f netcoreapp2.1 /p:codecov=true" -register:user -threshold:10 -oldStyle -safemode:off -output:.\ImageSharp.Coverage.xml -hideskipped:All -returntargetcode -filter:"+[SixLabors.ImageSharp*]*"
tests\CodeCoverage\OpenCover.4.7.922\tools\OpenCover.Console.exe -target:"dotnet.exe" -targetargs:"test tests\ImageSharp.Tests\ImageSharp.Tests.csproj -c Release -f netcoreapp2.1 /p:codecov=true" -register:user -threshold:10 -oldStyle -safemode:off -output:.\ImageSharp.Coverage.xml -hideskipped:All -returntargetcode -filter:"+[SixLabors.ImageSharp*]*"
if %errorlevel% neq 0 exit /b %errorlevel%
SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%
pip install codecov
codecov -f "ImageSharp.Coverage.xml"
codecov -f "ImageSharp.Coverage.xml"

6
tests/Directory.Build.props

@ -13,6 +13,7 @@
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
<ImageSharpProjectCategory>tests</ImageSharpProjectCategory>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
@ -25,6 +26,11 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" IsImplicitlyDefined="true" />
<PackageReference Include="xunit" IsImplicitlyDefined="true" />
<PackageReference Include="xunit.runner.visualstudio" IsImplicitlyDefined="true" />
<PackageReference Include="coverlet.collector" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\src\ImageSharp\ImageSharp.csproj" />
</ItemGroup>
</Project>

5
tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj

@ -7,7 +7,6 @@
<RootNamespace>SixLabors.ImageSharp.Benchmarks</RootNamespace>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks Condition="$(skipFullFramework) != 'true'">$(TargetFrameworks);net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
@ -25,8 +24,4 @@
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ImageSharp\ImageSharp.csproj" />
</ItemGroup>
</Project>

6
tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj

@ -22,9 +22,5 @@
<PackageReference Include="Moq" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ImageSharp\ImageSharp.csproj" />
</ItemGroup>
</Project>

8
tests/ImageSharp.Tests/ImageSharp.Tests.csproj

@ -21,10 +21,6 @@
<PackageReference Include="xunit.runner.console" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" />
</ItemGroup>
<ItemGroup>
<None Update="TestFonts\OpenSans-Regular.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -37,9 +33,5 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ImageSharp\ImageSharp.csproj" />
</ItemGroup>
</Project>

Loading…
Cancel
Save