Skip to content

Commit

Permalink
Codecov update (#1359)
Browse files Browse the repository at this point in the history
- switch to the codecov collector
- add codecoverage batch command for local execution
  • Loading branch information
mregen committed Apr 15, 2021
1 parent fafc442 commit 558c395
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .azurepipelines/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
inputs:
command: 'custom'
custom: 'tool'
arguments: 'install --tool-path . azuresigntool'
arguments: 'install --version 2.0.17 --tool-path . azuresigntool'
displayName: Install AzureSignTool
- task: DotNetCoreCLI@2
inputs:
Expand Down
7 changes: 4 additions & 3 deletions .azurepipelines/testcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ jobs:
inputs:
command: test
projects: '**/*.Tests.csproj'
arguments: '--no-restore --framework ${{ parameters.framework }} --configuration ${{ parameters.configuration }} /p:CollectCoverage=true /p:Exclude="[*.Tests]*" /p:CoverletOutputFormat=cobertura'
# note: /p:CollectCoverage=true is only used to disable deterministc builds
arguments: '--no-restore --framework ${{ parameters.framework }} --configuration ${{ parameters.configuration }} /p:CollectCoverage=true --collect:"XPlat Code Coverage"'
- script: |
bash <(curl -s https://codecov.io/bash)
bash <(curl -s https://codecov.io/bash) -s $(Agent.TempDirectory)
continueOnError: true
condition: ne( variables['CODECOV_TOKEN'], '')
Expand All @@ -53,7 +54,7 @@ jobs:
arguments: install --tool-path tools dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool
- script: |
tools/reportgenerator -reports:$(Build.SourcesDirectory)/**/coverage.*.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage "-reporttypes:Cobertura;HtmlSummary" "-title:UA .Net Standard Test Coverage" "-assemblyfilters:-*.Tests"
tools/reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage "-reporttypes:Cobertura;HtmlSummary" "-title:UA .Net Standard Test Coverage" "-assemblyfilters:-*.Tests"
mv $(Build.SourcesDirectory)/CodeCoverage/summary.htm $(Build.SourcesDirectory)/CodeCoverage/index.htm
displayName: Create Code Coverage Report
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ dotnet_naming_rule.instance_fields_should_be_camel_case.severity =
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style

dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_symbols.instance_fields.applicable_kinds = field, event
dotnet_naming_symbols.instance_fields.applicable_accessibilities = private, protected, private_protected, protected_friend

dotnet_naming_style.instance_field_style.capitalization = camel_case
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ AutoTest.Net/
# Installshield output folder
[Ee]xpress/

# CodeCoverage
CodeCoverage/
TestResults/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit.Console" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions Tests/Opc.Ua.Core.Tests/Opc.Ua.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit.Console" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions Tests/Opc.Ua.Gds.Tests/Opc.Ua.Gds.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit.Console" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions Tests/Opc.Ua.PubSub.Tests/Opc.Ua.PubSub.Tests.Disabled.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit.Console" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
Expand All @@ -18,9 +18,9 @@
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
<PackageReference Include="System.Security.Cryptography.Primitives" Version="4.3.0" />
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit.Console" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

Expand Down
24 changes: 24 additions & 0 deletions Tests/codecoverage.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@REM Copyright (c) OPC Foundation. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.

@setlocal EnableExtensions EnableDelayedExpansion
@echo off

set current-path=%~dp0
rem // remove trailing slash
set current-path=%current-path:~0,-1%
set build_root=%current-path%\..

cd %build_root%

rd /s /Q .\CodeCoverage
rd /s /Q .\TestResults
dotnet test "UA Core Library.sln" -v n --configuration Release --collect:"XPlat Code Coverage" --results-directory ./TestResults

REM ensure latest report tool is installed
dotnet tool uninstall -g dotnet-reportgenerator-globaltool
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:./TestResults/**/coverage.cobertura.xml -targetdir:./CodeCoverage -reporttypes:Badges;Html;HtmlSummary;Cobertura

REM Display result in browser
.\CodeCoverage\index.html
6 changes: 3 additions & 3 deletions common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<RepositoryUrl>https://github.com/OPCFoundation/UA-.NETStandard</RepositoryUrl>
<VersionPrefix>1.04.360</VersionPrefix>
<VersionSuffix>preview-$([System.DateTime]::Now.ToString("yyyyMMdd"))</VersionSuffix>
<Copyright>Copyright © 2004-2020 OPC Foundation, Inc</Copyright>
<Copyright>Copyright © 2004-2021 OPC Foundation, Inc</Copyright>
<Company>OPC Foundation</Company>
<Authors>OPC Foundation</Authors>
<NoWarn>NU5125;RCS1138;RCS1139</NoWarn>
<NeutralLanguage>en-US</NeutralLanguage>
<HighEntropyVA>true</HighEntropyVA>
<IsPackable>false</IsPackable>
<!--TODO <TreatWarningsAsErrors>true</TreatWarningsAsErrors>-->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!--TODO <GenerateDocumentationFile>true</GenerateDocumentationFile>-->
</PropertyGroup>

Expand All @@ -22,7 +22,7 @@
<PackageLicenseFile>licenses/LICENSE.txt</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>$(RepositoryUrl)/releases</PackageReleaseNotes>
<PackageTags>OPCFoundation OPC-UA netstandard ios linux dotnet net netcore uwp</PackageTags>
<PackageTags>OPCFoundation OPC UA netstandard ios linux dotnet net netcore uwp</PackageTags>
</PropertyGroup>

<ItemGroup Condition="'$(IsPackable)' != 'false'">
Expand Down

0 comments on commit 558c395

Please sign in to comment.