Skip to content

Commit 43b209b

Browse files
authored
Enable the use of codecov.io (#163)
* Update Test.yml * Include test projects in code coverage * Pass settings correctly * Use the action * Wait longer * Finalize the name of the step * Update ReadMe.md * Update ReadMe.md
1 parent 0abe9ca commit 43b209b

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

.github/workflows/Test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ jobs:
4141
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
4242
4343
# --collect:"XPlat Code Coverage" means collect test coverage with https://github.com/coverlet-coverage/coverlet
44-
dotnet test CSharpMath.CrossPlatform.slnf -c Release -l GitHubActions --blame --collect:"XPlat Code Coverage" -r .testcoverage -p:PackageReleaseNotes="$RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }}
44+
# Coverlet settings come after --: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md#advanced-options-supported-via-runsettings
45+
dotnet test CSharpMath.CrossPlatform.slnf -c Release -l GitHubActions --blame --collect:"XPlat Code Coverage" -r .testcoverage -p:PackageReleaseNotes="$RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true
4546
- name: Run ReportGenerator on Test Coverage results
4647
uses: danielpalme/ReportGenerator-GitHub-Action@4.6.4
4748
with:
@@ -55,6 +56,12 @@ jobs:
5556
with:
5657
name: CSharpMath test coverage results
5758
path: .testcoverage/
59+
- name: Upload CSharpMath test coverage results to codecov.io
60+
uses: codecov/codecov-action@v1
61+
with:
62+
file: .testcoverage/**/*.xml # optional
63+
name: CSharpMath test coverage # optional
64+
fail_ci_if_error: true # optional (default = false)
5865
- name: Upload CSharpMath.Rendering.Tests results as CI artifacts
5966
uses: actions/upload-artifact@v2
6067
if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648

CSharpMath.Editor.Tests/CaretTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public async Task Test() {
146146
await Task.Delay((int)MathKeyboard<TestFont, char>.DefaultBlinkMilliseconds - CaretBlinks.MillisecondBuffer);
147147

148148
Assert.Equal(MathKeyboardCaretState.Shown, keyboard.CaretState);
149-
await Task.Delay(3 * CaretBlinks.MillisecondBuffer);
149+
await Task.Delay(4 * CaretBlinks.MillisecondBuffer);
150150
Assert.Equal(MathKeyboardCaretState.TemporarilyHidden, keyboard.CaretState);
151151
}
152152
}

Directory.Build.props

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@
44
<PropertyGroup Condition="$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Ios'))">
55
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
7-
<ItemGroup Condition="$(MSBuildProjectName.Contains('Test'))">
7+
<ItemGroup Condition="$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Visualizer'))">
88
<PackageReference Include="xunit" Version="2.4.1" />
99
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
1010
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
1111
<PackageReference Include="coverlet.collector" Version="1.3.0" />
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="*" />
1313
<PackageReference Include="GitHubActionsTestLogger" Version="1.1.0" />
1414
</ItemGroup>
15-
<PropertyGroup Condition="$(MSBuildProjectName.StartsWith('CSharpMath'))"> <!--Don't apply to Typography projects-->
15+
<!--Don't apply to Typography projects-->
16+
<PropertyGroup Condition="$(MSBuildProjectName.StartsWith('CSharpMath'))">
17+
<!--CSharpMath-specific properties for centralized control of values-->
18+
<AvaloniaVersion>0.10.0-preview5</AvaloniaVersion>
19+
20+
<!--C# code properties-->
1621
<LangVersion>preview</LangVersion>
1722
<Nullable>enable</Nullable>
1823
<NoWarn>
1924
CA1062,<!--Obsolete with C# 8 nullability annotations-->
2025
CA1303,<!--Who localizes exception messages, anyway?-->
2126
</NoWarn>
2227
<WarningsAsErrors Condition="$(MSBuildProjectExtension) == '.csproj'">nullable</WarningsAsErrors>
23-
<AvaloniaVersion>0.10.0-preview5</AvaloniaVersion>
2428

