9
9
- rel/*
10
10
11
11
pool :
12
- vmImage : windows-2022
12
+ vmImage : windows-latest
13
+
14
+ variables :
15
+ Build.Configuration : Release
13
16
14
17
jobs :
15
18
- job : BuildBits
19
+ displayName : Build and Test solution
16
20
timeoutInMinutes : 60
17
21
steps :
18
22
19
- # Install the .NET Core 3.1 SDK
20
- - task : UseDotNet@2
21
- displayName : Install the .NET Core 3.1 SDK
22
- inputs :
23
- version : 3.1.x
24
-
25
- # Install the .NET 6 SDK
26
- - task : UseDotNet@2
27
- displayName : Install the .NET 6 SDK
28
- inputs :
29
- version : 6.0.x
30
-
31
23
# Install the .NET 7 SDK
32
24
- task : UseDotNet@2
33
25
displayName : Install the .NET 7 SDK
34
26
inputs :
35
27
version : 7.0.x
36
28
includePreviewVersions : true
37
-
38
- # Install NuGet
39
- - task : NuGetToolInstaller@0
40
- displayName : Install NuGet 6.0
41
- inputs :
42
- versionSpec : 6.0.0
43
-
44
- # Install NerdBank GitVersioning
45
- - task : DotNetCoreCLI@2
46
- displayName : Install NBGV tool
47
- inputs :
48
- command : custom
49
- custom : tool
50
- arguments : update -g nbgv
29
+ performMultiLevelLookup : true
51
30
52
31
# Set Build Version
53
32
- script : nbgv cloud
@@ -57,42 +36,48 @@ jobs:
57
36
- pwsh : build/Update-Headers.ps1 -Verify
58
37
displayName : Verify headers
59
38
39
+ # Restore solution
40
+ - script : dotnet restore -p:Configuration=$(Build.Configuration)
41
+ displayName : Restore solution
42
+
60
43
# Build solution
61
- - script : dotnet build -c Release
44
+ - script : dotnet build --no-restore -c $(Build.Configuration)
62
45
displayName : Build solution
63
46
64
- # Run .NET 6 tests
65
- - script : dotnet test -c Release -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
47
+ # Test solution #
48
+
49
+ # Run .NET 6 unit tests
50
+ - script : dotnet test --no-build -c $(Build.Configuration) -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
66
51
displayName : Run .NET 6 unit tests
67
52
68
- # Run .NET Core 3.1 tests
69
- - script : dotnet test -c Release -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
53
+ # Run .NET Core 3.1 unit tests
54
+ - script : dotnet test --no-build -c $(Build.Configuration) -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
70
55
displayName : Run .NET Core 3.1 unit tests
71
56
72
- # Run .NET Framework 4.7.2 tests
73
- - script : dotnet test -c Release -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
57
+ # Run .NET Framework 4.7.2 unit tests
58
+ - script : dotnet test --no-build -c $(Build.Configuration) -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
74
59
displayName : Run .NET Framework 4.7.2 unit tests
75
60
76
61
# Publish test results
77
62
- task : PublishTestResults@2
78
63
displayName : Publish test results
79
64
inputs :
80
- testResultsFormat : ' VSTest'
81
- testResultsFiles : ' **/VSTestResults*.trx'
65
+ testResultsFormat : VSTest
66
+ testResultsFiles : ' **/TestResults/ VSTestResults*.trx'
82
67
condition : always()
83
68
84
- # Create the NuGet package(s)
85
- - script : dotnet pack -c Release
86
- displayName : Create NuGet package(s)
69
+ # Pack solution
70
+ - script : dotnet pack --no-build -c $(Build.Configuration)
71
+ displayName : Pack solution
87
72
88
- # Sign package(s)
73
+ # Sign packages
89
74
- pwsh : build/Sign-Package.ps1
90
75
displayName : Authenticode sign packages
91
76
env :
92
77
SignClientUser : $(SignClientUser)
93
78
SignClientSecret : $(SignClientSecret)
94
79
ArtifactDirectory : bin/nupkg
95
- condition : and(succeeded(), not(eq( variables['Build.Reason'], 'PullRequest')), not(eq( variables['SignClientSecret '], '')), not(eq( variables['SignClientUser '], '') ))
80
+ condition : and(succeeded(), ne( variables['Build.Reason'], 'PullRequest'), ne( variables['SignClientUser '], ''), ne( variables['SignClientSecret '], ''))
96
81
97
82
# Publish build artifacts
98
83
- publish : bin/nupkg
0 commit comments