Skip to content

Commit

Permalink
Merge pull request #535 from AArnott/libtemplate
Browse files Browse the repository at this point in the history
Apply latest Library.Template
  • Loading branch information
AArnott authored Sep 21, 2022
2 parents e7bd58b + 06ee847 commit 6e778a7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You should install the version specified in `global.json` or a later version wit
the same major.minor.Bxx "hundreds" band.
For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.310
while the 2.2.400 version would not be considered compatible by .NET SDK.
See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information.
See [.NET Core Versioning](https://docs.microsoft.com/dotnet/core/versions/) for more information.

All dependencies can be installed by running the `init.ps1` script at the root of the repository
using Windows PowerShell or [PowerShell Core][pwsh] (on any OS).
Expand All @@ -37,4 +37,4 @@ to the feeds that packages for this repo come from, if any.

Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.).

[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6
[pwsh]: https://docs.microsoft.com/powershell/scripting/install/installing-powershell?view=powershell-6
15 changes: 10 additions & 5 deletions azure-pipelines/Merge-CodeCoverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Param(
[string[]]$Path,
[ValidateSet('Badges', 'Clover', 'Cobertura', 'CsvSummary', 'Html', 'Html_Dark', 'Html_Light', 'HtmlChart', 'HtmlInline', 'HtmlInline_AzurePipelines', 'HtmlInline_AzurePipelines_Dark', 'HtmlInline_AzurePipelines_Light', 'HtmlSummary', 'JsonSummary', 'Latex', 'LatexSummary', 'lcov', 'MarkdownSummary', 'MHtml', 'PngChart', 'SonarQube', 'TeamCitySummary', 'TextSummary', 'Xml', 'XmlSummary')]
[string]$Format='Cobertura',
[string]$OutputDir=("$PSScriptRoot/../coveragereport")
[string]$OutputFile=("$PSScriptRoot/../coveragereport/merged.cobertura.xml")
)

$RepoRoot = [string](Resolve-Path $PSScriptRoot/..)

if (!(Test-Path $RepoRoot/obj/reportgenerator*)) {
dotnet tool install --tool-path $RepoRoot/obj dotnet-reportgenerator-globaltool --version 5.1.9 --configfile $PSScriptRoot/justnugetorg.nuget.config
if (!(Test-Path $RepoRoot/obj/dotnet-coverage*)) {
dotnet tool install --tool-path $RepoRoot/obj dotnet-coverage --version 17.4.3 --configfile $PSScriptRoot/justnugetorg.nuget.config
}

Write-Verbose "Searching $Path for *.cobertura.xml files"
Expand All @@ -39,8 +39,13 @@ if ($reports) {
$xml.Save($_)
}

$Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_.FullName }))
& "$RepoRoot/obj/reportgenerator" -reports:"$Inputs" -targetdir:$OutputDir -reporttypes:$Format
$Inputs = $reports |% { Resolve-Path -relative $_.FullName }

if (Split-Path $OutputFile) {
New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
}

& "$RepoRoot/obj/dotnet-coverage" merge $Inputs -o $OutputFile -f cobertura
} else {
Write-Error "No reports found to merge."
}
6 changes: 5 additions & 1 deletion azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
pool: ${{ parameters.windowsPool }}
steps:
- checkout: self
fetchDepth: 0 # avoid shallow clone so nbgv can do its work.
clean: true
submodules: true
- template: install-dependencies.yml
Expand All @@ -33,6 +34,7 @@ jobs:
vmImage: Ubuntu 20.04
steps:
- checkout: self
fetchDepth: 0 # avoid shallow clone so nbgv can do its work.
clean: true
submodules: true
- template: install-dependencies.yml
Expand All @@ -47,9 +49,10 @@ jobs:
- job: macOS
condition: ${{ parameters.includeMacOS }}
pool:
vmImage: macOS-10.15
vmImage: macOS-12
steps:
- checkout: self
fetchDepth: 0 # avoid shallow clone so nbgv can do its work.
clean: true
submodules: true
- template: install-dependencies.yml
Expand All @@ -70,6 +73,7 @@ jobs:
condition: succeededOrFailed()
steps:
- checkout: self
fetchDepth: 0 # avoid shallow clone so nbgv can do its work.
clean: true
- template: install-dependencies.yml
parameters:
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/install-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parameters:

steps:

- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1
displayName: 🔏 Authenticate NuGet feeds
inputs:
forceReinstallCredentialProvider: true
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines/publish-codecoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ steps:
displayName: 🔻 Download macOS code coverage results
continueOnError: true
condition: and(succeeded(), ${{ parameters.includeMacOS }})
- powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputDir coveragereport -Format Cobertura -Verbose
- powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputFile coveragereport/merged.cobertura.xml -Format Cobertura -Verbose
displayName: ⚙ Merge coverage
- task: PublishCodeCoverageResults@1
displayName: 📢 Publish code coverage results to Azure DevOps
inputs:
codeCoverageTool: cobertura
summaryFileLocation: coveragereport/Cobertura.xml
summaryFileLocation: coveragereport/merged.cobertura.xml
failIfCoverageEmpty: true

0 comments on commit 6e778a7

Please sign in to comment.