This repository has been archived by the owner on Dec 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
azure-pipelines.yml
267 lines (236 loc) · 8.03 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
trigger:
- master
pr:
- master
stages:
- stage: 'BuildAndTest'
displayName: 'Build & Test'
jobs:
- job: Build
strategy:
matrix:
linux-x64:
imageName: 'ubuntu-16.04'
deskGapPlatform: 'linux-x64'
win32-ia32:
imageName: 'windows-2019'
deskGapPlatform: 'win32-ia32'
darwin-x64:
imageName: 'macos-10.14'
deskGapPlatform: 'darwin-x64'
pool:
vmImage: $(imageName)
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- bash: |
set -e
wget https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-x86_64.tar.gz
tar -xvf cmake-3.15.5-Linux-x86_64.tar.gz > /dev/null
export PATH=$PWD/cmake-3.15.5-Linux-x86_64/bin:$PATH
echo "##vso[task.setvariable variable=PATH]$PATH"
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: 'Install the up-to-date version of CMake on Linux'
- bash: |
set -e
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test > /dev/null
sudo apt-get update -y > /dev/null
sudo apt-get install -y g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo update-alternatives --config gcc
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: 'Install gcc-8 and g++-8 on Linux'
- bash: sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: 'Install dev files of gtk and webkit on Linux'
- bash: brew install cmake
condition: eq( variables['Agent.OS'], 'Darwin' )
displayName: 'Install the up-to-date version of CMake on macOS'
- script: npm ci
displayName: 'npm ci'
- bash: bash node/scripts/build.sh
displayName: 'Build'
- task: ArchiveFiles@2
displayName: 'Tar binary'
inputs:
rootFolderOrFile: $(System.DefaultWorkingDirectory)/dist_build/dist
includeRootFolder: false
archiveType: tar
tarCompression: none
archiveFile: $(Pipeline.Workspace)/dist.tar
- publish: $(Pipeline.Workspace)/dist.tar
artifact: $(deskGapPlatform)
- job: PrepareNPM
dependsOn: Build
displayName: 'Prepare npm Package'
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- download: current
- bash: |
set -e
mkdir dists
for distTarPath in $(find $(Pipeline.Workspace) -type f -path '*/dist.tar'); do
platformName=$(basename $(dirname $distTarPath))
mkdir dists/$platformName
tar -xf $distTarPath -C dists/$platformName
done
displayName: 'Untar binaries'
- bash: npm ci
- bash: bash node/scripts/prepare-npm.sh dists
- publish: $(System.DefaultWorkingDirectory)/npm.tgz
artifact: npmTarball
- publish: $(System.DefaultWorkingDirectory)/dist_zips
artifact: distZips
- job: Test
dependsOn: Build
strategy:
matrix:
win2019:
imageName: 'windows-2019'
deskGapPlatform: 'win32-ia32'
win2016:
imageName: 'vs2017-win2016'
deskGapPlatform: 'win32-ia32'
win2012r2:
imageName: 'vs2015-win2012r2'
deskGapPlatform: 'win32-ia32'
mac:
imageName: 'macos-10.14'
deskGapPlatform: 'darwin-x64'
linux:
imageName: 'ubuntu-16.04'
deskGapPlatform: 'linux-x64'
pool:
vmImage: $(imageName)
steps:
- download: current
artifact: $(deskGapPlatform)
- task: ExtractFiles@1
inputs:
archiveFilePatterns: "$(Pipeline.Workspace)/$(deskGapPlatform)/dist.tar"
destinationFolder: $(System.DefaultWorkingDirectory)/dists
- bash: ls dists
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- script: npm ci
displayName: 'npm ci'
- bash: |
set -e
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
displayName: 'Start xvfb'
condition: eq(variables['Agent.OS'], 'Linux')
- bash: sudo apt-get install -y libwebkit2gtk-4.0-37 > /dev/null
displayName: 'Install webkit2gtk'
condition: eq(variables['Agent.OS'], 'Linux')
- bash: node node/test/start.js "$(System.DefaultWorkingDirectory)/dists"
displayName: 'Test'
env:
DISPLAY: ':99.0'
- job: TestNPM
displayName: 'Test npm Package'
dependsOn: PrepareNPM
strategy:
matrix:
win:
imageName: 'windows-2019'
deskGapPlatform: 'win32-ia32'
mac:
imageName: 'macos-10.14'
deskGapPlatform: 'darwin-x64'
linux:
imageName: 'ubuntu-16.04'
deskGapPlatform: 'linux-x64'
pool:
vmImage: $(imageName)
steps:
- bash: sudo apt-get install -y libwebkit2gtk-4.0-37 > /dev/null
displayName: 'Install webkit2gtk'
condition: eq(variables['Agent.OS'], 'Linux')
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- download: current
artifact: npmTarball
- download: current
artifact: distZips
- bash: |
set -e
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 6
displayName: 'Start xvfb'
condition: eq(variables['Agent.OS'], 'Linux')
- task: CopyFiles@2
inputs:
sourceFolder: "$(Pipeline.Workspace)/npmTarball"
contents: "npm.tgz"
targetFolder: "$(System.DefaultWorkingDirectory)"
- task: Bash@3
inputs:
filePath: $(Build.SourcesDirectory)/node/scripts/test-npm.sh
env:
DISPLAY: ':99.0'
DESKGAP_DIST_FOLDER: $(Pipeline.Workspace)/distZips
DESKGAP_NPM_TEST_INSTALL_WHAT: ../npm.tgz
DESKGAP_NPM_TEST_VERSION_FILE: $(Build.SourcesDirectory)/node/VERSION
- stage: Release
dependsOn: BuildAndTest
condition: and(succeeded(), eq(variables['DESKGAP_AP_RELEASE'], '1'))
jobs:
- job: Publish
pool:
vmImage: 'Ubuntu-18.04'
steps:
- download: current
artifact: npmTarball
- download: current
artifact: distZips
- bash: |
deskgapVersion=$(<$(Build.SourcesDirectory)/node/VERSION)
echo "##vso[task.setvariable variable=DESKGAP_VERSION]$deskgapVersion"
- task: GitHubRelease@0
inputs:
gitHubConnection: 'Creating DeskGap Releases'
action: 'create'
repositoryName: '$(Build.Repository.Name)'
target: '$(Build.SourceVersion)'
tagSource: 'manual'
tag: 'v$(DESKGAP_VERSION)'
assets: |
$(Pipeline.Workspace)/distZips/*
$(Pipeline.Workspace)/npmTarball/*
isDraft: false
addChangeLog: false
releaseNotesSource: 'file'
isPreRelease: ne(variables['DESKGAP_AP_NPM_TAG'], 'latest')
releaseNotesFile: $(Build.SourcesDirectory)/node/WHATS_NEW.md
- task: Bash@3
displayName: "Publish to Binary and npm"
inputs:
filePath: $(Build.SourcesDirectory)/node/scripts/publish-release.sh
env:
DESKGAP_DISTS_DIR: $(Pipeline.Workspace)/distZips
DESKGAP_NPM_TARBALL: $(Pipeline.Workspace)/npmTarball/npm.tgz
NPM_TOKEN: $(NPM_TOKEN)
DESKGAP_BINTRAY_USER: $(DESKGAP_BINTRAY_USER)
DESKGAP_BINTRAY_KEY: $(DESKGAP_BINTRAY_KEY)
- bash: |
set -e
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
displayName: 'Start xvfb'
- bash: sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: 'Install dev files of gtk and webkit on Linux'
- task: Bash@3
displayName: "Final Test After Release"
inputs:
filePath: $(Build.SourcesDirectory)/node/scripts/test-npm.sh
env:
DISPLAY: ':99.0'
DESKGAP_NPM_TEST_INSTALL_WHAT: deskgap@$(DESKGAP_AP_NPM_TAG)
DESKGAP_NPM_TEST_VERSION_FILE: $(Build.SourcesDirectory)/node/VERSION