forked from xBimTeam/XbimGeometry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
178 lines (154 loc) · 6.99 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
trigger:
branches:
include:
- master
- develop
paths:
exclude:
- README.md
- CHANGELOG.md
- CONTRIBUTING.md
variables:
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
major: 5
minor: 1
# creates a counter called versioncounter and seeds it at 100 and then assigns the value to a variable named buildNo.
buildNo: $[counter('geomversioncounter', 100)]
name: $(BuildDefinitionName)_$(SourceBranchName)_$(major).$(minor).$(buildNo)
jobs:
- job: XbimGeometryBuild
timeoutInMinutes: 120
steps:
# Windows script setting up $(packageversion) of the nuget package based on branch
# Master branch
- script: |
echo ##vso[task.setvariable variable=packageversion]$(major).$(minor).$(buildNo)
displayName: 'Setting Nuget PackageVersion'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
# Any other branch
- script: |
echo ##vso[task.setvariable variable=packageversion]$(major).$(minor).$(buildNo)-$(Build.SourceBranchName)
displayName: 'Setting Prerelease Nuget PackageVersion'
condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
# Windows script setting up $(fileversion) used to stamp AssemblyFileVersions.
# By convention we use 'Major.Minor.BuildNo.0' on Master and 'Major.Minor.0.BuildNo' on other branches
# Master branch
- script: |
echo ##vso[task.setvariable variable=fileversion]$(major).$(minor).$(buildNo).0
displayName: 'Setting FileVersion'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
# Any other branch
- script: |
echo ##vso[task.setvariable variable=fileversion]$(major).$(minor).0.$(buildNo)
displayName: 'Setting Prerelease FileVersion'
condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
#Task group has not been exported, task groups are not supported yet
- task: NuGetToolInstaller@0
displayName: 'Use a new NuGet'
inputs:
versionSpec: '4.6.2'
# Version .NET Core project files
# Description - Applies a version to a .NET Core assembly via the .csproj files based on the build number.
# Based on https://github.com/rfennell/AzurePipelines/wiki/Version-Assemblies-and-Packages-Tasks-YAML#versiondotnetcoreassembliestask
- task: VersionDotNetCoreAssemblies@2
displayName: 'Update netcore FileVersions'
inputs:
# Required arguments
Path: $(Build.SourcesDirectory)
VersionNumber: $(fileversion)
VersionRegex: \d+\.\d+\.\d+\.\d+
FilenamePattern: .csproj
Field: fileversion
OutputVersion: OutputedVersion
# Version Native C++
- powershell: |
((Get-Content -path Xbim.Geometry.Engine\app.rc -Raw) -replace '"FileVersion", "5.1.0.0"','"FileVersion", "$(fileversion)"') | Set-Content -Path Xbim.Geometry.Engine\app.rc
displayName: 'Update Native C++ FileVersion'
- powershell: |
((Get-Content -path Xbim.Geometry.Engine\app.rc -Raw) -replace 'FILEVERSION 5,1,0,0','FILEVERSION $(major),$(minor),$(buildNo),0') | Set-Content -Path Xbim.Geometry.Engine\app.rc
displayName: 'Update Native C++ FILEVERSION - for Master'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
- powershell: |
((Get-Content -path Xbim.Geometry.Engine\app.rc -Raw) -replace 'FILEVERSION 5,1,0,0','FILEVERSION $(major),$(minor),0,$(buildNo)') | Set-Content -Path Xbim.Geometry.Engine\app.rc
displayName: 'Update Native C++ FILEVERSION - for Pre-Release'
condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
- task: NuGetCommand@2
displayName: 'NuGet restore Xbim.Geometry.Engine.sln'
inputs:
restoreSolution: 'Xbim.Geometry.Engine.sln'
feedsToUse: config
nugetConfigPath: nuget.config
- task: VSBuild@1
displayName: 'Build solution Xbim.Geometry.Engine.sln'
inputs:
solution: 'Xbim.Geometry.Engine.sln'
msbuildArgs: '/t:build'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
# Delete all Package(s) including newly built - we're going to regenerate with the current build version
# We need to msbuild pack to complete however before we can run 'dotnet pack' on Geometry Engine
- task: DeleteFiles@1
displayName: 'Delete old *.nupkg files from $(build.sourcesdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: '**\bin\$(BuildConfiguration)\**\*.nupkg'
# Pack GeometryEngine.Interop
- script: dotnet pack Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj -c $(BuildConfiguration) -o Xbim.Geometry.Engine.Interop/bin/$(BuildConfiguration) /p:PackageVersion=$(packageversion)
name: 'Geometry_Interop_Pack'
# Pack ModelGeometry.Scene
- script: dotnet pack Xbim.ModelGeometry.Scene/Xbim.ModelGeometry.Scene.csproj -c $(BuildConfiguration) -o Xbim.ModelGeometry.Scene/bin/$(BuildConfiguration) /p:PackageVersion=$(packageversion)
name: 'ModelScene_Pack'
# Xbim.Geometry meta package
- powershell: |
((Get-Content -path Xbim.Geometry\Xbim.Geometry.tmpl -Raw) -replace '{{version}}','$(packageversion)') | Set-Content -Path Xbim.Geometry\Xbim.Geometry.nuspec
name: Geometry_metapackage_Update
- script: nuget pack Xbim.Geometry\Xbim.Geometry.nuspec -OutputDirectory Xbim.Geometry/bin/$(BuildConfiguration)
name: Geometry_metapackage_Pack
- task: VSTest@2
displayName: 'VsTest - testAssemblies'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '**\bin\$(BuildConfiguration)\**\Xbim.Geometry.Engine.Interop.Tests.dll'
searchFolder: '$(System.DefaultWorkingDirectory)'
runSettingsFile: 'test.runsettings'
codeCoverageEnabled: true
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishSymbols@1
displayName: 'Publish symbols path: '
inputs:
SearchPattern: '**\bin\**\*.pdb'
enabled: false
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: '**\bin\$(BuildConfiguration)\*.nupkg'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
# Publish to master or develop MyGet feed based on the source branch
- task: NuGetCommand@2
name: 'MyGetPublishing_Master'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: 'MyGetMaster'
versioningScheme: byEnvVar
versionEnvVar: packageversion
- task: NuGetCommand@2
name: 'MyGetPublishing_Develop'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: 'MyGetDev'
versioningScheme: byEnvVar
versionEnvVar: packageversion