Skip to content

Commit

Permalink
Modernize Build System (#477)
Browse files Browse the repository at this point in the history
* remove dotnet-install from build.ps1

* moved to .NET 8

* fixed build.ps1

* copying TurboMqtt's build system

* fixed structure of RELEASE_NOTES.md

* modernized AzDo scripts

* fixed shell selection

* fix first jobs

* resolved YAML conversion from GA to AzDo

* fix checkout

* fix issue with --no-build for NBench specs

* fixed illegal version number

* tidying up test results reporting

* fixed windows-release.yaml

* fix test results param

* disable markdown output test on Linux

* deleted old build system

* fixed precompilation directives

* added README to NuGet data

* fixed publication of Linux test results
  • Loading branch information
Aaronontheweb authored Jun 11, 2024
1 parent 71504e3 commit bf02b80
Show file tree
Hide file tree
Showing 26 changed files with 342 additions and 934 deletions.
23 changes: 17 additions & 6 deletions src/common.props → Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<Project>
<PropertyGroup>
<Copyright>Copyright © 2015-2020 Petabridge</Copyright>
<Copyright>Copyright © 2015-2024 Petabridge</Copyright>
<Authors>Petabridge</Authors>
<VersionPrefix>2.0.1</VersionPrefix>
<PackageReleaseNotes>NBench 2.0.0 is a major departure from NBench 1.2 and preceding versions, and these changes were done in order to support NBench's future as a cutting-edge, cross-platform performance testing and macro benchmarking framework:

- `dotnet nbench` and `NBench.Runner` are both now deprecated - [NBench is now run from directly inside a console application created by end-users](https://nbench.io/articles/quickstart.html). This makes it easier to configure, debug, and create benchmarks on new .NET Core platforms without having to wait for additional instrumentation or tooling from NBench itself.
- NBench no longer supports .NET Framework explicitly; moving forward NBench will only support .NET Standard 2.0 and later (.NET Framework 4.6.1 and greater or .NET Core 2.0 and greater.)
- We've added a new documentation website for NBench: https://nbench.io/
- NBench now supports configuration as code through the [`TestPackage` class](https://nbench.io/api/NBench.Sdk.TestPackage.html).

For a full set of changes, [please see the NBench 2.0.0 milestone on Github](https://github.com/petabridge/NBench/milestone/3).

---

2.0.1 Notes:
Fixed error with setting thread priority on Linux;
Fixed NuGet symbol publication;
And more.

* Fixed error with setting thread priority on Linux;
* Fixed NuGet symbol publication;
* And more.

For a full set of changes, [please see the NBench 2.0.1 milestone on Github](https://github.com/petabridge/NBench/milestone/8).</PackageReleaseNotes>
<PackageProjectUrl>
https://nbench.io/
Expand All @@ -28,13 +34,13 @@ For a full set of changes, [please see the NBench 2.0.1 milestone on Github](htt
<RepositoryUrl>https://github.com/petabridge/NBench</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<ApprovalTestsVersion>5.4.2</ApprovalTestsVersion>
<ApprovalTestsVersion>5.9.0</ApprovalTestsVersion>
<XunitVersion>2.5.1</XunitVersion>
<TestSdkVersion>16.8.0</TestSdkVersion>
<FluentAssertionsVersion>6.10.0</FluentAssertionsVersion>
</PropertyGroup>
<PropertyGroup>
<NetCoreTestVersion>netcoreapp3.1</NetCoreTestVersion>
<NetCoreTestVersion>net8.0</NetCoreTestVersion>
<NetStandardLibVersion>netstandard2.0</NetStandardLibVersion>
</PropertyGroup>
<PropertyGroup>
Expand All @@ -49,4 +55,9 @@ For a full set of changes, [please see the NBench 2.0.1 milestone on Github](htt
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" Visible="false" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)\LICENSE" Pack="true" Visible="false" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)\docs\images\NBench_logo_square_90.png" Pack="true" Visible="false" PackagePath="\" />
</ItemGroup>
</Project>
4 changes: 0 additions & 4 deletions NBench.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1F1914B9
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{97444074-C626-443F-BE96-374AD2E43604}"
ProjectSection(SolutionItems) = preProject
build.cmd = build.cmd
build.fsx = build.fsx
build.ps1 = build.ps1
build.sh = build.sh
src\common.props = src\common.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NBench.Tests", "src\NBench.Tests\NBench.Tests.csproj", "{AF7D1093-8A36-4604-9601-75A32B50F024}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ NBench is designed for .NET developers who need to care about performance and wa
## Documentation
To learn more, please read [the official NBench documentation](https://nbench.io).

Copyright (c) [Petabridge™, LLC](https://petabridge.com/) 2015-2020
Copyright (c) [Petabridge™, LLC](https://petabridge.com/) 2015-2024
3 changes: 2 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#### v2.0.1 February 25 2020
#### 2.0.1 February 25 2020 ####

NBench 2.0.0 is a major departure from NBench 1.2 and preceding versions, and these changes were done in order to support NBench's future as a cutting-edge, cross-platform performance testing and macro benchmarking framework:

- `dotnet nbench` and `NBench.Runner` are both now deprecated - [NBench is now run from directly inside a console application created by end-users](https://nbench.io/articles/quickstart.html). This makes it easier to configure, debug, and create benchmarks on new .NET Core platforms without having to wait for additional instrumentation or tooling from NBench itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\src\common.props" />

<PropertyGroup>
<TargetFrameworks>$(NetCoreTestVersion)</TargetFrameworks>
</PropertyGroup>
Expand Down
58 changes: 0 additions & 58 deletions build-system/azure-pipeline.template.yaml

This file was deleted.

145 changes: 102 additions & 43 deletions build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,111 @@
# Pull request validation for Windows against the `dev` and `master` branches
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
trigger:
branches:
include:
- dev
- master
- dev
- main

pr:
autoCancel: true # indicates whether additional pushes to a PR should cancel in-progress runs for the same PR. Defaults to true
branches:
include: [ dev, master ] # branch names which will trigger a build

name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
include:
- master
- dev
- main

jobs:
- template: azure-pipeline.template.yaml
parameters:
name: 'windows_tests'
displayName: 'Windows Tests'
vmImage: 'windows-latest'
scriptFileName: build.cmd
scriptArgs: RunTests
outputDirectory: 'TestResults'
artifactName: 'windows_tests-$(Build.BuildId)'
- template: azure-pipeline.template.yaml
parameters:
name: 'windows_integration'
displayName: 'Integration Tests'
vmImage: 'windows-latest'
scriptFileName: build.cmd
scriptArgs: NBench
outputDirectory: 'PerfResults'
artifactName: 'integration_tests_windows-$(Build.BuildId)'
- template: azure-pipeline.template.yaml
parameters:
name: 'linux_integration'
displayName: 'Integration Tests (Linux)'
vmImage: 'ubuntu-latest'
scriptFileName: build.sh
scriptArgs: NBench
outputDirectory: 'PerfResults'
artifactName: 'integration_tests_linux-$(Build.BuildId)'
- template: azure-pipeline.template.yaml
parameters:
name: 'nuget_pack'
displayName: 'NuGet Pack'
vmImage: 'windows-latest'
scriptFileName: build.cmd
scriptArgs: Nuget
outputDirectory: 'bin/nuget'
artifactName: 'nuget-$(Build.BuildId)'
- job: LinuxTest
displayName: 'Test on Linux'
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self

- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
useGlobalJson: true

- powershell: ./build.ps1
displayName: 'Update Release Notes'

- script: dotnet build -c Release
displayName: 'dotnet build'

- script: dotnet pack -c Release
displayName: 'dotnet pack'

- script: dotnet test --configuration Release --verbosity normal --logger trx --collect:"XPlat Code Coverage"
displayName: 'dotnet test (Linux)'

- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx' #TestResults folder usually
testRunTitle: 'Test Results'
mergeTestResults: true

- job: WindowsTest
displayName: 'Test on Windows'
pool:
vmImage: 'windows-latest'
steps:
- checkout: self

- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
useGlobalJson: true

- powershell: ./build.ps1
displayName: 'Update Release Notes'

- script: dotnet build -c Release
displayName: 'dotnet build'

- script: dotnet pack -c Release
displayName: 'dotnet pack'

- script: dotnet test --configuration Release --verbosity normal --logger trx --collect:"XPlat Code Coverage"
displayName: 'dotnet test (Windows)'

- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx' #TestResults folder usually
testRunTitle: 'Test Results'
mergeTestResults: true

- job: LinuxNBench
displayName: 'NBench on Linux'
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self

- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
installationPath: $(Agent.ToolsDirectory)/dotnet
useGlobalJson: true

- powershell: ./scripts/execNBenchProjects.ps1
displayName: 'Run NBench Projects'

- job: WindowsNBench
displayName: 'NBench on Windows'
pool:
vmImage: 'windows-latest'
steps:
- checkout: self
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
installationPath: $(Agent.ToolsDirectory)/dotnet
useGlobalJson: true

- powershell: ./scripts/execNBenchProjects.ps1
displayName: 'Run NBench Projects'
76 changes: 53 additions & 23 deletions build-system/windows-release.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# Release task for PbLib projects
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference

pool:
vmImage: vs2017-win2016
demands: Cmd

trigger:
branches:
include:
- refs/tags/*

pr: none

pool:
vmImage: 'windows-latest'

variables:
- group: signingSecrets #create this group with SECRET variables `signingUsername` and `signingPassword`
- group: nugetKeys #create this group with SECRET variables `nugetKey`
Expand All @@ -22,19 +17,54 @@ variables:
- name: githubRepositoryName
value: petabridge/NBench

steps:
- task: BatchScript@1
displayName: 'FAKE Build'
inputs:
filename: build.cmd
arguments: 'nuget SignClientUser=$(signingUsername) SignClientSecret=$(signingPassword) nugetpublishurl=https://www.nuget.org/api/v2/package nugetkey=$(nugetKey)'
stages:
- stage: BuildAndSign
displayName: 'Build and Sign'
jobs:
- job: Sign
displayName: 'Sign and Push Packages'
steps:
- checkout: self
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
useGlobalJson: true

- powershell: ./build.ps1
displayName: 'Update Release Notes'

- script: 'dotnet pack --configuration $(buildConfiguration) -o ./bin/nuget'
displayName: 'Build Package'

- script: 'dotnet tool install -g SignClient --version 1.2.109'
displayName: 'Install SignClient'

- powershell: |
echo "Starting the signing process..."
./scripts/signPackages.ps1 -ConfigPath "./scripts/signsettings.json" `
-UserName "$(signingUsername)" `
-Password "$(signingPassword)" `
-ProductName "NBench" `
-ProductDescription "NBench - performance testing library for .NET" `
-ProductUrl "https://nbench.io/" `
-DirectoryPath "./bin/nuget"
displayName: 'Sign Artifacts'
# PowerShell script to push all NuGet packages to NuGet.org
- powershell: |
$ErrorActionPreference = "Stop" # Makes the script stop on errors
Get-ChildItem "bin\nuget\*.nupkg" -Recurse | ForEach-Object {
dotnet nuget push $_.FullName --api-key $(nugetKey) --source https://api.nuget.org/v3/index.json
}
displayName: 'Push to NuGet.org'
- task: GitHubRelease@0
displayName: 'GitHub release (create)'
inputs:
gitHubConnection: $(githubConnectionName)
repositoryName: $(githubRepositoryName)
title: '$(projectName) v$(Build.SourceBranchName)'
releaseNotesFile: 'RELEASE_NOTES.md'
assets: |
bin\nuget\*.nupkg
- task: GitHubRelease@0
displayName: 'GitHub release (create)'
inputs:
gitHubConnection: $(githubConnectionName)
repositoryName: $(githubRepositoryName)
title: '$(projectName) v$(Build.SourceBranchName)'
releaseNotesFile: 'RELEASE_NOTES.md'
assets: |
bin\nuget\*.nupkg
1 change: 0 additions & 1 deletion build.cmd

This file was deleted.

Loading

0 comments on commit bf02b80

Please sign in to comment.