Skip to content

Commit

Permalink
housekeeping: Further work on updating code coverage (#765)
Browse files Browse the repository at this point in the history
* housekeeping: Further work on updating code coverage

* further work

* further work

* further work

* Update coverlet.xml
  • Loading branch information
glennawatson committed Nov 26, 2023
1 parent 33bbe3e commit a0c2690
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
7 changes: 3 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ updates:
- package-ecosystem: nuget
directory: "/src"
schedule:
interval: monthly
time: "00:00"
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "monthly"
interval: weekly
open-pull-requests-limit: 10
13 changes: 6 additions & 7 deletions .github/workflows/pr-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
with:
Expand All @@ -44,23 +45,21 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Install SonarCloud scanner
- name: Install tools
run: |
dotnet tool install -g dotnet-sonarscanner
- name: Install JetBrains DotCover
run: dotnet tool install --global JetBrains.dotCover.GlobalTool

- name: NuGet Restore
run: dotnet restore DynamicData.sln
working-directory: src

- name: Run coverage tests
run: |
dotnet sonarscanner begin /k:"reactivemarbles_DynamicData" /o:"reactivemarbles" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html /d:sonar.host.url="https://sonarcloud.io"
dotnet build --no-restore --no-incremental --configuration ${{ matrix.configuration }} DynamicData.sln
dotnet dotcover test --dcReportType=HTML --no-restore --configuration ${{ matrix.configuration }}
dotnet sonarscanner begin /k:"reactivemarbles_DynamicData" /o:"reactivemarbles" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths=./**/coverage.opencover.xml /d:sonar.host.url="https://sonarcloud.io"
dotnet build --no-restore --no-incremental --configuration ${{ matrix.configuration }} -p:ContinuousIntegrationBuild=false DynamicData.sln
dotnet test --no-build --configuration ${{ matrix.configuration }} --collect:"XPlat Code Coverage" --settings coverlet.xml
dotnet sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

working-directory: src
6 changes: 5 additions & 1 deletion src/DynamicData.Tests/DynamicData.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618;CA1801;CA1063;CS8767;CS8602;CS8618;IDE1006</NoWarn>
Expand All @@ -20,5 +20,9 @@
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
19 changes: 19 additions & 0 deletions src/coverlet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>opencover</Format>
<Include>[DynamicData]*</Include> <!-- [Assembly-Filter]Type-Filter -->
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>
<SingleHit>false</SingleHit>
<!--<UseSourceLink>true</UseSourceLink> -->
<SkipAutoProps>true</SkipAutoProps>
<DeterministicReport>false</DeterministicReport>
<ExcludeAssembliesWithoutSources>MissingAll,MissingAny,None</ExcludeAssembliesWithoutSources>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>

0 comments on commit a0c2690

Please sign in to comment.