-
Notifications
You must be signed in to change notification settings - Fork 20
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
Scripted build migration #157
Open
CharlotteGayton
wants to merge
3
commits into
master
Choose a base branch
from
feature/scripted-build-migration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ resources: | |
endpoint: ais-dotnet-github | ||
|
||
jobs: | ||
- template: templates/build.and.release.yml@recommended_practices | ||
- template: templates/build.and.release.scripted.yml@recommended_practices | ||
parameters: | ||
vmImage: 'ubuntu-latest' | ||
service_connection_nuget_org: $(Endjin_Service_Connection_NuGet_Org) | ||
|
@@ -40,6 +40,7 @@ jobs: | |
inputs: | ||
artifactName: 'benchmark' | ||
PathtoPublish: '$(Build.SourcesDirectory)/Solutions/Ais.Net.Benchmarks/BenchmarkDotNet.Artifacts/results' | ||
|
||
|
||
- bash: | | ||
wget -q https://github.com/dotnet/docfx/releases/download/v2.45.1/docfx.zip | ||
|
@@ -64,4 +65,5 @@ jobs: | |
git commit --allow-empty -m "Documentation for $(GitVersion.PreReleaseTag)" | ||
git push origin gh-pages | ||
displayName: 'Publish documentation to GitHub Pages' | ||
condition: and(succeeded(), or(variables['Endjin.ForceDocPublish'], eq(variables['GitVersion.PreReleaseTag'], ''))) | ||
condition: and(succeeded(), or(variables['Endjin.ForceDocPublish'], eq(variables['GitVersion.PreReleaseTag'], ''))) | ||
compileTasksServiceConnection: endjin-acr-reader | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think moving line 69 earlier in the file, before the customisations, would make it easier to read |
This file contains 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,178 @@ | ||
<# | ||
.SYNOPSIS | ||
Runs a .NET flavoured build process. | ||
.DESCRIPTION | ||
This script was scaffolded using a template from the Endjin.RecommendedPractices.Build PowerShell module. | ||
It uses the InvokeBuild module to orchestrate an opinonated software build process for .NET solutions. | ||
.EXAMPLE | ||
PS C:\> ./build.ps1 | ||
Downloads any missing module dependencies (Endjin.RecommendedPractices.Build & InvokeBuild) and executes | ||
the build process. | ||
.PARAMETER Tasks | ||
Optionally override the default task executed as the entry-point of the build. | ||
.PARAMETER Configuration | ||
The build configuration, defaults to 'Release'. | ||
.PARAMETER BuildRepositoryUri | ||
Optional URI that supports pulling MSBuild logic from a web endpoint (e.g. a GitHub blob). | ||
.PARAMETER SourcesDir | ||
The path where the source code to be built is located, defaults to the current working directory. | ||
.PARAMETER CoverageDir | ||
The output path for the test coverage data, if run. | ||
.PARAMETER TestReportTypes | ||
The test report format that should be generated by the test report generator, if run. | ||
.PARAMETER PackagesDir | ||
The output path for any packages produced as part of the build. | ||
.PARAMETER LogLevel | ||
The logging verbosity. | ||
.PARAMETER Clean | ||
When true, the .NET solution will be cleaned and all output/intermediate folders deleted. | ||
.PARAMETER BuildModulePath | ||
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 = "Debug", | ||
|
||
[Parameter()] | ||
[string] $BuildRepositoryUri = "", | ||
|
||
[Parameter()] | ||
[string] $SourcesDir = $PWD, | ||
|
||
[Parameter()] | ||
[string] $CoverageDir = "_codeCoverage", | ||
|
||
[Parameter()] | ||
[string] $TestReportTypes = "Cobertura", | ||
|
||
[Parameter()] | ||
[string] $PackagesDir = "_packages", | ||
|
||
[Parameter()] | ||
[ValidateSet("minimal","normal","detailed")] | ||
[string] $LogLevel = "minimal", | ||
|
||
[Parameter()] | ||
[switch] $Clean, | ||
|
||
[Parameter()] | ||
[string] $BuildModulePath, | ||
|
||
[Parameter()] | ||
[version] $BuildModuleVersion = "0.2.17", | ||
|
||
[Parameter()] | ||
[version] $InvokeBuildModuleVersion = "5.7.1" | ||
) | ||
|
||
$ErrorActionPreference = $ErrorActionPreference ? $ErrorActionPreference : 'Stop' | ||
$InformationPreference = 'Continue' | ||
|
||
$here = Split-Path -Parent $PSCommandPath | ||
|
||
#region InvokeBuild setup | ||
if (!(Get-Module -ListAvailable InvokeBuild)) { | ||
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 | ||
# (i.e. avoids the need to have another script to setup the InvokeBuild environment and issue the 'Invoke-Build' command ) | ||
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') { | ||
try { | ||
Invoke-Build $Tasks $MyInvocation.MyCommand.Path @PSBoundParameters | ||
} | ||
catch { | ||
$_.ScriptStackTrace | ||
throw | ||
} | ||
return | ||
} | ||
#endregion | ||
|
||
#region Import shared tasks and initialise build framework | ||
if (!($BuildModulePath)) { | ||
if (!(Get-Module -ListAvailable Endjin.RecommendedPractices.Build | ? { $_.Version -eq $BuildModuleVersion })) { | ||
Write-Information "Installing 'Endjin.RecommendedPractices.Build' module..." | ||
Install-Module Endjin.RecommendedPractices.Build -RequiredVersion $BuildModuleVersion -Scope CurrentUser -Force -Repository PSGallery | ||
} | ||
$BuildModulePath = "Endjin.RecommendedPractices.Build" | ||
} | ||
else { | ||
Write-Information "BuildModulePath: $BuildModulePath" | ||
} | ||
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 = $Clean | ||
$SkipTest = $false | ||
$SkipTestReport = $false | ||
$SkipAnalysis = $false | ||
$SkipPackage = $false | ||
$SkipPublish = $false | ||
|
||
|
||
# | ||
# Build process configuration | ||
# | ||
$SolutionToBuild = (Resolve-Path (Join-Path $here "Solutions\Ais.Net.sln")).Path | ||
$ProjectsToPublish = @( | ||
# "Solutions/MySolution/MyWebSite/MyWebSite.csproj" | ||
) | ||
$NuSpecFilesToPackage = @( | ||
# "Solutions/MySolution/MyProject/MyProject.nuspec" | ||
) | ||
|
||
# | ||
# 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 = "" | ||
|
||
# Synopsis: Build, Test and Package | ||
task . FullBuild | ||
|
||
|
||
# build extensibility tasks | ||
task RunFirst {} | ||
task PreInit {} | ||
task PostInit {} | ||
task PreVersion {} | ||
task PostVersion {} | ||
task PreBuild {} | ||
task PostBuild {} | ||
task PreTest {} | ||
task PostTest {} | ||
task PreTestReport {} | ||
task PostTestReport {} | ||
task PreAnalysis {} | ||
task PostAnalysis {} | ||
task PrePackage {} | ||
task PostPackage {} | ||
task PrePublish {} | ||
task PostPublish {} | ||
task RunLast {} | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to look at the customisations in this YAML file:
postSpecs
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was one of the earliest projects to use .NET 6. (We did it to find out whether it gave a perf boost, which it did.)
I would expect we no longer need special handling for that.
We want to keep the benchmark run and the docfx build.