Use vstest Cobertura support (#1177)
* Use vstest Cobertura support Thanks to https://github.com/microsoft/vstest/issues/2874 Cobertura reports can be obtained faster without coverlet. * Update Kubectl.Tests.csproj * Update KubernetesClient.Classic.Tests.csproj * Update KubernetesClient.Tests.csproj * Update buildtest.yaml * Update AbstractKubernetes.cs.template * Update IBasicKubernetes.cs.template * Update IOperations.cs.template * Update Model.cs.template * Add filter * revert
This commit is contained in:
21
.github/workflows/buildtest.yaml
vendored
21
.github/workflows/buildtest.yaml
vendored
@@ -24,8 +24,19 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build --configuration Release -v detailed
|
run: dotnet build --configuration Release -v detailed
|
||||||
- name: Test
|
- name: Test
|
||||||
run: dotnet test /p:CollectCoverage=true /p:ExcludeByFile=\"**/KubernetesClient/generated/**/*.cs\" /p:CoverletOutputFormat="cobertura"
|
run: dotnet test --configuration Release --collect:"Code Coverage;Format=Cobertura" --logger trx --results-directory TestResults --settings CodeCoverage.runsettings --no-build
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
directory: ./TestResults
|
||||||
|
files: '*.cobertura.xml'
|
||||||
|
- name: Upload test results
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: test-results
|
||||||
|
path: ./TestResults
|
||||||
|
if: ${{ always() }} # Always run this step even on failure
|
||||||
|
|
||||||
# Test code gen for visual studio compatibility >> https://github.com/kubernetes-client/csharp/pull/1008
|
# Test code gen for visual studio compatibility >> https://github.com/kubernetes-client/csharp/pull/1008
|
||||||
codgen:
|
codgen:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -39,12 +50,12 @@ jobs:
|
|||||||
- name: Setup dotnet SDK 7
|
- name: Setup dotnet SDK 7
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: '7.0.x'
|
dotnet-version: '7.0.x'
|
||||||
- name: Restore nugets (msbuild)
|
- name: Restore nugets (msbuild)
|
||||||
run: msbuild .\src\KubernetesClient.Models\ -t:restore -p:RestorePackagesConfig=true
|
run: msbuild .\src\KubernetesClient.Models\ -t:restore -p:RestorePackagesConfig=true
|
||||||
- name: Build (msbuild)
|
- name: Build (msbuild)
|
||||||
run: msbuild .\src\KubernetesClient.Models\
|
run: msbuild .\src\KubernetesClient.Models\
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -67,7 +78,7 @@ jobs:
|
|||||||
cat skip.log
|
cat skip.log
|
||||||
echo "CASES MUST NOT BE SKIPPED"
|
echo "CASES MUST NOT BE SKIPPED"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
40
CodeCoverage.runsettings
Normal file
40
CodeCoverage.runsettings
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RunSettings>
|
||||||
|
<DataCollectionRunSettings>
|
||||||
|
<DataCollectors>
|
||||||
|
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0">
|
||||||
|
<Configuration>
|
||||||
|
<CodeCoverage>
|
||||||
|
<ModulePaths>
|
||||||
|
<Include>
|
||||||
|
<ModulePath>.*KubernetesClient\..*\.dll$</ModulePath>
|
||||||
|
</Include>
|
||||||
|
<Exclude>
|
||||||
|
<ModulePath>.*tests\.dll$</ModulePath>
|
||||||
|
<ModulePath>.*xunit.*dll$</ModulePath>
|
||||||
|
<ModulePath>.*moq\.dll$</ModulePath>
|
||||||
|
<ModulePath>.*System\.Reactive\.dll$</ModulePath>
|
||||||
|
<ModulePath>.*BouncyCastle\.Crypto\.dll$</ModulePath>
|
||||||
|
<ModulePath>.*IdentityModel\.OidcClient\.dll$</ModulePath>
|
||||||
|
</Exclude>
|
||||||
|
</ModulePaths>
|
||||||
|
<!-- Set this to True to collect coverage information for functions marked with the "SecuritySafeCritical" attribute. Instead of writing directly into a memory location from such functions, code coverage inserts a probe that redirects to another function, which in turns writes into memory. -->
|
||||||
|
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
|
||||||
|
<!-- When set to True, collects coverage information from child processes that are launched with low-level ACLs, for example, UWP apps. -->
|
||||||
|
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
|
||||||
|
<!-- When set to True, collects coverage information from child processes that are launched by test or production code. -->
|
||||||
|
<CollectFromChildProcesses>True</CollectFromChildProcesses>
|
||||||
|
<Attributes>
|
||||||
|
<Exclude>
|
||||||
|
<Attribute>^System.ObsoleteAttribute$</Attribute>
|
||||||
|
<Attribute>^System.CodeDom.Compiler.GeneratedCodeAttribute$</Attribute>
|
||||||
|
<Attribute>^System.Diagnostics.DebuggerHiddenAttribute$</Attribute>
|
||||||
|
<Attribute>^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$</Attribute>
|
||||||
|
</Exclude>
|
||||||
|
</Attributes>
|
||||||
|
</CodeCoverage>
|
||||||
|
</Configuration>
|
||||||
|
</DataCollector>
|
||||||
|
</DataCollectors>
|
||||||
|
</DataCollectionRunSettings>
|
||||||
|
</RunSettings>
|
||||||
@@ -9,11 +9,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
@@ -36,4 +31,4 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</AdditionalFiles>
|
</AdditionalFiles>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -18,11 +18,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
|||||||
@@ -17,11 +17,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
|||||||
Reference in New Issue
Block a user