This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new fbc9841cf AVRO-3415: Add code coverage report support for csharp
(#1565)
fbc9841cf is described below
commit fbc9841cf8d7af6913cdc244bbb793eb1914004b
Author: Kyle Schoonover <[email protected]>
AuthorDate: Tue Apr 19 00:30:09 2022 -0700
AVRO-3415: Add code coverage report support for csharp (#1565)
* AVRO-3360 Updated XML documentation
* Revert "AVRO-3360 Updated XML documentation"
This reverts commit b8601c072a5083380d30b580804dd0908b8cf4cc.
* AVRO-3415 Add code coverage report support for csharp
* Ignore Updates and package references
* Updated names
* Sorted packages alphabetically
* Mode ReportGenerator instructions for global.
* Update versions.props
* Remove path
* Updated tabbing
* Cleanup version.props
* Add missing settings from version.props
* Updated from tabs to 2 space indents
* Added command in code block
* Fix carriage return
* force carriage return
* Another carriage return
* Added longer path to report
Co-authored-by: Kyle T. Schoonover <[email protected]>
(cherry picked from commit c5d7cff2643792ab4b8da3cba78df5fe7778c91f)
---
lang/csharp/.gitignore | 2 ++
lang/csharp/CODECOVERAGE.md | 31 ++++++++++++++++++++++++++++
lang/csharp/src/apache/test/Avro.test.csproj | 8 +++++++
lang/csharp/versions.props | 3 +++
4 files changed, 44 insertions(+)
diff --git a/lang/csharp/.gitignore b/lang/csharp/.gitignore
index 80304575b..4218bd59d 100644
--- a/lang/csharp/.gitignore
+++ b/lang/csharp/.gitignore
@@ -52,5 +52,7 @@ obj/
#Test results
TestResult.xml
+Coverage
+TestResults
.vs/
diff --git a/lang/csharp/CODECOVERAGE.md b/lang/csharp/CODECOVERAGE.md
new file mode 100644
index 000000000..c06cc5af7
--- /dev/null
+++ b/lang/csharp/CODECOVERAGE.md
@@ -0,0 +1,31 @@
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+# C# Avro Code Coverage
+
+The following instructions should be followed in order to create a code
coverage report locally.
+
+1. Open a command prompt
+2. Install ReportGenerator globally\
+ a. Run the following command line: `dotnet tool install --global
dotnet-reportgenerator-globaltool --version 5.1.4 --add-source
https://www.nuget.org/packages/`\
+ b. The latest version can be found at [Nuget
ReportGenerator](https://www.nuget.org/packages/dotnet-reportgenerator-globaltool/)
+3. Navigate to the test project `avro\lang\csharp\src\apache\test`
+4. Run the following test command `dotnet test --results-directory
./TestResults --collect:"XPlat Code Coverage"`
+5. Generate the report with the following command `ReportGenerator
"-reports:./TestResults/*/coverage.cobertura.xml" "-targetdir:./Coverage/"
-reporttypes:HTML`
+6. Open Report under `avro\lang\csharp\src\apache\test\Coverage\index.html`
diff --git a/lang/csharp/src/apache/test/Avro.test.csproj
b/lang/csharp/src/apache/test/Avro.test.csproj
index 18b5dd8a3..24fa4b31f 100644
--- a/lang/csharp/src/apache/test/Avro.test.csproj
+++ b/lang/csharp/src/apache/test/Avro.test.csproj
@@ -32,6 +32,14 @@
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="coverlet.collector"
Version="$(CoverletCollectorVersion)">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers;
buildtransitive</IncludeAssets>
+ </PackageReference>
+ <PackageReference Include="coverlet.msbuild"
Version="$(CoverletMSBuildVersion)">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers;
buildtransitive</IncludeAssets>
+ </PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis"
Version="$(MicrosoftCodeAnalysisVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp"
Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk"
Version="$(MicrosoftNETTestSdkVersion)" />
diff --git a/lang/csharp/versions.props b/lang/csharp/versions.props
index d1c39164f..170e609db 100644
--- a/lang/csharp/versions.props
+++ b/lang/csharp/versions.props
@@ -52,9 +52,12 @@
<!--
These packages are used for building, testing and code analysis. Most
likely they are safe to upgrade
+ Please sort the packages alphabetically
-->
<PropertyGroup Label="Build, Test, Code Analysis, Benchmark Package
Versions">
<BenchmarkDotNetVersion>0.13.1</BenchmarkDotNetVersion>
+ <CoverletCollectorVersion>3.1.2</CoverletCollectorVersion>
+ <CoverletMSBuildVersion>3.1.2</CoverletMSBuildVersion>
<MicrosoftBuildFrameworkVersion>17.1.0</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>17.1.0</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftCodeAnalysisVersion>4.1.0</MicrosoftCodeAnalysisVersion>