-
Notifications
You must be signed in to change notification settings - Fork 1
Split unit/integration test codecov report (#128) #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+138
−5
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2a90b02
Split unit/integration test codecov report (#128)
kurnakovv 7877bc0
Add new not coverade code for test (#128)
kurnakovv f8a1da4
Add new uncover code (#128)
kurnakovv 9ea07d0
Add unit test (#128)
kurnakovv 8455da7
Add disable_search: true (#128)
kurnakovv fe68665
Hard name for codecov flags (#128)
kurnakovv fabada1
Add codecov yml settings (#128)
kurnakovv 031cd3e
Add generate-coverage-reports.ps1 (#128)
kurnakovv 0e970c0
Try to simplify codecov action (#128)
kurnakovv 741ace7
Revert "Try to simplify codecov action (#128)"
kurnakovv 7a80eb6
Add no file check (#128)
kurnakovv b7446fd
Add no file check (#128)
kurnakovv 8ca590a
Delete ExistsInCurrentDirectory (#128)
kurnakovv 8d839ce
Merge branch 'b-128' of github.com:kurnakovv/biak into b-128
kurnakovv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| codecov: | ||
| require_ci_to_pass: true | ||
|
|
||
| coverage: | ||
| status: | ||
| project: | ||
| default: | ||
| enabled: false | ||
| unit-tests: | ||
| flags: | ||
| - unit-tests | ||
| integration-tests: | ||
| flags: | ||
| - integration-tests | ||
|
|
||
| flags: | ||
| unit-tests: | ||
| carryforward: false | ||
| integration-tests: | ||
| carryforward: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| param( | ||
| [switch]$NoBuild | ||
| ) | ||
|
|
||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| $repoRoot = $PSScriptRoot | ||
| $testResultsRoot = Join-Path $repoRoot 'TestResults' | ||
| $reportsRoot = Join-Path $repoRoot 'CoverageReports' | ||
| $toolsPath = Join-Path $repoRoot '.tools' | ||
| $reportGeneratorExe = Join-Path $toolsPath 'reportgenerator.exe' | ||
|
|
||
| $unitProject = Join-Path $repoRoot 'tests/Biak.ConsoleApp.UnitTests/Biak.ConsoleApp.UnitTests.csproj' | ||
| $integrationProject = Join-Path $repoRoot 'tests/Biak.ConsoleApp.IntegrationTests/Biak.ConsoleApp.IntegrationTests.csproj' | ||
|
|
||
| function Get-CoverageFilePath { | ||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$Directory | ||
| ) | ||
|
|
||
| $coverageFile = Get-ChildItem -Path $Directory -Recurse -Filter 'coverage.cobertura.xml' | | ||
| Sort-Object LastWriteTime -Descending | | ||
| Select-Object -First 1 | ||
|
|
||
| if (-not $coverageFile) { | ||
| throw "Coverage file not found under '$Directory'." | ||
| } | ||
|
|
||
| return $coverageFile.FullName | ||
| } | ||
|
|
||
| Push-Location $repoRoot | ||
| try { | ||
| Write-Host 'Cleaning previous coverage artifacts...' | ||
| Remove-Item -Path $testResultsRoot -Recurse -Force -ErrorAction SilentlyContinue | ||
| Remove-Item -Path $reportsRoot -Recurse -Force -ErrorAction SilentlyContinue | ||
|
|
||
| Write-Host 'Ensuring ReportGenerator tool is available...' | ||
| New-Item -ItemType Directory -Path $toolsPath -Force | Out-Null | ||
| if (Test-Path $reportGeneratorExe) { | ||
| dotnet tool update dotnet-reportgenerator-globaltool --tool-path $toolsPath | Out-Null | ||
| } | ||
| else { | ||
| dotnet tool install dotnet-reportgenerator-globaltool --tool-path $toolsPath | Out-Null | ||
| } | ||
|
|
||
| if ($NoBuild) { | ||
| Write-Host 'Running unit tests with coverage (no build)...' | ||
| dotnet test $unitProject --no-build --collect:"XPlat Code Coverage;Format=cobertura" --results-directory "$testResultsRoot/Unit" | ||
|
|
||
| Write-Host 'Running integration tests with coverage (no build)...' | ||
| dotnet test $integrationProject --no-build --collect:"XPlat Code Coverage;Format=cobertura" --results-directory "$testResultsRoot/Integration" | ||
| } | ||
| else { | ||
| Write-Host 'Running unit tests with coverage...' | ||
| dotnet test $unitProject --collect:"XPlat Code Coverage;Format=cobertura" --results-directory "$testResultsRoot/Unit" | ||
|
|
||
| Write-Host 'Running integration tests with coverage...' | ||
| dotnet test $integrationProject --collect:"XPlat Code Coverage;Format=cobertura" --results-directory "$testResultsRoot/Integration" | ||
| } | ||
|
|
||
| $unitCoverageFile = Get-CoverageFilePath -Directory (Join-Path $testResultsRoot 'Unit') | ||
| $integrationCoverageFile = Get-CoverageFilePath -Directory (Join-Path $testResultsRoot 'Integration') | ||
|
|
||
| $unitReportDir = Join-Path $reportsRoot 'unit' | ||
| $integrationReportDir = Join-Path $reportsRoot 'integration' | ||
|
|
||
| Write-Host 'Generating unit HTML coverage report...' | ||
| & $reportGeneratorExe "-reports:$unitCoverageFile" "-targetdir:$unitReportDir" '-reporttypes:Html' | ||
|
|
||
| Write-Host 'Generating integration HTML coverage report...' | ||
| & $reportGeneratorExe "-reports:$integrationCoverageFile" "-targetdir:$integrationReportDir" '-reporttypes:Html' | ||
|
|
||
| Write-Host '' | ||
| Write-Host 'Done.' | ||
| Write-Host "Unit report: $unitReportDir/index.html" | ||
| Write-Host "Integration report: $integrationReportDir/index.html" | ||
| } | ||
| finally { | ||
| Pop-Location | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.