use azure pipelines instead of appveyor for builds

* trial azure pipelines

[skip ci]

* use vs2017

* build pr commits

* include codecov and update test nuget

* add codecov call

* add publish test results step

* include coverlet package for test coverage and allow coverlet dynamic public types

* add azure pipelines badge and remove appveyor badge

* add nuget pack step

* use build configuration variable for nuget pack and move after build

* fix path to package to pack

* change nuget to dotnet pack

* remove old codecov related tools
This commit is contained in:
Eliot Jones 2019-07-09 21:21:11 +01:00 committed by GitHub
parent 3c49371c68
commit 283e1d38fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 22 deletions

View File

@ -2,7 +2,7 @@
# PdfPig # # PdfPig #
[![Build status](https://ci.appveyor.com/api/projects/status/ni7et2j2ml60pdi3?svg=true)](https://ci.appveyor.com/project/EliotJones/pdf) [![Build Status](https://dev.azure.com/pdfpig/pdfpig/_apis/build/status/UglyToad.PdfPig?branchName=master)](https://dev.azure.com/pdfpig/pdfpig/_build/latest?definitionId=1&branchName=master)
[![codecov](https://codecov.io/gh/UglyToad/PdfPig/branch/master/graph/badge.svg)](https://codecov.io/gh/UglyToad/PdfPig) [![codecov](https://codecov.io/gh/UglyToad/PdfPig/branch/master/graph/badge.svg)](https://codecov.io/gh/UglyToad/PdfPig)
[![Gitter](https://badges.gitter.im/pdfpig/community.svg)](https://gitter.im/pdfpig/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Gitter](https://badges.gitter.im/pdfpig/community.svg)](https://gitter.im/pdfpig/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

56
azure-pipelines.yml Normal file
View File

@ -0,0 +1,56 @@
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pr:
- master
pool:
vmImage: 'vs2017-win2016'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'pack'
packagesToPack: '**/UglyToad.PdfPig.csproj'
includesymbols: true
versioningScheme: 'off'
- script: |
dotnet test ./src/UglyToad.PdfPig.Tests/UglyToad.PdfPig.Tests.csproj -c Debug --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
cd ./src/UglyToad.PdfPig.Tests
dir
displayName: 'Build source, tests and run tests with coverage'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/*.trx'
failTaskOnFailedTests: true
testRunTitle: 'Gather test results'
# Upload coverage to codecov.io
- script: |
%USERPROFILE%\.nuget\packages\codecov\1.5.0\tools\codecov.exe -f "./src/UglyToad.PdfPig.Tests/coverage.opencover.xml" -t $(codecov)
displayName: Upload coverage to codecov.io

View File

@ -1,9 +0,0 @@
@echo off
cd src\CodeCoverage
nuget restore packages.config -PackagesDirectory .
cd ..
CodeCoverage\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"dotnet.exe" -targetargs:"test UglyToad.PdfPig.Tests\UglyToad.PdfPig.Tests.csproj --framework netcoreapp2.0 -c debug" -register:user -output:.\test-results.xml -hideskipped:All -returntargetcode -oldStyle -filter:"+[UglyToad.PdfPig*]* -[UglyToad.PdfPig.Tests*]*"

Binary file not shown.

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenCover" version="4.6.519" />
</packages>

View File

@ -1,5 +1,6 @@
namespace UglyToad.PdfPig.Tests namespace UglyToad.PdfPig.Tests
{ {
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -19,6 +20,12 @@
foreach (var type in types) foreach (var type in types)
{ {
// Skip coverage measuring instrumentation classes.
if (type.FullName.StartsWith("Coverlet", StringComparison.OrdinalIgnoreCase))
{
continue;
}
if (type.IsPublic) if (type.IsPublic)
{ {
publicTypeNames.Add(type.FullName); publicTypeNames.Add(type.FullName);

View File

@ -81,7 +81,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> <PackageReference Include="Codecov" Version="1.5.0" />
<PackageReference Include="coverlet.msbuild" Version="2.6.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="System.Drawing.Common" Version="4.5.0-preview2-26406-04" /> <PackageReference Include="System.Drawing.Common" Version="4.5.0-preview2-26406-04" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" /> <PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />

Binary file not shown.

View File

@ -1,7 +0,0 @@
src\CodeCoverage\CodeCoverage.cmd
pwd
Expand-Archive tools\Codecov.zip -DestinationPath "tools"
tools\Codecov\codecov.exe -f "src\test-results.xml"