-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
256 lines (217 loc) · 8.38 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
branches:
include:
- refs/heads/*
- refs/tags/*
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/tags/')) }}:
versionName: $(Build.SourceVersion)
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
versionName: $(Build.SourceBranchName)
installerBaseFileName: speedrun-timer-installer_$(versionName)
${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) }}:
buildConfiguration: 'Experimental'
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/v') }}:
buildConfiguration: 'Release'
jobs:
- job: WindowsInstaller
pool:
vmImage: 'VS2017-Win2016'
steps:
- task: NuGetToolInstaller@0
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: Build solution
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
displayName: Run Tests
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.5.4'
addToPath: true
- script: python -m pip install --upgrade pip
displayName: 'Install tools'
- script: pip install -r InstallerGUI\requirements.txt
displayName: 'Install requirements'
- script: pyinstaller -y pyinstaller.spec
displayName: 'Create installer'
workingDirectory: $(Build.SourcesDirectory)\InstallerGUI
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(system.defaultworkingdirectory)/Installer/bin'
artifactName: 'bin' # hack
publishLocation: 'Container'
- task: CopyFiles@2
displayName: Stage dll artifact
inputs:
sourceFolder: $(Build.SourcesDirectory)/140-speedrun-timer/bin/Release/
contents: 'speedrun-timer.dll'
targetFolder: $(Build.ArtifactStagingDirectory)/dll
- task: PublishBuildArtifacts@1
displayName: Publish dll artifact
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/dll
artifactName: 'dll'
publishLocation: 'Container'
- task: CopyFiles@2
displayName: Stage windows installer
inputs:
sourceFolder: $(system.defaultworkingdirectory)/InstallerGUI/dist/
contents: '**'
targetFolder: $(Build.ArtifactStagingDirectory)/installer
- bash: mv installer/speedrun-timer-installer.exe "installer/$(installerBaseFileName).exe"
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: Rename installer
- task: PublishBuildArtifacts@1
displayName: Publish windows installer artifact
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/installer'
artifactName: 'installer-windows'
publishLocation: 'Container'
- job: MacInstaller
pool:
vmImage: 'macOS-10.14'
dependsOn: WindowsInstaller
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'bin'
downloadPath: '$(System.DefaultWorkingDirectory)/Installer'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.5.9'
addToPath: true
- script: python -m pip install --upgrade pip
displayName: 'Install tools'
- script: pip install -r InstallerGUI/requirements.txt
displayName: 'Install requirements'
- script: chmod +x InstallerGUI/mkbundle.sh
displayName: 'Make mkbundle.sh executable'
- script: |
# Get the macos universal pkg installer download url
# for the version you want to install from: https://download.mono-project.com/archive/
MONO_MACOS_PKG_DOWNLOAD_URL='https://download.mono-project.com/archive/4.6.2/macos-10-universal/MonoFramework-MDK-4.6.2.macos10.xamarin.universal.pkg'
# create a temp dir and cd into it
mkdir -p /tmp/mono-install
cd /tmp/mono-install
# debug: mono version before the install
mono --version
# download mono mac installer (pkg)
wget -q -O ./mono-installer.pkg "$MONO_MACOS_PKG_DOWNLOAD_URL"
# install it
sudo installer -pkg ./mono-installer.pkg -target /
# link pkg-config binary
sudo ln -s /Library/Frameworks/Mono.framework/Commands/pkg-config /usr/local/bin
# debug: mono version after install, just to confirm it did overwrite the original version
mono --version
# just for fun print this symlink too, which should point to the version we just installed
ls -alh /Library/Frameworks/Mono.framework/Versions/Current
displayName: "Install Mono 4.6.2"
- script: pyinstaller -y pyinstaller.spec
displayName: 'Create installer'
workingDirectory: $(Build.SourcesDirectory)/InstallerGUI
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/InstallerGUI/dist/speedrun-timer-installer.app'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(installerBaseFileName)_macOS.zip'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'installer-macOs'
publishLocation: 'Container'
- job: LinuxInstaller
pool:
vmImage: 'ubuntu-16.04'
dependsOn: WindowsInstaller
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'bin'
downloadPath: '$(System.DefaultWorkingDirectory)/Installer'
- script: sudo apt-get install -y python3-dev python3-tk
displayName: Install Python development packages
- script: python3 -m pip install --upgrade pip setuptools wheel
displayName: 'Install pip'
- script: sudo python3 -m pip install -r InstallerGUI/requirements.txt
displayName: 'Install requirements'
- script: |
mono --version
sudo cat /etc/apt/sources.list.d/mono-official-stable.list
sudo apt-get remove mono-complete
sudo apt autoremove
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https ca-certificates
echo "deb https://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.6.2 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel
mono --version
displayName: 'Install Mono 4.6.2'
- script: chmod +x InstallerGUI/mkbundle.sh
displayName: 'Make mkbundle.sh executable'
- script: pyinstaller -y pyinstaller.spec
displayName: 'Create installer'
workingDirectory: $(Build.SourcesDirectory)/InstallerGUI
- task: CopyFiles@2
inputs:
sourceFolder: $(system.defaultworkingdirectory)/InstallerGUI/dist/
contents: '**'
targetFolder: $(Build.ArtifactStagingDirectory)
- bash: mv speedrun-timer-installer_linux.x64 "$(installerBaseFileName)_linux.x64"
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: Rename installer
- task: PublishBuildArtifacts@1
displayName: Publish linux installer artifact
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'installer-linux'
publishLocation: 'Container'
- script: ls -lR $(Build.ArtifactStagingDirectory)
- job: Deploy
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
dependsOn:
- WindowsInstaller
- LinuxInstaller
- MacInstaller
pool:
vmImage: 'VS2017-Win2016'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download windows installer artifact
inputs:
artifactName: 'installer-windows'
downloadPath: '$(System.ArtifactsDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download macOs installer artifact
inputs:
artifactName: 'installer-macOs'
downloadPath: '$(System.ArtifactsDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download linux installer artifact
inputs:
artifactName: 'installer-linux'
downloadPath: '$(System.ArtifactsDirectory)'
- bash: ls -lR "$(System.ArtifactsDirectory)"
- task: GitHubRelease@0
inputs:
gitHubConnection: 'GitHub connection 1'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
title: '$(Build.SourceBranchName)'
tagSource: auto
isDraft: true
assets: $(System.ArtifactsDirectory)/**/*