Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,24 @@ extends:
arguments: '--configuration $(BuildConfiguration) --no-incremental'

# Run the Unit test
- task: DotNetCoreCLI@2
- pwsh: |
dotnet test "$(Build.SourcesDirectory)\Microsoft.OpenApi.slnx" `
--configuration $(BuildConfiguration) `
--no-build `
-- `
--report-xunit-trx `
--results-directory "$(Agent.TempDirectory)\TestResults" `
--minimum-expected-tests 1
displayName: 'test'

- task: PublishTestResults@2
displayName: 'Publish test results'
condition: succeededOrFailed()
inputs:
command: test
projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.slnx'
arguments: '--configuration $(BuildConfiguration) --no-build'
testResultsFormat: VSTest
testResultsFiles: '$(Agent.TempDirectory)\TestResults\*.trx'
failTaskOnMissingResultsFile: true
failTaskOnFailedTests: true

- task: EsrpCodeSigning@6
displayName: 'ESRP CodeSigning binaries'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
id: run_unit_tests
shell: pwsh
run: |
dotnet test Microsoft.OpenApi.slnx -c Release --no-build -v n --collect:"XPlat Code Coverage"
dotnet test --solution Microsoft.OpenApi.slnx -c Release -v n --coverlet --coverlet-output-format cobertura

- name: Install report generator
shell: pwsh
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Generate coverage report
shell: pwsh
run: |
reportgenerator -reports:**/coverage.cobertura.xml -targetdir:./reports/coverage -reporttypes:"Html;MarkdownSummaryGithub;Cobertura"
reportgenerator -reports:**/coverage.cobertura*.xml -targetdir:./reports/coverage -reporttypes:"Html;MarkdownSummaryGithub;Cobertura"

- name: Add coverage to job summary
shell: bash
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ jobs:
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
CollectCoverage: true
CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
shell: pwsh
run: |
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml"
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover*.xml"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
dotnet workload restore
dotnet build
dotnet test Microsoft.OpenApi.slnx --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet test --solution Microsoft.OpenApi.slnx --verbosity normal --coverlet --coverlet-output-format opencover
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"sdk": {
"version": "10.0.400"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
<NoWarn>CA2007</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="coverlet.MTP" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" PrivateAssets="all" />
<PackageReference Include="coverlet.collector" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="xunit.v3" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="**\*.yaml" Exclude="**\bin\**;**\obj\**">
Expand All @@ -15,12 +16,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="coverlet.msbuild" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="coverlet.MTP" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageReference Include="FluentAssertions" Version="7.2.2" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" PrivateAssets="all" />
<PackageReference Include="xunit.v3" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 3 additions & 4 deletions test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
<SignAssembly>true</SignAssembly>
<OutputType>Library</OutputType>
<AssemblyOriginatorKeyFile>..\..\src\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="coverlet.msbuild" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="coverlet.MTP" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="7.2.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Verify.XunitV3" Version="31.28.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" PrivateAssets="all" />
<PackageReference Include="xunit.v3" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading