Skip to content

Commit

Permalink
Update Azure Pipelines script
Browse files Browse the repository at this point in the history
- Add an MSBuild response file with basic build options.
- Don't restore or build in subsequent dotnet invocations.
- Use 'windows-latest' as it has been updated to 'windows-2022'.
- Remove Install NuGet and NBGV install tasks as it is now built-in.
- Point the 'VSTestResultsDirectory' to the new output directory 'BuildDir'.
  • Loading branch information
Nirmal4G committed Jun 7, 2022
1 parent 6d2286c commit f612708
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Working folders
~build/
~publish/
~packages/

# Build results
[Bb]in/
Expand Down
4 changes: 4 additions & 0 deletions Directory.Build.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-NoLogo
-MaxCPUCount
-NodeReuse:False
-Verbosity:Normal
52 changes: 24 additions & 28 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,17 @@ pr:
- rel/*

pool:
vmImage: windows-2022
vmImage: windows-latest

variables:
BuildConfiguration: Release

jobs:
- job: BuildBits
displayName: Build and Test solution
timeoutInMinutes: 60
steps:

# Install NuGet
- task: NuGetToolInstaller@0
displayName: Install NuGet 6.0
inputs:
versionSpec: 6.0.0

# Install NerdBank GitVersioning
- task: DotNetCoreCLI@2
displayName: Install NBGV tool
inputs:
command: custom
custom: tool
arguments: update -g nbgv

# Set Build Version
- script: nbgv cloud
displayName: Set NBGV version
Expand All @@ -38,35 +28,41 @@ jobs:
- pwsh: build/Update-Headers.ps1 -Verify
displayName: Verify headers

# Restore solution
- script: dotnet restore -p:Configuration=$(BuildConfiguration)
displayName: Restore solution

# Build solution
- script: dotnet build -c Release
- script: dotnet build --no-restore -c $(BuildConfiguration)
displayName: Build solution

# Run .NET 6 tests
- script: dotnet test -c Release -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
# Test solution #

# Run .NET 6 unit tests
- script: dotnet test --no-build -c $(BuildConfiguration) -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
displayName: Run .NET 6 unit tests

# Run .NET Core 3.1 tests
- script: dotnet test -c Release -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
# Run .NET Core 3.1 unit tests
- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
displayName: Run .NET Core 3.1 unit tests

# Run .NET Framework 4.7.2 tests
- script: dotnet test -c Release -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
# Run .NET Framework 4.7.2 unit tests
- script: dotnet test --no-build -c $(BuildConfiguration) -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
displayName: Run .NET Framework 4.7.2 unit tests

# Publish test results
- task: PublishTestResults@2
displayName: Publish test results
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/VSTestResults*.trx'
testResultsFormat: VSTest
testResultsFiles: ~build/*/TestResults/VSTestResults*.trx
condition: always()

# Create the NuGet package(s)
- script: dotnet pack -c Release
displayName: Create NuGet package(s)
# Pack solution
- script: dotnet pack --no-build -c $(BuildConfiguration)
displayName: Pack solution

# Sign package(s)
# Sign packages
- pwsh: build/Sign-Package.ps1
displayName: Authenticode sign packages
env:
Expand Down
8 changes: 6 additions & 2 deletions build/Community.Toolkit.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
</PropertyGroup>

<PropertyGroup Label="Build">
<NoWarn>NU1507</NoWarn>
<IsPackable>true</IsPackable>
<IsPublishable>true</IsPublishable>
<ContinuousIntegrationBuild>$(TF_BUILD)</ContinuousIntegrationBuild>
<ProjectName>$(MSBuildProjectName.Replace('CommunityToolkit.', ''))</ProjectName>
</PropertyGroup>

<ItemDefinitionGroup>
Expand All @@ -33,8 +35,8 @@

<PropertyGroup Label="Outputs">
<!-- Common Outputs -->
<BuildDir>~build\</BuildDir>
<PublishDir>~publish\</PublishDir>
<BuildDir>$(RepositoryDirectory)~build\$(ProjectName)\</BuildDir>
<PublishDir>$(RepositoryDirectory)~publish\$(ProjectName)\</PublishDir>
<!-- Build Outputs -->
<BaseOutputPath>$(BuildDir)bin\</BaseOutputPath>
<BaseIntermediateOutputPath>$(BuildDir)obj\</BaseIntermediateOutputPath>
Expand All @@ -44,6 +46,8 @@
<!-- Pack Outputs -->
<PackageOutputPath>$(RepositoryDirectory)~packages\bin\</PackageOutputPath>
<NuSpecOutputPath>$(RepositoryDirectory)~packages\obj\</NuSpecOutputPath>
<!-- Test Outputs -->
<VSTestResultsDirectory>$(BuildDir)TestResults\</VSTestResultsDirectory>
</PropertyGroup>

</Project>

0 comments on commit f612708

Please sign in to comment.