-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
azure-pipelines.yml
82 lines (70 loc) · 2.74 KB
/
azure-pipelines.yml
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
74
75
76
77
78
79
80
81
82
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
variables:
buildConfiguration: 'Release'
version: 8.0
steps:
- task: UseDotNet@2
displayName: Installing .NET 8
inputs:
packageType: 'sdk'
version: '8.x'
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: PowerShell@2
displayName: Set Build Number
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'))
inputs:
targetType: 'inline'
script: |
Write-Host "##vso[build.updatebuildnumber]${{ variables.version }}.$(Build.BuildId)"
- task: DotNetCoreCLI@2
displayName: Restoring Packages for Solution
inputs:
command: restore
projects: '**/*.sln'
- script: 'echo -e "$(Build.BuildNumber)\n$(Build.BuildId)" > .buildinfo.json'
condition: and(always(), eq(variables['imageName'], 'ubuntu-latest'))
displayName: "Emit build number"
workingDirectory: '$(Build.SourcesDirectory)/source/DasBlog.Web.UI'
failOnStderr: true
- task: DotNetCoreCLI@2
displayName: Building Solution
inputs:
command: build
projects: '**/*.sln'
arguments: '--no-restore --configuration $(BuildConfiguration) -p:VersionPrefix=$(Build.BuildNumber) -p:FileVersion=$(Build.BuildNumber).0 -p:SourceRevisionId=$(Build.SourceVersion)'
- script: dotnet test source/DasBlog.Tests/UnitTests/ --logger trx;LogfileName=test_results.xml --results-directory $(System.DefaultWorkingDirectory)/test_results --filter Category=UnitTest
displayName: Run Unit Tests on Windows
condition: and(succeeded(), eq(variables['imageName'], 'windows-latest'))
- task: PublishTestResults@2
displayName: Publish Test Results
condition: and(always(), eq(variables['imageName'], 'windows-latest'))
inputs:
testRunner: VSTest
testResultsFiles: '**/*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/test_results'
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: True
zipAfterPublish: false
modifyOutputPath: false
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/$(System.TeamProject)_$(Build.BuildNumber) '
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(System.TeamProject)_$(Build.BuildNumber)
archiveType: 'zip'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/$(System.TeamProject)_$(Build.BuildNumber).zip'
replaceExistingArchive: true
- task: PublishPipelineArtifact@1
condition: and(succeeded(), eq(variables['imageName'], 'windows-latest'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(System.TeamProject)_$(Build.BuildNumber).zip'
artifactName: $(System.TeamProject)_$(Build.BuildNumber)