forked from HaxeFoundation/haxe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
315 lines (303 loc) · 12.5 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
variables:
- group: variables-haxe
- name: AZURE_PIPELINES_REPO_URL
value: $(Build.Repository.Uri)
- name: AZURE_PIPELINES_BRANCH
value: $(Build.SourceBranchName)
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
stages:
- stage: StageTest
jobs:
- template: extra/azure-pipelines/build-linux.yml
parameters:
name: BuildLinux
- template: extra/azure-pipelines/build-mac.yml
parameters:
name: BuildMac
- template: extra/azure-pipelines/build-windows.yml
parameters:
name: BuildWin64
arch: '64'
- template: extra/azure-pipelines/build-windows.yml
parameters:
name: BuildWin32
arch: '32'
- job: TestLinux
dependsOn: BuildLinux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
macro:
TEST: macro
neko:
TEST: neko
hl:
TEST: hl
APT_PACKAGES: cmake ninja-build
cpp:
TEST: cpp
HXCPP_COMPILE_CACHE: ~/hxcache
APT_PACKAGES: gcc-multilib g++-multilib
java:
TEST: java,jvm
cs:
TEST: cs
js:
TEST: js
SAUCE: 1
SAUCE_TUNNEL_ID: $(Agent.JobName)
SAUCE_BUILD: $(Build.BuildNumber)
php:
TEST: php
flash:
TEST: flash9
APT_PACKAGES: libglib2.0 libfreetype6 xvfb
DISPLAY: ':99.0'
AUDIODEV: 'null'
python:
TEST: python
lua:
TEST: lua
APT_PACKAGES: ncurses-dev
steps:
- checkout: self
fetchDepth: 20
- template: extra/azure-pipelines/install-neko-snapshot.yaml
parameters:
platform: linux64
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'linuxBinaries'
targetPath: linuxBinaries
- script: |
set -ex
tar -xf linuxBinaries/*_bin.tar.gz -C linuxBinaries --strip-components=1
sudo mkdir -p /usr/local/bin/
sudo mkdir -p /usr/local/share/haxe/
sudo ln -s `pwd`/linuxBinaries/haxe /usr/local/bin/haxe
sudo ln -s `pwd`/linuxBinaries/haxelib /usr/local/bin/haxelib
sudo ln -s `pwd`/linuxBinaries/std /usr/local/share/haxe/std
displayName: Setup Haxe
- script: haxe -version
displayName: Print Haxe version
- script: |
set -ex
mkdir ~/haxelib
haxelib setup ~/haxelib
displayName: Setup haxelib
- script: |
set -ex
sudo apt update -qqy
sudo apt install -qqy $APT_PACKAGES
condition: and(succeeded(), variables['APT_PACKAGES'])
displayName: Install apt packages
- script: haxe RunCi.hxml
condition: and(succeeded(), not(and(variables['SAUCE'], variables['SAUCE_ACCESS_KEY'])))
workingDirectory: $(Build.SourcesDirectory)/tests
displayName: Test
- script: haxe RunCi.hxml
condition: and(succeeded(), variables['SAUCE'], variables['SAUCE_ACCESS_KEY'])
workingDirectory: $(Build.SourcesDirectory)/tests
env:
SAUCE_ACCESS_KEY: $(SAUCE_ACCESS_KEY)
displayName: Test (with SauceLabs)
- job: TestMac
dependsOn: BuildMac
pool:
vmImage: 'macOS-10.13'
strategy:
matrix:
macro:
TEST: macro
neko:
TEST: neko
hl:
TEST: hl
BREW_PACKAGES: ninja
cpp:
TEST: cpp
HXCPP_COMPILE_CACHE: ~/hxcache
java:
TEST: java,jvm
cs:
TEST: cs
js:
TEST: js
php:
TEST: php
flash:
TEST: flash9
python:
TEST: python
lua:
TEST: lua
steps:
- checkout: self
fetchDepth: 20
- template: extra/azure-pipelines/install-neko-snapshot.yaml
parameters:
platform: mac
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'macBinaries'
targetPath: macBinaries
- script: |
set -ex
tar -xf macBinaries/*_bin.tar.gz -C macBinaries --strip-components=1
sudo mkdir -p /usr/local/bin/
sudo mkdir -p /usr/local/share/haxe/
sudo ln -s `pwd`/macBinaries/haxe /usr/local/bin/haxe
sudo ln -s `pwd`/macBinaries/haxelib /usr/local/bin/haxelib
sudo ln -s `pwd`/macBinaries/std /usr/local/share/haxe/std
displayName: Setup Haxe
- script: haxe -version
displayName: Print Haxe version
- script: |
set -ex
mkdir ~/haxelib
haxelib setup ~/haxelib
displayName: Setup haxelib
- script: brew install $BREW_PACKAGES
condition: and(succeeded(), variables['BREW_PACKAGES'])
displayName: Install homebrew packages
- script: haxe RunCi.hxml
workingDirectory: $(Build.SourcesDirectory)/tests
displayName: Test
- template: extra/azure-pipelines/test-windows.yml
parameters:
name: TestWin64
arch: '64'
- template: extra/azure-pipelines/test-windows.yml
parameters:
name: TestWin32
arch: '32'
- stage: StageDeploy
condition: and(succeeded(), not(variables['System.PullRequest.PullRequestId']))
jobs:
- job: S3
condition: and(succeeded(), variables['HXBUILDS_AWS_ACCESS_KEY_ID'], variables['HXBUILDS_S3ADDR'])
pool:
vmImage: 'ubuntu-16.04'
steps:
- checkout: self
fetchDepth: 20
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'linuxBinaries'
targetPath: linuxBinaries
displayName: Download linuxBinaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'macBinaries'
targetPath: macBinaries
displayName: Download macBinaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'win64Binaries'
targetPath: win64Binaries
displayName: Download win64Binaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'win32Binaries'
targetPath: win32Binaries
displayName: Download win32Binaries
- template: extra/azure-pipelines/install-neko-snapshot.yaml
parameters:
platform: linux64
- script: |
set -ex
tar -xf linuxBinaries/*_bin.tar.gz -C linuxBinaries --strip-components=1
sudo mkdir -p /usr/local/bin/
sudo mkdir -p /usr/local/share/haxe/
sudo ln -s `pwd`/linuxBinaries/haxe /usr/local/bin/haxe
sudo ln -s `pwd`/linuxBinaries/haxelib /usr/local/bin/haxelib
sudo ln -s `pwd`/linuxBinaries/std /usr/local/share/haxe/std
displayName: Setup Haxe
- script: |
set -ex
sudo apt-get update -qqy
sudo apt-get install -qqy awscli
displayName: "Install awscli"
- script: |
set -ex
COMMIT_HASH=`git rev-parse HEAD`
COMMIT_HASH_SHORT=${COMMIT_HASH:0:7}
COMMIT_DATE=`TZ=UTC git show --quiet --date='format-local:%Y-%m-%d' --format="%cd"`
FILE_NAME=haxe_${COMMIT_DATE}_$(Build.SourceBranchName)_${COMMIT_HASH_SHORT}
aws s3 cp linuxBinaries/*_bin.tar.gz $(HXBUILDS_S3ADDR)/haxe/linux64/${FILE_NAME}.tar.gz
aws s3 cp macBinaries/*_bin.tar.gz $(HXBUILDS_S3ADDR)/haxe/mac/${FILE_NAME}.tar.gz
aws s3 cp macBinaries/*_installer.tar.gz $(HXBUILDS_S3ADDR)/haxe/mac-installer/${FILE_NAME}.tar.gz
aws s3 cp win64Binaries/*_bin.zip $(HXBUILDS_S3ADDR)/haxe/windows64/${FILE_NAME}.zip
aws s3 cp win64Binaries/*_installer.zip $(HXBUILDS_S3ADDR)/haxe/windows64-installer/${FILE_NAME}.zip
aws s3 cp win64Binaries/*.nupkg $(HXBUILDS_S3ADDR)/haxe/windows64-choco/
aws s3 cp win32Binaries/*_bin.zip $(HXBUILDS_S3ADDR)/haxe/windows/${FILE_NAME}.zip
aws s3 cp win32Binaries/*_installer.zip $(HXBUILDS_S3ADDR)/haxe/windows-installer/${FILE_NAME}.zip
aws s3 cp win32Binaries/*.nupkg $(HXBUILDS_S3ADDR)/haxe/windows-choco/
env:
AWS_ACCESS_KEY_ID: $(HXBUILDS_AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(HXBUILDS_AWS_SECRET_ACCESS_KEY)
displayName: Upload binaries
- script: |
set -ex
aws s3 cp linuxBinaries/*_bin.tar.gz $(HXBUILDS_S3ADDR)/haxe/linux64/haxe_latest.tar.gz
aws s3 cp macBinaries/*_bin.tar.gz $(HXBUILDS_S3ADDR)/haxe/mac/haxe_latest.tar.gz
aws s3 cp macBinaries/*_installer.tar.gz $(HXBUILDS_S3ADDR)/haxe/mac-installer/haxe_latest.tar.gz
aws s3 cp win64Binaries/*_bin.zip $(HXBUILDS_S3ADDR)/haxe/windows64/haxe_latest.zip
aws s3 cp win64Binaries/*_installer.zip $(HXBUILDS_S3ADDR)/haxe/windows64-installer/haxe_latest.zip
aws s3 cp win32Binaries/*_bin.zip $(HXBUILDS_S3ADDR)/haxe/windows/haxe_latest.zip
aws s3 cp win32Binaries/*_installer.zip $(HXBUILDS_S3ADDR)/haxe/windows-installer/haxe_latest.zip
# Chocolatey packages have to be named with version number,
# so let's use web redirection to keep the original file name.
[[ "$HXBUILDS_S3ADDR" =~ s3://([^/]+)(.*) ]] && HXBUILDS_S3BUCKET="${BASH_REMATCH[1]}" && HXBUILDS_S3PATH="${BASH_REMATCH[2]}"
[[ `echo win64Binaries/*.nupkg` =~ win64Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
aws s3 cp $(HXBUILDS_S3ADDR)/haxe/windows64-choco/${FILE_NAME} $(HXBUILDS_S3ADDR)/haxe/windows64-choco/haxe_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows64-choco/${FILE_NAME}"
[[ `echo win32Binaries/*.nupkg` =~ win32Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
aws s3 cp $(HXBUILDS_S3ADDR)/haxe/windows-choco/${FILE_NAME} $(HXBUILDS_S3ADDR)/haxe/windows-choco/haxe_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows-choco/${FILE_NAME}"
env:
AWS_ACCESS_KEY_ID: $(HXBUILDS_AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(HXBUILDS_AWS_SECRET_ACCESS_KEY)
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development'))
displayName: Update "latest"
- job: ApiHaxeOrg
condition: and(succeeded(), variables['GHP_USERNAME'], variables['GHP_EMAIL'])
pool:
vmImage: 'ubuntu-16.04'
steps:
- checkout: none
- template: extra/azure-pipelines/install-neko-snapshot.yaml
parameters:
platform: linux64
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'linuxBinaries'
targetPath: linuxBinaries
displayName: Download linuxBinaries
- script: |
set -ex
tar -xf linuxBinaries/*_bin.tar.gz -C linuxBinaries --strip-components=1
sudo mkdir -p /usr/local/bin/
sudo mkdir -p /usr/local/share/haxe/
sudo ln -s `pwd`/linuxBinaries/haxe /usr/local/bin/haxe
sudo ln -s `pwd`/linuxBinaries/haxelib /usr/local/bin/haxelib
sudo ln -s `pwd`/linuxBinaries/std /usr/local/share/haxe/std
displayName: Setup Haxe
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'xmldoc'
targetPath: xmldoc
displayName: Download xmldoc
- script: |
set -ex
LOCAL="`pwd`/extra/api.haxe.org"
git clone "${GHP_REMOTE}" "${LOCAL}"
haxe --cwd "${LOCAL}" --run ImportXml "`pwd`/xmldoc"
env:
GHP_REMOTE: $(GHP_REMOTE)
displayName: Deploy to api.haxe.org