-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
149 lines (123 loc) · 4.8 KB
/
azure-pipelines.yml
File metadata and controls
149 lines (123 loc) · 4.8 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
jobs:
- job: Linux
displayName: Build & Test Linux
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
artifactsFolder: '$(Build.SourcesDirectory)/artifacts/'
steps:
- script: sudo apt-get install clang zlib1g-dev libkrb5-dev libtinfo5 -y
displayName: Install requirements
- task: UseDotNet@2
displayName: 'Use .NET 6.x'
inputs:
version: '6.x'
packageType: sdk
- powershell: dotnet publish ./src/TRH/TRH.csproj -c $(buildConfiguration) -r linux-x64 -o $(artifactsFolder) --self-contained
displayName: 'Build'
- powershell: mv TRH trh
displayName: Rename artifact
workingDirectory: '$(artifactsFolder)'
- powershell: strip trh
displayName: Strip artifact
workingDirectory: '$(artifactsFolder)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '**/*Test/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
- powershell: mv $(artifactsFolder)/trh $(Build.ArtifactStagingDirectory)
displayName: Copy artifacts
- task: PublishBuildArtifacts@1
displayName: Publish
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: trhLin
- job: Windows
displayName: Build & Test Windows
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
artifactsFolder: '$(Build.SourcesDirectory)/artifacts/'
steps:
- task: UseDotNet@2
displayName: 'Use .NET 6.x'
inputs:
version: '6.x'
packageType: sdk
- powershell: $version = '0.0.0'; echo "##vso[task.setvariable variable=version]$version"
displayName: Set default version
- powershell: $version = ($env:Build_SourceBranch -replace 'refs/tags/v',''); echo $version; echo "##vso[task.setvariable variable=version]$version"
displayName: Get version from tag
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- powershell: dotnet publish ./src/TRH/TRH.csproj -c $(buildConfiguration) -r win-x64 -o $(artifactsFolder) --self-contained
displayName: 'Build'
- powershell: mv TRH.exe trh.exe
displayName: Rename artifact
workingDirectory: '$(artifactsFolder)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '**/*Test/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
- task: PowerShell@2
displayName: 'Build MSI setup'
inputs:
targetPath: 'filePath'
filePath: '$(Build.SourcesDirectory)/src/Installer/build-msi.ps1'
arguments: "-version $env:version"
workingDirectory: '$(Build.SourcesDirectory)/src/Installer'
- powershell: mv $(artifactsFolder)/trh.exe $(Build.ArtifactStagingDirectory); mv $(artifactsFolder)/trh.msi $(Build.ArtifactStagingDirectory)
displayName: Copy artifacts
- task: PublishBuildArtifacts@1
displayName: Publish
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: trhWin
- job: Release
dependsOn:
- Linux
- Windows
pool:
vmImage: 'windows-latest'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Linux executable
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'trhLin'
downloadPath: '$(System.ArtifactsDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download Windows executable
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'trhWin'
downloadPath: '$(System.ArtifactsDirectory)'
- powershell: $version = ($env:Build_SourceBranch -replace 'refs/tags/v',''); echo $version; echo "##vso[task.setvariable variable=version]$version"
displayName: Get version from tag
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- task: GitHubRelease@0
displayName: GitHub Release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: 'GitHubTRH'
repositoryName: 'GDATASoftwareAG/TypeRefHasher'
title: 'TypeRefHasher $(version)'
addChangeLog: false
assets: |
$(System.ArtifactsDirectory)\trhLin\*
$(System.ArtifactsDirectory)\trhWin\*.exe
$(System.ArtifactsDirectory)\trhWin\*.msi