Skip to content

Commit

Permalink
Merge a9854a4 into 860fc55
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesDawson authored Sep 28, 2022
2 parents 860fc55 + a9854a4 commit 01dddd1
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 45 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,5 @@ coverage.cobertura.xml

# Scripted build artifacts
/_codeCoverage
/_packages
/_packages
*.sbom.*
20 changes: 0 additions & 20 deletions Solutions/Corvus.UriTemplate.Benchmarking/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@
"Microsoft.SourceLink.GitHub": "1.1.1"
}
},
"Roslynator.Analyzers": {
"type": "Direct",
"requested": "[4.1.1, )",
"resolved": "4.1.1",
"contentHash": "3cPVlrB1PytlO1ztZZBOExDKQWpMZgI15ZDa0BqLu0l6xv+xIRfEpqjNRcpvUy3aLxWTkPgSKZbbaO+VoFEJ1g=="
},
"StyleCop.Analyzers": {
"type": "Direct",
"requested": "[1.2.0-beta.435, )",
"resolved": "1.2.0-beta.435",
"contentHash": "TADk7vdGXtfTnYCV7GyleaaRTQjfoSfZXprQrVMm7cSJtJbFc1QIbWPyLvrgrfGdfHbGmUPvaN4ODKNxg2jgPQ==",
"dependencies": {
"StyleCop.Analyzers.Unstable": "1.2.0.435"
}
},
"Tavis.UriTemplates": {
"type": "Direct",
"requested": "[1.1.1, )",
Expand Down Expand Up @@ -383,11 +368,6 @@
"Microsoft.NETCore.Targets": "1.0.1"
}
},
"StyleCop.Analyzers.Unstable": {
"type": "Transitive",
"resolved": "1.2.0.435",
"contentHash": "ouwPWZxbOV3SmCZxIRqHvljkSzkCyi1tDoMzQtDb/bRP8ctASV/iRJr+A2Gdj0QLaLmWnqTWDrH82/iP+X80Lg=="
},
"System.AppContext": {
"type": "Transitive",
"resolved": "4.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="azurepipelines.testlogger" Version="1.2.2" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resources:
type: github
name: endjin/Endjin.RecommendedPractices.AzureDevopsPipelines.GitHub
endpoint: corvus-dotnet-github
ref: refs/heads/feature/scripted-build-support-custom-tasks

jobs:
- template: templates/build.and.release.scripted.yml@recommended_practices
Expand All @@ -21,5 +22,6 @@ jobs:
service_connection_nuget_org: $(Endjin_Service_Connection_NuGet_Org)
service_connection_github: $(Endjin_Service_Connection_GitHub)
solution_to_build: $(Endjin_Solution_To_Build)
netSdkVersion: '7.x'
additionalNetSdkVersions:
- '7.x'
includeNetSdkPreviewVersions: 'true'
93 changes: 70 additions & 23 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@
The path to import the Endjin.RecommendedPractices.Build module from. This is useful when
testing pre-release versions of the Endjin.RecommendedPractices.Build that are not yet
available in the PowerShell Gallery.
.PARAMETER BuildModuleVersion
The version of the Endjin.RecommendedPractices.Build module to import. This is useful when
testing pre-release versions of the Endjin.RecommendedPractices.Build that are not yet
available in the PowerShell Gallery.
.PARAMETER InvokeBuildModuleVersion
The version of the InvokeBuild module to be used.
#>
[CmdletBinding()]
param (
[Parameter(Position=0)]
[string[]] $Tasks = @("."),

[Parameter()]
[string] $Configuration = "Release",
[string] $Configuration = "Debug",

[Parameter()]
[string] $BuildRepositoryUri = "",
Expand All @@ -62,17 +68,23 @@ param (
[switch] $Clean,

[Parameter()]
[string] $BuildModulePath
[string] $BuildModulePath,

[Parameter()]
[version] $BuildModuleVersion = "0.2.10",

[Parameter()]
[version] $InvokeBuildModuleVersion = "5.7.1"
)

$ErrorActionPreference = $ErrorActionPreference ? $ErrorActionPreference : 'Stop'
$InformationPreference = $InformationAction ? $InformationAction : 'Continue'
$InformationPreference = 'Continue'

$here = Split-Path -Parent $PSCommandPath

#region InvokeBuild setup
if (!(Get-Module -ListAvailable InvokeBuild)) {
Install-Module InvokeBuild -RequiredVersion 5.7.1 -Scope CurrentUser -Force -Repository PSGallery
Install-Module InvokeBuild -RequiredVersion $InvokeBuildModuleVersion -Scope CurrentUser -Force -Repository PSGallery
}
Import-Module InvokeBuild
# This handles calling the build engine when this file is run like a normal PowerShell script
Expand All @@ -89,68 +101,103 @@ if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
}
#endregion

# Import shared tasks and initialise build framework
#region Import shared tasks and initialise build framework
if (!($BuildModulePath)) {
if (!(Get-Module -ListAvailable Endjin.RecommendedPractices.Build)) {
if (!(Get-Module -ListAvailable Endjin.RecommendedPractices.Build | ? { $_.Version -eq $BuildModuleVersion })) {
Write-Information "Installing 'Endjin.RecommendedPractices.Build' module..."
Install-Module Endjin.RecommendedPractices.Build -RequiredVersion 0.1.1 -AllowPrerelease -Scope CurrentUser -Force -Repository PSGallery
Install-Module Endjin.RecommendedPractices.Build -RequiredVersion $BuildModuleVersion -Scope CurrentUser -Force -Repository PSGallery
}
$BuildModulePath = "Endjin.RecommendedPractices.Build"
}
else {
Write-Information "BuildModulePath: $BuildModulePath"
}
Import-Module $BuildModulePath -Force
Import-Module $BuildModulePath -RequiredVersion $BuildModuleVersion -Force

# Load the build process & tasks
. Endjin.RecommendedPractices.Build.tasks
#endregion


#
# Build process control options
#
$SkipInit = $false
$SkipVersion = $false
$SkipBuild = $false
$CleanBuild = $false
$CleanBuild = $Clean
$SkipTest = $false
$SkipTestReport = $false
$SkipTestReport = $true
$SkipPackage = $false
$SkipAnalysis = $false

# Advanced build settings
$EnableGitVersionAdoVariableWorkaround = $false

#
# Build process configuration
#
$SolutionToBuild = (Resolve-Path (Join-Path $here ".\Solutions\Corvus.JsonSchema.sln")).Path

$SolutionToBuild = (Resolve-Path (Join-Path $here ".\Solutions\Corvus.UriTemplates.sln")).Path
$ProjectsToPublish = @(
# "Solutions/MySolution/MyWebSite/MyWebSite.csproj"
)
$NuSpecFilesToPackage = @(
# "Solutions/MySolution/MyProject/MyProject.nuspec"
)

#
# Update to the latest report generator versions
#
$ReportGeneratorToolVersion = "5.1.10"

#
# Temporarily skip the test report
#
$SkipTestReport = $true

#
# Specify files to exclude from test coverage
# Specify files to exclude from code coverage
# This option is for excluding generated code
# - Use file path or directory path with globbing (e.g dir1/*.cs)
# - Use single or multiple paths (separated by comma) (e.g. **/dir1/class1.cs,**/dir2/*.cs,**/dir3/**/*.cs)
#
$ExcludeFilesFromCodeCoverage = ""

#
# Temporarily skip the test report
#
$SkipTestReport = $true

# Synopsis: Build, Test and Package
task . FullBuild


# build extensibility tasks
task RunFirst {}
task PreInit {
Write-Host "Initialising submodule"
exec { & git submodule init }
exec { & git submodule update }
}
task PostInit {}
task PreVersion {}
task PostVersion {}
task PreBuild {}
task PostBuild {}
task PreTest {}
task PostTest {}
task PreTest {
# .net 7 bug workaround - ref: https://github.com/microsoft/vstest/issues/4014
Write-Host "Set temporary ENV vars for MSBuild"
$env:CollectCoverage = $EnableCoverage
$env:CoverletOutputFormat = "cobertura"
}
task PostTest {
Get-ChildItem env:/CollectCoverage
Get-ChildItem env:/CoverletOutputFormat

# cleanup .net 7 bug workaround
Write-Host "Clean-up temporary ENV vars for MSBuild"
Remove-Item env:/CollectCoverage
Remove-Item env:/CoverletOutputFormat
}
task PreTestReport {}
task PostTestReport {}
task PreAnalysis {}
task PostAnalysis {}
task PrePackage {}
task PostPackage {}
task PrePublish {}
task PostPublish {}
task RunLast {}

0 comments on commit 01dddd1

Please sign in to comment.