Skip to content

Commit

Permalink
Fix Linux CI build + Fix opencover (#851)
Browse files Browse the repository at this point in the history
* Fix Linux CI Test (opencover.xml)

* 2

* Build & Execute Unit tests

* ,cmd

* cout

* 12

* b

* server

* b =b

* /p:CoverletOutput=./test/WireMock.Net.Tests/WireMock.Net.Tests

* co?

* 2p

* 2?

* failOnStderr: false

* e0

* cc

* pub

* sc

* coverlet

* props

* pt

* coverage.net6.0.opencover.xml
  • Loading branch information
StefH committed Nov 25, 2022
1 parent 429d683 commit 35d42a5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<!-- https://github.com/coverlet-coverage/coverlet/issues/1391 -->
<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Tests'))">
<CollectCoverage>true</CollectCoverage>
<ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute>
<CoverletOutputFormat>opencover</CoverletOutputFormat>
</PropertyGroup>

<ItemGroup>
<None Include="../../resources/WireMock.Net-Logo.png" Pack="true" PackagePath="" />
<!--<None Include="../../PackageReadme.md" Pack="true" PackagePath=""/>-->
Expand Down
14 changes: 6 additions & 8 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ jobs:
command: 'build'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--configuration Debug --framework net6.0'

- task: DotNetCoreCLI@2
displayName: 'Execute Unit tests'

- task: CmdLine@2
inputs:
command: 'test'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--no-build --configuration Debug --framework net6.0 --collect:"XPlat Code Coverage" --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'

script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net6.0'
displayName: 'Execute Unit Tests with Coverage'

- task: SonarCloudAnalyze@1
displayName: 'SonarCloud: Run Code Analysis'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
Expand All @@ -76,7 +74,7 @@ jobs:
- task: PublishBuildArtifacts@1
displayName: Publish coverage file
inputs:
PathtoPublish: '/home/vsts/work/1/s/test/WireMock.Net.Tests/coverage.net6.0.opencover.xml'
PathtoPublish: './test/WireMock.Net.Tests/coverage.net6.0.opencover.xml'

- job: Windows_Build_Test

Expand Down
10 changes: 5 additions & 5 deletions examples/WireMock.Net.Service/App.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
3 changes: 2 additions & 1 deletion examples/WireMock.Net.Service/WireMock.Net.Service.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
<OutputType>Exe</OutputType>
<RootNamespace>WireMock.Net.Service</RootNamespace>
<AssemblyName>WireMock.Net.Service</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
2 changes: 1 addition & 1 deletion examples/WireMock.Net.Service/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" requireReinstallation="true" />
<package id="XPath2" version="1.1.3" targetFramework="net452" />
</packages>
6 changes: 3 additions & 3 deletions test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@

<ItemGroup>
<PackageReference Include="Codecov" Version="1.13.0" />
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 35d42a5

Please sign in to comment.