forked from Armor-Network/armor-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
370 lines (328 loc) · 13 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# Requirements:
# set 'GithubPAT' secure variable in the Azure Pipelines UI
name: $(System.TeamProject)-$(Build.SourceBranchName)-$(Date:yyyyMMdd-HHmm)$(Rev:.r)
trigger:
branches:
include:
- releases/*
paths:
exclude:
- README.md
pr: none
# pr:
# autoCancel: true
# branches:
# include:
# - master
# - releases/*
# paths:
# exclude:
# - README.md
variables:
desktopRepo: $(Build.Repository.Name)
jobs:
#- job: WaitForDaemonsBuild
pool:
vmImage: ubuntu-18.04
steps:
- checkout: none
#- script: |
echo Build.BuildId=$(Build.BuildId)
echo Build.BuildNumber=$(Build.BuildNumber)
echo Build.BuildUri=$(Build.BuildUri)
displayName: Echo predefined vars
- script: |
set -o xtrace
desktopRepo="$(desktopRepo)"
daemonsRepo=${desktopRepo%-*}
contains () { [[ "$1" =~ (^|[[:space:]])"$2" ]]; }
while [ : ]
do
branches=`curl -H "Authorization: token $(GithubPAT)" https://api.github.com/repos/$daemonsRepo/branches | jq -r '.[] | .name' | tr '\n' ' '`
echo branches=$branches
contains "$branches" releases ; result=$?
[[ $result -eq 0 ]] && sleep 30s || break
done
displayName: Sleep while daemons repo has 'releases/*' branch
####################### Linux #######################
- job: Linux
pool:
vmImage: ubuntu-18.04
dependsOn: WaitForDaemonsBuild
steps:
- checkout: none
#- task: DownloadBuildArtifacts@0
displayName: Download daemons build artifacts
inputs:
buildType: specific
project: armornetwork
pipeline: armornetworkdev.armor
buildVersionToDownload: 'latest'
downloadType: single
artifactName: linux64
downloadPath: '$(Build.ArtifactStagingDirectory)'
- script: |
sudo apt-get update
sudo apt-get install -y build-essential libudev-dev
displayName: Install dependences
#- script: |
unzip $(Build.ArtifactStagingDirectory)/linux64/\*.zip
mkdir armor/bin
mv -v *d armor/bin/
./armor/bin/armord --version
displayName: Unzip daemons build artifact
- script: |
mkdir armor-gui && cd armor-gui
git init
git remote add origin https://user:$(GithubPAT)@github.com/$(desktopRepo)
git fetch --depth 1 origin $(Build.SourceBranch)
git checkout FETCH_HEAD
displayName: Clone desktop code
- script: |
sudo apt-get update
sudo apt-get install -y qt5-qmake qtbase5-dev qtbase5-dev-tools qt5-default
displayName: Install qt
- script: |
mkdir armor-gui/build && cd armor-gui/build
qmake ../src/armor-gui.pro && make -j$(nproc)
displayName: Build desktop
- script: |
zip -j -r $(Build.ArtifactStagingDirectory)/$(System.TeamProject)-desktop-$(Build.SourceBranchName)-linux64.zip \
armor-gui/bin/armord \
armor-gui/bin/walletd \
armor/bin/minerd \
armor-gui/bin/armor-gui
displayName: Zip desktop
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: linux64
displayName: Publish artifacts
####################### Macos #######################
- job: Mac
pool:
vmImage: macOS-10.14
dependsOn: WaitForDaemonsBuild
variables:
MACOSX_DEPLOYMENT_TARGET: 10.14
condition: |
succeeded()
steps:
- checkout: none
#- task: DownloadBuildArtifacts@0
displayName: Download daemons build artifacts
inputs:
buildType: specific
project: armornetwork
pipeline: armornetworkdev.armor
buildVersionToDownload: 'latest'
downloadType: single
artifactName: macos
downloadPath: '$(Build.ArtifactStagingDirectory)'
#- script: |
unzip $(Build.ArtifactStagingDirectory)/macos/\*.zip
mkdir armor/bin
mv -v *d armor/bin/
./armor/bin/armord --version
displayName: Unzip daemons build artifact
- script: |
mkdir armor-gui && cd armor-gui
git init
git remote add origin https://user:$(GithubPAT)@github.com/$(desktopRepo)
git fetch --depth 1 origin $(Build.SourceBranch)
git checkout FETCH_HEAD
displayName: Clone desktop code
- script: |
brew update
brew install qt@5
displayName: Install qt 5
- script: |
export PATH="/usr/local/opt/qt@5/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/qt@5/lib"
export CPPFLAGS="-I/usr/local/opt/qt@5/include"
export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig"
mkdir armor-gui/build && cd armor-gui/build
qmake ../src/armor-gui.pro && make -j
displayName: Build desktop code
- script: |
export PATH="/usr/local/opt/qt@5/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/qt@5/lib"
export CPPFLAGS="-I/usr/local/opt/qt@5/include"
export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig"
macdeployqt armor-gui/bin/armor-gui.app
displayName: Call macdeployqt
- script: |
cd armor-gui/bin
zip -y -r $(Build.ArtifactStagingDirectory)/$(System.TeamProject)-desktop-$(Build.SourceBranchName)-macos.zip armor-gui.app
displayName: Zip app folder
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: macos
displayName: Publish artifacts
####################### Windows #######################
- job: Windows
pool:
vmImage: vs2017-win2016
dependsOn: WaitForDaemonsBuild
condition: |
succeeded()
variables:
QTDIR: C:\Users\qt\work\install
vsPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
vsCMakeDir: $(vsPath)\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
vsMSBuildDir: $(vsPath)\MSBuild\15.0\Bin
VCINSTALLDIR: $(vsPath)\VC
qtVer: 5.12.2
qtFullVer: $(qtVer)-0-201903131307
qtBuildName: Windows-Windows_10-MSVC2017-Windows-Windows_10-X86
qtMSVC: msvc2017
qtRepoUrlPrefix: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5122/qt.qt5.5122.win
wixInstallPath: C:\Program Files (x86)\WiX Toolset v3.11\bin
strategy:
matrix:
win64:
opensslDir: openssl
opensslConfig: VC-WIN64A
generatorName: Visual Studio 16 2019 Win64
qtBinArch: _64
installerArch: x64
arch: 64
steps:
- checkout: none
#- task: DownloadBuildArtifacts@0
displayName: Download daemons build artifacts
inputs:
buildType: specific
project: armornetwork
pipeline: armornetworkdev.armor
buildVersionToDownload: 'latest'
downloadType: single
artifactName: win$(arch)
downloadPath: '$(Build.ArtifactStagingDirectory)'
#- bash: |
set -o xtrace
7z x "$(Build.ArtifactStagingDirectory)"/win$(arch)/\*.zip
mkdir armor/bin
mv -v *d.exe armor/bin
mv -v *d.pdb armor/bin
mv -v *.dll armor/bin/
./armor/bin/armord --version
displayName: Unzip daemons build artifact
- bash: |
curl -L -O $(qtRepoUrlPrefix)$(arch)_$(qtMSVC)$(qtBinArch)/$(qtFullVer)qtbase-$(qtBuildName)$(qtBinArch).7z
7z x $(qtFullVer)qtbase-$(qtBuildName)$(qtBinArch).7z -o"C:\Users\qt\work\temp"
curl -L -O $(qtRepoUrlPrefix)$(arch)_$(qtMSVC)$(qtBinArch)/$(qtFullVer)qttools-$(qtBuildName)$(qtBinArch).7z
7z x $(qtFullVer)qttools-$(qtBuildName)$(qtBinArch).7z -o"C:\Users\qt\work\temp"
curl -L -O $(qtRepoUrlPrefix)$(arch)_$(qtMSVC)$(qtBinArch)/$(qtFullVer)qttranslations-$(qtBuildName)$(qtBinArch).7z
7z x $(qtFullVer)qttranslations-$(qtBuildName)$(qtBinArch).7z -o"C:\Users\qt\work\temp"
curl -L -O $(qtRepoUrlPrefix)$(arch)_$(qtMSVC)$(qtBinArch)/$(qtFullVer)qtimageformats-$(qtBuildName)$(qtBinArch).7z
7z x $(qtFullVer)qtimageformats-$(qtBuildName)$(qtBinArch).7z -o"C:\Users\qt\work\temp"
curl -L -O $(qtRepoUrlPrefix)$(arch)_$(qtMSVC)$(qtBinArch)/$(qtFullVer)qtsvg-$(qtBuildName)$(qtBinArch).7z
7z x $(qtFullVer)qtsvg-$(qtBuildName)$(qtBinArch).7z -o"C:\Users\qt\work\temp"
curl -L -O $(qtRepoUrlPrefix)$(arch)_$(qtMSVC)$(qtBinArch)/$(qtFullVer)opengl32sw-$(arch)-mesa_12_0_rc2.7z
7z x $(qtFullVer)opengl32sw-$(arch)-mesa_12_0_rc2.7z -o"C:\Users\qt\work\temp"
mkdir -p "$(QTDIR)"
mv -v "C:\Users\qt\work\temp"/$(qtVer)/$(qtMSVC)$(qtBinArch)/* "$(QTDIR)"
sed -b -i 's/QT_EDITION = Enterprise/QT_EDITION = OpenSource/g' "$(QTDIR)"/mkspecs/qconfig.pri
sed -b -i 's/QT_LICHECK = licheck.exe/QT_LICHECK = /g' "$(QTDIR)"/mkspecs/qconfig.pri
displayName: Install Qt
- bash: |
curl -L -O http://download.qt.io/official_releases/jom/jom.zip
7z x jom.zip -ojom
displayName: Install Jom
- bash: |
mkdir armor-gui && cd armor-gui
git init
git remote add origin https://user:$(GithubPAT)@github.com/$(desktopRepo)
git fetch --depth 1 origin $(Build.SourceBranch)
git checkout FETCH_HEAD
displayName: Clone desktop code
- bash: |
mkdir armor-gui/build && cd armor-gui/build
echo "call \"$VCINSTALLDIR\Auxiliary\Build\vcvars$(arch).bat\"" > compile.bat
echo "\"$QTDIR\bin\qmake.exe\" ..\src\armor-gui.pro" >> compile.bat
echo "..\..\jom\jom -j %NUMBER_OF_PROCESSORS%" >> compile.bat
./compile.bat
displayName: Build desktop
- bash: |
cd armor-gui/bin
echo "call \"$VCINSTALLDIR\Auxiliary\Build\vcvars$(arch).bat\"" > deploy.bat
echo "\"$QTDIR/bin/windeployqt.exe\" ." >> deploy.bat
./deploy.bat
displayName: Call windeployqt
- bash: |
VCRedistVersion=`cat "$VCINSTALLDIR\Auxiliary\Build\Microsoft.VCRedistVersion.default.txt"`
VCMergeModulesDir="$VCINSTALLDIR\Redist\MSVC\\$VCRedistVersion\MergeModules"
cd armor-gui/Windows\ Installer
"$(wixInstallPath)"/candle.exe -arch $(installerArch) \
-dVersion=$(Build.SourceBranchName) \
-dProductVersion=`date +%y.%m.%d` \
-dDate=`date +%Y/%m/%d` \
-dVC_MERGE_MODULES_PATH="$VCMergeModulesDir\Microsoft_VC141_CRT_$(installerArch).msm" \
Installer.wxs
"$(wixInstallPath)"/light.exe -sw1076 -ext WixUIExtension -spdb -out "$(Build.ArtifactStagingDirectory)"/armor-desktop-$(Build.SourceBranchName)-win$(arch).msi Installer.wixobj
displayName: Build Wix installer
- bash: |
cd armor-gui/bin
7z a "$(Build.ArtifactStagingDirectory)"/armor-desktop-$(Build.SourceBranchName)-win$(arch)-portable.zip .
displayName: Zip desktop
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: win$(arch)
displayName: Publish artifacts
#############################
- job: CreateGithubRelease
pool:
vmImage: ubuntu-16.04
dependsOn:
- Linux
- Mac
- Windows
condition: |
succeeded()
steps:
- checkout: none
#- task: DownloadBuildArtifacts@0
displayName: Download artifacts
inputs:
downloadType: specific
itemPattern: '**'
downloadPath: '$(Build.ArtifactStagingDirectory)'
- script: |
set -e
set -o xtrace
ls -alh $(Build.ArtifactStagingDirectory)
[[ `echo $(Build.SourceBranchName) | grep '-'` ]] && preRelease=true || preRelease=false
curl -H "Authorization: token $(GithubPAT)" \
-d '{ "tag_name": "v$(TagName)",
"target_commitish": "$(Build.SourceBranchName)",
"name": "v$(TagName)",
"draft": true,
"prerelease": '$preRelease'}' \
https://api.github.com/repos/$(desktopRepo)/releases > resp
cat resp
release_id=`cat resp | jq -r '.id'`
echo release_id=$release_id
curl \
-H "Authorization: token $(GithubPAT)" \
-H "Content-Type: application/zip" -X POST \
--data-binary "@$(Build.ArtifactStagingDirectory)/linux64/$(System.TeamProject)-desktop-$(Build.SourceBranchName)-linux64.zip" \
https://uploads.github.com/repos/$(desktopRepo)/releases/$release_id/assets?name="$(System.TeamProject)-desktop-$(Build.SourceBranchName)-linux64.zip"
curl \
-H "Authorization: token $(GithubPAT)" \
-H "Content-Type: application/zip" -X POST \
--data-binary "@$(Build.ArtifactStagingDirectory)/macos/$(System.TeamProject)-desktop-$(Build.SourceBranchName)-macos.zip" \
https://uploads.github.com/repos/$(desktopRepo)/releases/$release_id/assets?name="$(System.TeamProject)-desktop-$(Build.SourceBranchName)-macos.zip"
curl \
-H "Authorization: token $(GithubPAT)" \
-H "Content-Type: application/zip" -X POST \
--data-binary "@$(Build.ArtifactStagingDirectory)/win64/armor-desktop-$(Build.SourceBranchName)-win64.msi" \
https://uploads.github.com/repos/$(desktopRepo)/releases/$release_id/assets?name="armor-desktop-$(Build.SourceBranchName)-win64.msi"
curl \
-H "Authorization: token $(GithubPAT)" \
-H "Content-Type: application/zip" -X POST \
--data-binary "@$(Build.ArtifactStagingDirectory)/win64/armor-desktop-$(Build.SourceBranchName)-win64-portable.zip" \
https://uploads.github.com/repos/$(desktopRepo)/releases/$release_id/assets?name="armor-desktop-$(Build.SourceBranchName)-win64-portable.zip"
displayName: Create github release in desktop repo