From 1c22aa02ce1ddb7c81fe8083e98d53459199528b Mon Sep 17 00:00:00 2001 From: Howard van Rooijen Date: Wed, 9 Oct 2024 07:52:06 +0100 Subject: [PATCH] Update build script --- .devops/config.ps1 | 42 +++++++++ .github/workflows/build.yml | 9 +- .gitignore | 98 ++++++++++++++------ GitVersion.yml | 8 +- LICENSE | 2 +- Solutions/Ais.Net.Receiver.sln.DotSettings | 2 + build.ps1 | 102 ++++++++------------- 7 files changed, 164 insertions(+), 99 deletions(-) create mode 100644 .devops/config.ps1 create mode 100644 Solutions/Ais.Net.Receiver.sln.DotSettings diff --git a/.devops/config.ps1 b/.devops/config.ps1 new file mode 100644 index 0000000..83da4e6 --- /dev/null +++ b/.devops/config.ps1 @@ -0,0 +1,42 @@ +$devopsExtensions = @( + @{ + Name = "Endjin.RecommendedPractices.Build" + Version = "[1.5.10,2.0)" + Process = "tasks/build.process.ps1" + } +) + +# Load the tasks and process +. endjin-devops.tasks + +# +# Build process configuration +# +$SolutionToBuild = (Resolve-Path (Join-Path $here "./Solutions/Ais.Net.Receiver.sln")).Path +$SkipBuildModuleVersionCheck = $true # currently doesn't work properly with endjin-devops + +# Set default build task +task . FullBuild + +# +# Build Process Extensibility Points - uncomment and implement as required +# + +# 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 {} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c965a6e..1354ad0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,12 +40,10 @@ jobs: id: prepareEnvVarsAndSecrets with: environmentVariablesYaml: | - BUILDVAR_ContainerRegistryFqdn: "endjin.azurecr.io" - BUILDVAR_ContainerImageVersionOverride: "" + BUILDVAR_NuGetPublishSource: "${{ startsWith(github.ref, 'refs/tags/') && 'https://api.nuget.org/v3/index.json' || 'https://nuget.pkg.github.com/ais-dotnet/index.json' }}" BUILDVAR_Configuration: "Release" secretsYaml: | - { - } + NUGET_API_KEY: "${{ startsWith(github.ref, 'refs/tags/') && secrets.NUGET_APIKEY || secrets.BUILD_PUBLISHER_PAT }}" build: needs: prepareConfig @@ -56,4 +54,5 @@ jobs: forcePublish: ${{ github.event.inputs.forcePublish == 'true' }} buildEnv: ${{ needs.prepareConfig.outputs.RESOLVED_ENV_VARS }} secrets: - buildAzureCredentials: ${{ secrets.ENDJIN_PROD_ACR_PUBLISH_CREDENTIALS }} + buildAzureCredentials: ${{ secrets.AZURE_READER_CREDENTIALS }} + buildSecrets: ${{ needs.prepareConfig.outputs.RESOLVED_SECRETS }} diff --git a/.gitignore b/.gitignore index 247943c..0ed4a6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,20 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files +*.rsuser *.suo *.user *.userosscache *.sln.docstates -local.settings.json -settings.local.json # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# Mono auto generated files +mono_crash.* # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -21,10 +22,14 @@ settings.local.json [Rr]eleases/ x64/ x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ +[Ll]ogs/ # Visual Studio 2015/2017 cache/options directory .vs/ @@ -41,6 +46,7 @@ Generated\ Files/ # NUNIT *.VisualState.xml TestResult.xml +nunit-*.xml # Build Results of an ATL Project [Dd]ebugPS/ @@ -54,7 +60,9 @@ BenchmarkDotNet.Artifacts/ project.lock.json project.fragment.lock.json artifacts/ -**/Properties/launchSettings.json + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt # StyleCop StyleCopReport.xml @@ -62,7 +70,7 @@ StyleCopReport.xml # Files built by Visual Studio *_i.c *_p.c -*_i.h +*_h.h *.ilk *.meta *.obj @@ -79,7 +87,9 @@ StyleCopReport.xml *.tlh *.tmp *.tmp_proj +*_wpftmp.csproj *.log +*.tlog *.vspscc *.vssscc .builds @@ -121,8 +131,6 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding add-in -.JustCode # TeamCity is a build add-in _TeamCity* @@ -133,6 +141,10 @@ _TeamCity* # AxoCover is a Code Coverage Tool .axoCover/* !.axoCover/settings.json +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info # Visual Studio code coverage results *.coverage @@ -181,6 +193,8 @@ PublishScripts/ # NuGet Packages *.nupkg +# NuGet Symbol Packages +*.snupkg # The packages folder can be ignored because of Package Restore **/[Pp]ackages/* # except build/, which is used as an MSBuild target. @@ -205,12 +219,14 @@ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt *.appx +*.appxbundle +*.appxupload # Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache -!*.[Cc]ache/ +!?*.[Cc]ache/ # Others ClientBin/ @@ -254,6 +270,9 @@ ServiceFabricBackup/ *.bim.layout *.bim_*.settings *.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl # Microsoft Fakes FakesAssemblies/ @@ -274,6 +293,14 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp +# Visual Studio 6 technical files +*.ncb +*.aps # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -289,12 +316,9 @@ paket-files/ # FAKE - F# Make .fake/ -# JetBrains Rider -.idea/ -*.sln.iml +# CodeRush personal settings -# CodeRush -.cr/ +.cr/personal # Python Tools for Visual Studio (PTVS) __pycache__/ @@ -331,16 +355,38 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ -# Cobertura code coverage file -coverage.cobertura.xml - -# VS Code config files -/.vscode - -_packages -_codeCoverage -/Ais.Net.Receiver.sbom.spdx.json -/Ais.Net.Receiver.sbom.json -/Ais.Net.Receiver.sbom.html -/Ais.Net.Receiver.sbom.cyclonedx.xml -/Solutions/Ais.Net.Receiver.sln.DotSettings +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ +# BeatPulse healthcheck temp database +healthchecksdb +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ +# Fody - auto-generated XML schema +FodyWeavers.xsd +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp +# JetBrains Rider +*.sln.iml +# Build outputs +_codeCoverage/ +_packages/ +*.sbom.* diff --git a/GitVersion.yml b/GitVersion.yml index 5545ff3..99d49a2 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -6,8 +6,8 @@ mode: ContinuousDeployment branches: - master: - regex: ^master + main: + regex: ^main tag: preview increment: patch dependabot-pr: @@ -15,10 +15,10 @@ branches: tag: dependabot source-branches: - develop - - master + - main - release - feature - support - hotfix -next-version: "0.2" +next-version: "0.3" diff --git a/LICENSE b/LICENSE index e570402..0e4dce9 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Endjin Limited + Copyright 2024 Endjin Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Solutions/Ais.Net.Receiver.sln.DotSettings b/Solutions/Ais.Net.Receiver.sln.DotSettings new file mode 100644 index 0000000..7a47a7b --- /dev/null +++ b/Solutions/Ais.Net.Receiver.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index bdf8b9e..be7a95d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -11,14 +11,22 @@ the build process. .PARAMETER Tasks Optionally override the default task executed as the entry-point of the build. -.PARAMETER ContainerRegistryType - The type of container registry to use when publishing any images (supported values: acr,docker,ghcr) -.PARAMETER ContainerRegistryFqdn - The fully-qualified domain name for the target container registry +.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 @@ -36,42 +44,47 @@ param ( [string[]] $Tasks = @("."), [Parameter()] - [ValidateSet("", "docker", "acr", "ghcr")] - [string] $ContainerRegistryType = "acr", + [string] $Configuration = "Debug", [Parameter()] - [string] $ContainerRegistryFqdn = "", + [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()] - [string] $Configuration = "Debug", + [switch] $Clean, [Parameter()] [string] $BuildModulePath, [Parameter()] - [string] $BuildModuleVersion = "1.5.10-beta0003", + [string] $BuildModuleVersion = "1.0.0-preview0020", [Parameter()] - [version] $InvokeBuildModuleVersion = "5.10.3" + [version] $InvokeBuildModuleVersion = "5.11.3" ) - -$ErrorActionPreference = $ErrorActionPreference ? $ErrorActionPreference : 'Stop' -$InformationPreference = 'Continue' - +$ErrorActionPreference = 'Stop' $here = Split-Path -Parent $PSCommandPath #region InvokeBuild setup # 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') { - Install-PSResource InvokeBuild -Version $InvokeBuildModuleVersion -Scope CurrentUser -TrustRepository | Out-Null + Install-PSResource InvokeBuild -Version $InvokeBuildModuleVersion -Scope CurrentUser -TrustRepository -Verbose:$false | Out-Null try { Invoke-Build $Tasks $MyInvocation.MyCommand.Path @PSBoundParameters } @@ -94,57 +107,20 @@ if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') { #endregion #region Import shared tasks and initialise build framework +$splat = @{ Force = $true; Verbose = $false} if (!($BuildModulePath)) { - Install-PSResource Endjin.RecommendedPractices.Build -Version $BuildModuleVersion -Scope CurrentUser -TrustRepository | Out-Null - $BuildModulePath = "Endjin.RecommendedPractices.Build" + Install-PSResource endjin-devops -Version $BuildModuleVersion -Scope CurrentUser -TrustRepository -Reinstall:$($BuildModuleVersion -match '-') | Out-Null + $BuildModulePath = "endjin-devops" + $splat.Add("RequiredVersion", ($BuildModuleVersion -split '-')[0]) } else { - Write-Information "BuildModulePath: $BuildModulePath" + Write-Host "BuildModulePath: $BuildModulePath" } -Import-Module $BuildModulePath -RequiredVersion ($BuildModuleVersion -split '-')[0] -Force -Write-Host "Using Build module version: $((Get-Module Endjin.RecommendedPractices.Build | Select-Object -ExpandProperty Version).ToString())" - -# Load the build process & tasks -. Endjin.RecommendedPractices.Build.tasks +$splat.Add("Name", $BuildModulePath) +Import-Module @splat +$ver = "{0} {1}" -f (Get-Module endjin-devops).Version, (Get-Module endjin-devops).PrivateData.PsData.PreRelease +Write-Host "Using Build module version: $ver" #endregion -# -# Build process control options -# -$SkipInit = $false -$SkipVersion = $false -$SkipBuild = $false -$CleanBuild = $false -$SkipTest = $true -$SkipTestReport = $false -$SkipAnalysis = $false -$SkipPackage = $false -$SkipPublish = $false - -# -# Build process configuration -# -$SolutionToBuild = (Resolve-Path (Join-Path $here "./Solutions/Ais.Net.Receiver.sln")).Path - -# 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 {} \ No newline at end of file +# Load the build configuration +. $here/.devops/config.ps1 \ No newline at end of file