2529
<!--NuGet properties: Ordered according to https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target-->
2630
<PackageId>$(MSBuildProjectName)</PackageId>
@@ -42,13 +46,13 @@
4246
<RepositoryType>git</RepositoryType>
4347
<RepositoryBranch>master</RepositoryBranch>
4448
<!--RepositoryCommit property is set in the SetDefaultPackageVersion target below-->
45-
49+
4650
<!--SourceLink properties: Ordered according to https://github.com/dotnet/sourcelink#using-source-link-in-net-projects-->
4751
<PublishRepositoryUrl>true</PublishRepositoryUrl>
4852
<EmbedUntrackedSources>true</EmbedUntrackedSources>
4953
<IncludeSymbols>true</IncludeSymbols>
5054
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
51-
55+
5256
<!--Info on NuGet packaging properties: https://github.com/NuGet/Home/wiki/Adding-nuget-pack-as-a-msbuild-target-->
5357
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
5458
<GeneratePackageOnBuild Condition="
@@ -57,17 +61,19 @@
5761
And !$(MSBuildProjectName.Contains('Example'))
5862
And !$(MSBuildProjectName.Contains('Playground'))
5963
And $(Configuration.Equals('Release'))">true</GeneratePackageOnBuild>
60-
64+
<PackageOutputPath>$(MSBuildThisFileDirectory).nupkgs</PackageOutputPath>
65+
6166
<!--https://github.com/clairernovotny/DeterministicBuilds
6267
Deterministic builds are important as they enable verification that the resulting binary was built from the specified source and provides traceability.
6368
It should not be enabled during local dev or the debugger won't be able to find the local source files.
6469
Also, this requires SourceLink to be enabled or else error: https://github.com/dotnet/sourcelink/issues/91#issuecomment-400787926-->
6570
<!--But this only works well with dotnet msbuild, not the Windows full MSBuild-->
6671
<ContinuousIntegrationBuild Condition="'$(MSBuildRuntimeType)'=='Core'">$(GeneratePackageOnBuild)</ContinuousIntegrationBuild>
67-
68-
<PackageOutputPath>$(MSBuildThisFileDirectory).nupkgs</PackageOutputPath>
72+
73+
<!--Assembly properties-->
6974
<NeutralLanguage>en</NeutralLanguage>
70-
<RootNamespace>$(MSBuildProjectName)</RootNamespace> <!--Prefix namespace for embedded resources-->
75+
<!--Prefix namespace for embedded resources-->
76+
<RootNamespace>$(MSBuildProjectName)</RootNamespace>
7177
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
7278
</PropertyGroup>
7379
<!--SourceLink does not work well with WPF projects so we don't add it unconditionally-->

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CSharpMath is a C# port of the wonderful <a href="https://github.com/kostub/iosM
1111
[Current prerelease][NuGet-pre]|[![NuGet pre-release shield](https://img.shields.io/nuget/vpre/CSharpMath.svg)][NuGet-pre] [![GitHub pre-release shield](https://img.shields.io/github/release-pre/verybadcat/CSharpMath.svg)][GitHub-pre] [![GitHub pre-release date shield](https://img.shields.io/github/release-date-pre/verybadcat/CSharpMath.svg)][GitHub-pre] [![GitHub commits since last prerelease shield](https://img.shields.io/github/commits-since/verybadcat/CSharpMath/latest.svg?include_prereleases)][GitHub-pre]
1212
<!-- The "Current nightly" badge is blocked on https://github.com/badges/shields/pull/4184 -->
1313

14-
[![NuGet downloads shield](https://img.shields.io/nuget/dt/CSharpMath.svg)][NuGet] [![GitHub contributors shield](https://img.shields.io/github/contributors/verybadcat/CSharpMath.svg)](https://github.com/verybadcat/CSharpMath/graphs/contributors) [![GitHub license shield](https://img.shields.io/github/license/verybadcat/CSharpMath.svg)](https://github.com/verybadcat/CSharpMath/blob/master/License) [![GitHub last commit shield](https://img.shields.io/github/last-commit/verybadcat/CSharpMath.svg)](https://github.com/verybadcat/CSharpMath/commits/master) [![GitHub Build workflow shield](https://img.shields.io/github/workflow/status/verybadcat/CSharpMath/Build.svg)](https://github.com/verybadcat/CSharpMath/actions?query=workflow%3ABuild+branch%3Amaster) [![GitHub Test workflow shield](https://img.shields.io/github/workflow/status/verybadcat/CSharpMath/Test.svg?label=tests)](https://github.com/verybadcat/CSharpMath/actions?query=workflow%3ATest+branch%3Amaster)
14+
[![NuGet downloads shield](https://img.shields.io/nuget/dt/CSharpMath.svg)][NuGet] [![GitHub contributors shield](https://img.shields.io/github/contributors/verybadcat/CSharpMath.svg)](https://github.com/verybadcat/CSharpMath/graphs/contributors) [![GitHub license shield](https://img.shields.io/github/license/verybadcat/CSharpMath.svg)](https://github.com/verybadcat/CSharpMath/blob/master/License) [![GitHub last commit shield](https://img.shields.io/github/last-commit/verybadcat/CSharpMath.svg)](https://github.com/verybadcat/CSharpMath/commits/master) [![GitHub Build workflow shield](https://img.shields.io/github/workflow/status/verybadcat/CSharpMath/Build.svg)](https://github.com/verybadcat/CSharpMath/actions?query=workflow%3ABuild+branch%3Amaster) [![GitHub Test workflow shield](https://img.shields.io/github/workflow/status/verybadcat/CSharpMath/Test.svg?label=tests)](https://github.com/verybadcat/CSharpMath/actions?query=workflow%3ATest+branch%3Amaster) [![codecov.io badge](https://codecov.io/github/verybadcat/CSharpMath/coverage.svg?branch=master)](https://codecov.io/github/verybadcat/CSharpMath?branch=master)
1515

1616
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/verybadcat/CSharpMath.svg)](http://isitmaintained.com/project/verybadcat/CSharpMath "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/verybadcat/CSharpMath.svg)](http://isitmaintained.com/project/verybadcat/CSharpMath "Percentage of issues still open") [![Issues welcome](https://img.shields.io/badge/issues-welcome-success)](https://github.com/verybadcat/CSharpMath/issues) [![Pull Requests welcome](https://img.shields.io/badge/pull_requests-welcome-success)](https://github.com/verybadcat/CSharpMath/issues) [![](https://img.shields.io/badge/made%20with-%e2%9d%a4-ff69b4.svg)](https://www.youtube.com/watch?v=dQw4w9WgXcQ "")
1717

0 commit comments

Comments
 (0)