-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
195 lines (159 loc) · 11.6 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
resources:
repositories:
- repository: templates
type: git
name: OneHomag/SWC-DevOps-HoT
ref: main
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
variables:
dotnetVersion: 8.0.x
ProductName: HomagGroup.DigitalFactory.DigitalDevelopment
ProjectName: HomagConnect
stages:
- stage: retrieve_version_info_from_git
displayName: Get Version info
jobs:
- job: get_number_job
steps:
- checkout: self
fetchDepth: 0
- task: PowerShell@2
displayName: Set version environment variable
name: version_task
inputs:
targetType: inline
script: |
git log
$VERSION_TAG = git describe --tags --dirty --match='[0-9]*'
echo "Set version tag: $($VERSION_TAG)"
echo "##vso[task.setvariable variable=VERSION_TAG]$($VERSION_TAG)"
- template: software-composition-analysis/template.yml@templates
parameters:
dependsOn:
- retrieve_version_info_from_git
fully_qualifed_package_name: HomagGroup.DigitalFactory.Solutions.DF-Insights
analyze_directory: $(Build.SourcesDirectory)
package_version: $[ stageDependencies.retrieve_version_info_from_git.get_number_job.outputs['version_task.VERSION_TAG'] ]
- stage: Build
pool:
vmimage: 'windows-latest'
variables:
BuildConfiguration: Release
dependsOn: software_composition_analysis_stage
jobs:
- job: Build
steps:
- checkout: self
fetchDepth: 0
- script: echo "Build branch is $(Build.SourceBranch)"
displayName: Display build branch environment variable
- task: PowerShell@2
displayName: Set version environment variable
inputs:
targetType: inline
script: |
git log
$VERSION_TAG = git describe --tags --dirty --match='[0-9]*'
echo "Set version tag: $($VERSION_TAG)"
echo "##vso[task.setvariable variable=VERSION_TAG]$($VERSION_TAG)"
- task: UseDotNet@2
displayName: 'Use .NET Core sdk $(dotnetVersion)'
inputs:
packageType: 'sdk'
version: $(dotnetVersion)
- task: DotNetCoreCLI@2
displayName: Restore packages
inputs:
command: 'restore'
- task: SonarQubePrepare@5
displayName: 'Prepare analysis on SonarQube'
inputs:
SonarQube: 'SonarQube Enterprise'
projectKey: $(ProductName).$(ProjectName)
projectName: $(ProductName).$(ProjectName)
projectVersion: '$(MajorMinorBuildVersion)'
extraProperties: |
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx
condition: and(succeeded(), eq(variables.disableSonarQubeAnalysis, false))
- task: DotNetCoreCLI@2
displayName: Build projects
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration) --no-restore -nr:FALSE'
- task: DotNetCoreCLI@2
displayName: Run Integration Tests in PRD environment to ensure that the samples are working.
env:
HomagConnect:BaseUrl: $(HomagConnect:BaseUrl)
HomagConnect:SubscriptionId: $(HomagConnect:SubscriptionId)
HomagConnect:AuthorizationKey: $(HomagConnect:AuthorizationKey)
inputs:
command: 'test'
arguments: '--configuration $(BuildConfiguration) --no-restore --no-build --filter TestCategory!=TemporaryDisabled&TestCategory!=UserTestInteractionNeeded'
- task: SonarQubeAnalyze@5
displayName: 'Run Code Analysis'
condition: and(succeeded(), eq(variables.disableSonarQubeAnalysis, false))
- task: SonarQubePublish@5
displayName: 'Publish Quality Gate Result'
condition: and(succeeded(), eq(variables.disableSonarQubeAnalysis, false))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Base/HomagConnect.Base.Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect Base Contracts NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Base/HomagConnect.Base/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect Base NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/MmrMobile/Client/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect MmrMobile Client NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/MmrMobile/Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect MmrMobile Contracts NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/IntelliDivide/Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect IntelliDivide Contract NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/IntelliDivide/Client/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect IntelliDivide Client NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/IntelliDivide/Samples/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect IntelliDivide Client Samples package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/MaterialManager/Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect MaterialManager Contracts package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/MaterialManager/Client/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect MaterialManager Client package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/MaterialAssist/Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect MaterialAssist Contracts package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/MaterialAssist/Client/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect MaterialAssist Client package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/ProductionManager/Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect ProductionManager Contract NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/ProductionManager/Client/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect ProductionManager Client NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/ProductionManager/Samples/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect ProductionManager Client Samples package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/ProductionAssist/Contracts/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect ProductionAssist Contract NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/ProductionAssist/Client/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect ProductionAssist Client NuGet package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))
- script: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY) "Applications/ProductionAssist/Samples/**/*.nupkg" --skip-duplicate
displayName: "Publish HomagConnect ProductionAssist Client Samples package on nuget.org"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),startsWith(variables['Build.SourceBranch'], 'refs/heads/main')))