Skip to content

Commit 53765ac

Browse files
authored
Add sonar cloud scanning and code coverage (#57)
1 parent 1ad8109 commit 53765ac

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,20 @@ jobs:
4242
run: ./NUnit.ConsoleRunner.3.4.0/tools/nunit3-console.exe ./tests/net45/bin/Debug/tests.net45.dll
4343
- name: Build (DotNet Core 5.0 and NetStandard 2.0)
4444
run: dotnet build ./csharp-csv-reader.sln
45-
- name: Test (net60)
46-
run: dotnet test ./tests/net60/tests.net60.csproj
4745
- name: Test (net50)
4846
run: dotnet test ./tests/net50/tests.net50.csproj
47+
- name: SonarCloud Install
48+
run:
49+
dotnet tool update dotnet-sonarscanner --tool-path /tmp/sonar
50+
- name: Coverage Install
51+
run:
52+
dotnet tool update dotnet-coverage --tool-path /tmp/coverage
53+
- name: SonarCloud Start
54+
run:
55+
/tmp/sonar/dotnet-sonarscanner begin /k:"tspence_csharp-csv-reader" /o:"tspence" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
56+
- name: Test (net60)
57+
run:
58+
/tmp/coverage/dotnet-coverage collect "dotnet test ./tests/net60/tests.net60.csproj" -f xml -o "coverage.xml"
59+
- name: SonarCloud End
60+
run:
61+
/tmp/sonar/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[![NuGet](https://img.shields.io/nuget/v/CSVFile.svg?style=plastic)](https://www.nuget.org/packages/CSVFile/)
22
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/tspence/csharp-csv-reader/dotnet.yml?branch=main)
3+
[![SonarCloud Coverage](https://sonarcloud.io/api/project_badges/measure?project=tspence_csharp-csv-reader&metric=coverage)](https://sonarcloud.io/component_measures/metric/coverage/list?id=tspence_csharp-csv-reader)
4+
[![SonarCloud Bugs](https://sonarcloud.io/api/project_badges/measure?project=tspence_csharp-csv-reader&metric=bugs)](https://sonarcloud.io/component_measures/metric/reliability_rating/list?id=tspence_csharp-csv-reader)
5+
[![SonarCloud Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=tspence_csharp-csv-reader&metric=vulnerabilities)](https://sonarcloud.io/component_measures/metric/security_rating/list?id=tspence_csharp-csv-reader)
36

47
# CSVFile
58
This library is a series of unit tested, thoroughly commented CSV parsing functions which I have developed off and on since 2006. Extremely small and easy to implement; includes unit tests for the majority of odd CSV edge cases. Library supports different delimiters, qualifiers, and embedded newlines. Can read and write from data tables.

tests/net50/tests.net50.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
23+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
2424
<PackageReference Include="NUnit" Version="3.11.0" />
2525
<PackageReference Include="NUnit3TestAdapter" Version="3.11.0" />
2626
<PackageReference Include="System.Linq.Async" Version="6.0.1" />

tests/net60/tests.net60.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
22+
<PackageReference Include="coverlet.collector" Version="6.0.0">
23+
<PrivateAssets>all</PrivateAssets>
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25+
</PackageReference>
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
2327
<PackageReference Include="NUnit" Version="3.11.0" />
2428
<PackageReference Include="NUnit3TestAdapter" Version="3.11.0" />
2529
</ItemGroup>

0 commit comments

Comments
 (0)