-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathNugetPackages-Azure.yml
More file actions
73 lines (63 loc) · 2.31 KB
/
Copy pathNugetPackages-Azure.yml
File metadata and controls
73 lines (63 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Build + test + NuGet packaging pipeline
trigger:
branches:
include:
- main
- v2.*
paths:
include:
- src
variables:
buildConfiguration: 'Release'
pool:
vmImage: windows-latest
steps:
- checkout: self
fetchDepth: 0
# Ensures SDKs compatible with the targeted TFMs (net8.0 / net10.0) and the .slnx format
# (understood starting with SDK 9.0.200). net462 builds via the reference assemblies.
- task: UseDotNet@2
displayName: 'Install .NET 8 SDK'
inputs:
packageType: sdk
version: '8.0.x'
- task: UseDotNet@2
displayName: 'Install .NET 10 SDK'
inputs:
packageType: sdk
version: '10.0.x'
includePreviewVersions: true
- powershell: |
$versionJson = Get-Content "$(Build.SourcesDirectory)/version.json" -Raw | ConvertFrom-Json
if ("$(Build.SourceBranch)" -eq "refs/heads/main" -and $versionJson.version -notmatch "-beta") {
Write-Error "The main branch must produce a beta version. Current version: $($versionJson.version)"
exit 1
}
displayName: 'Validate beta version on main'
- script: dotnet build XrmFramework.slnx --configuration $(buildConfiguration) /p:PublicRelease=true
displayName: Build
workingDirectory: src
# command: 'test' automatically publishes the results (.trx / VSTest) via publishTestResults.
# dotnet test produces .trx, NOT NUnit TEST-*.xml — hence the absence of the
# PublishTestResults@2 task (which was incorrectly looking for **/TEST-*.xml in NUnit format).
#
# --settings scopes the coverage collector to the XrmFramework assemblies. Without it the
# collector instruments every dependency shipping an embedded PDB (Argon, Spectre.Console,
# Microsoft.Testing.Platform, MSTest 4.x), which drowns the ratio in third-party code.
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: 'test'
projects: 'src/XrmFramework.slnx'
arguments: '--configuration $(buildConfiguration) --logger trx --collect "Code coverage" --settings $(Build.SourcesDirectory)/src/coverage.runsettings'
publishTestResults: true
- task: CopyFiles@2
inputs:
SourceFolder: 'src/GeneratedNuGetPackages/$(buildConfiguration)/'
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(build.artifactstagingdirectory)'
artifact: 'Packages'
publishLocation: 'pipeline'