-
Notifications
You must be signed in to change notification settings - Fork 316
/
azure-pipelines.yml
501 lines (489 loc) · 17.2 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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# If you make changes to builds or artifacts, please check and update the following files if needed:
# README.md, CI/azure/prepare_assets.sh, artifact_manifest.txt.cmakein, CI/publish_deps.ps1
variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
trigger:
branches:
include:
- main
- next_stable
- dev
- libiio-v0
- staging/*
- 20*
tags:
include:
- v*
pr:
branches:
include:
- main
- next_stable
- dev
- 20*
stages:
- stage: Builds
#############################################
# Builds
#############################################
jobs:
- job: LinuxBuilds
# Host Box
pool:
vmImage: 'ubuntu-latest'
# Docker Images
strategy:
matrix:
ubuntu_20_04:
image: 'tfcollins/libiio_ubuntu_20_04-ci:latest'
artifactName: 'Linux-Ubuntu-20.04'
ubuntu_22_04:
image: 'tfcollins/libiio_ubuntu_22_04-ci:latest'
artifactName: 'Linux-Ubuntu-22.04'
fedora28:
image: 'tfcollins/libiio_fedora_28-ci:latest'
artifactName: 'Linux-Fedora-28'
fedora34:
image: 'tfcollins/libiio_fedora_34-ci:latest'
artifactName: 'Linux-Fedora-34'
debian_bullseye:
image: 'tfcollins/libiio_debian_bullseye-ci:latest'
artifactName: 'Linux-Debian-11'
debian_bookworm:
image: 'tfcollins/libiio_debian_bookworm-ci:latest'
artifactName: 'Linux-Debian-12'
opensuse_15_4:
image: 'tfcollins/libiio_opensuse_15_4-ci:latest'
artifactName: 'Linux-openSUSE-15.4'
centos_7:
image: 'tfcollins/libiio_centos_7-ci:latest'
artifactName: 'Linux-CentOS-7'
container: $[ variables['image'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true
persistCredentials: true
- script: |
set -e
mkdir build && cd build
if [ "$ARTIFACTNAME" != "Linux-CentOS-7" ]; then
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DCPP_BINDINGS=ON -DWITH_DOC=ON -DWITH_SERIAL_BACKEND=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME}
else
# CentOS 7 does not have new enough kernel headers to support modern libusb, nor libserialport, nor stdatomics.h
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DWITH_USB_BACKEND=OFF -DWITH_IIOD_USBD=OFF -DWITH_LOCAL_MMAP_API=OFF
fi
make
make package
make required2tar
displayName: 'Build'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/'
contents: '$(Agent.BuildDirectory)/s/build/?(*.deb|*.gz|*.rpm)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- script: |
cd $(Agent.BuildDirectory)/s/build/
sh generateDocumentationAndDeploy.sh
displayName: 'Documentation'
condition: eq(variables['artifactName'], 'Linux-Fedora-34')
- script: ./CI/azure/check_kernel.sh
displayName: 'Kernel check'
condition: and(eq(variables['artifactName'], 'Linux-Ubuntu-22.04'), eq(variables['Build.Reason'], 'PullRequest'))
- script: ./CI/azure/check_README_BUILD.sh
displayName: 'README_BUILD check'
condition: and(eq(variables['artifactName'], 'Linux-Ubuntu-22.04'), eq(variables['Build.Reason'], 'PullRequest'))
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
#############################################
- job: MinGWBuilds
strategy:
matrix:
MinGW_W64:
COMPILER: 'MinGW Makefiles'
artifactName: 'Windows-MinGW-W64'
pool:
vmImage: 'windows-2022'
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'
- task: PowerShell@2
displayName: 'Dependencies'
inputs:
targetType: inline
script: |
git submodule update --init
$env:PATH += ";C:\msys64\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin"
C:\msys64\usr\bin\bash.exe -c "./CI/azure/build_mingw.sh install_pacman_deps"
- task: PowerShell@2
inputs:
targetType: inline
script: |
$env:PATH += ";C:\msys64\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin"
mkdir build-mingw
cd build-mingw
C:\msys64\usr\bin\bash.exe -c "../CI/azure/build_mingw.sh build_libiio"
displayName: 'Build'
- task: CopyFiles@2
displayName: 'Copy .exe files'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-mingw/utils'
contents: '*.exe'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy public headers'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/include'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy libiio.dll, libiio.dll.a and libiio1.dll'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-mingw'
contents: |
libiio.dll
libiio.dll.a
libiio1.dll
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy .tar.gz files'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-mingw/bindings/python'
contents: '*.gz'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
displayName: 'Copy dependencies'
inputs:
targetType: 'filePath'
filePath: .\CI\publish_deps.ps1
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
#############################################
- job: WindowsBuilds
# Host Box
strategy:
matrix:
VS2022:
vmImage: 'windows-2022'
COMPILER: 'Visual Studio 17 2022'
ARCH: 'x64'
PLATFORM_TOOLSET: 'v143'
artifactName: 'Windows-VS-2022-x64'
VS2019:
vmImage: 'windows-2019'
COMPILER: 'Visual Studio 16 2019'
ARCH: 'x64'
PLATFORM_TOOLSET: 'v142'
artifactName: 'Windows-VS-2019-x64'
pool:
vmImage: $[ variables['vmImage'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'
- task: CmdLine@2
displayName: 'Build dependecies'
inputs:
script: |
git submodule update --init
.\CI\azure\windows_build_deps.cmd
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: .\CI\build_win_msvc.ps1
displayName: 'Build'
- task: CopyFiles@2
displayName: 'Copy libraries'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/Release'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy public headers'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/include'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy .exe files'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/utils/Release'
contents: '*.exe'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy .tar.gz files'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/bindings/python'
contents: '*.gz'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy libiio-sharp.dll file'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/bindings/csharp'
contents: 'libiio-sharp.dll'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy dependencies sources archive'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/'
contents: 'Windows-msvc-deps.zip'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
displayName: 'Copy dependencies'
inputs:
targetType: 'filePath'
filePath: .\CI\publish_deps.ps1
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
#############################################
- job: GenerateSetupExe
dependsOn: WindowsBuilds
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadPipelineArtifact@2
inputs:
path: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: .\CI\generate_exe.ps1
displayName: 'Generate libiio-setup.exe'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'Libiio-Setup-Exe'
#############################################
- job: macOSBuilds
# Host Box
workspace:
clean: all
strategy:
matrix:
macOS_12:
poolName: 'Azure Pipelines'
vmImage: 'macOS-12'
agentName: 'Azure Pipelines 3'
artifactName: 'macOS-12'
macOS_13_x64:
poolName: 'Azure Pipelines'
vmImage: 'macOS-13'
agentName: 'Azure Pipelines 2'
artifactName: 'macOS-13-x64'
macOS_13_arm64:
poolName: 'Default'
vmImage:
agentName: 'miniMAC_arm64'
artifactName: 'macOS-13-arm64'
pool:
name: $(poolName)
vmImage: $(vmImage)
demands:
- agent.name -equals $(agentName)
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: UsePythonVersion@0
condition: ne(variables['agentName'],'miniMAC_arm64')
inputs:
versionSpec: '3.x'
addToPath: true
- script: |
set -e
brew install doxygen libusb libxml2 ncurses cdk libserialport sphinx-doc pkg-config zstd
pip3 install sphinx setuptools
displayName: 'Dependencies'
condition: ne(variables['agentName'],'miniMAC_arm64')
- script: |
set -e
mkdir build && cd build
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=ON
make
sudo make install
cd ..
displayName: 'Build'
- script: |
set -e
mkdir build_tar && cd build_tar
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME}
make
make package
mv ../CI/azure/macos_tar_fixup.sh .
chmod +x macos_tar_fixup.sh
./macos_tar_fixup.sh
cd ..
displayName: 'Build tar'
- script: |
set -e
cd build
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_SERIAL_BACKEND=ON
make
cd ..
displayName: 'Build With Doc'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/'
contents: '$(Agent.BuildDirectory)/s/build/?(*.pkg)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build_tar/'
contents: '$(Agent.BuildDirectory)/s/build_tar/?(*.gz)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
#############################################
- job: ARMBuilds
# Host Box
pool:
vmImage: "ubuntu-latest"
# Docker Images
strategy:
matrix:
ubuntu-ppc64le:
image: tfcollins/libiio_ubuntu_20_04-ci-arm-ppc:latest
arch: ppc64le
build_script: ci-ubuntu.sh
artifactName: 'Ubuntu-ppc64le'
ubuntu-x390x:
image: tfcollins/libiio_ubuntu_20_04-ci-arm-ppc:latest
arch: s390x
build_script: ci-ubuntu.sh
artifactName: 'Ubuntu-x390x'
ubuntu-arm64v8:
image: tfcollins/libiio_ubuntu_20_04-ci-arm-ppc:latest
arch: aarch64
build_script: ci-ubuntu.sh
artifactName: 'Ubuntu-arm64v8'
ubuntu-arm32v7:
image: tfcollins/libiio_ubuntu_20_04-ci-arm-ppc:latest
arch: arm
build_script: ci-ubuntu.sh
artifactName: 'Ubuntu-arm32v7'
debian_bookworm:
image: tfcollins/libiio_debian_bookworm-ci-arm-ppc:latest
arch: arm
build_script: ci-ubuntu.sh
artifactName: 'Debian12-arm'
steps:
- script: |
set -e
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
sudo apt-get install -y g++-arm-linux-gnueabihf
sudo apt-get install -y g++-aarch64-linux-gnu
sudo apt-get install -y qemu-system-ppc64
sudo apt-get install qemu
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
displayName: 'Setup'
- script: |
set -e
sudo docker run --platform "linux/$(arch)" --rm -t --privileged -e ARTIFACTNAME=$(artifactName) -v "$(Agent.BuildDirectory)/s":"/ci" -v "/usr/bin/qemu-$(arch)-static":"/usr/bin/qemu-$(arch)-static" "$(image)" /bin/bash -c "cd /ci/ && chmod +x ./CI/azure/$(build_script) && ./CI/azure/$(build_script)"
displayName: 'Build'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/'
contents: '$(Agent.BuildDirectory)/s/build/?(*.deb|*.gz)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
#############################################
- stage: ManageArtifacts
dependsOn: Builds
#############################################
# Deploy
#############################################
jobs:
- job: CheckArtifacts
condition: and(succeeded(), or(eq(variables.isMain, true), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')))
# Host Box
pool:
vmImage: 'ubuntu-latest'
# Docker Images
strategy:
matrix:
ubuntu_20_04:
image: 'tfcollins/libiio_ubuntu_20_04-ci:latest'
artifactName: 'Check artifacts'
container: $[ variables['image'] ]
steps:
- script: |
set -e
mkdir build && cd build
cmake ..
mkdir artifacts
displayName: 'Build artifact manifest'
- task: DownloadPipelineArtifact@2
inputs:
path: '$(Agent.BuildDirectory)/s/build/artifacts'
- script: ./CI/azure/prepare_assets.sh check
displayName: 'Check files'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/'
contents: 'artifact_manifest.txt'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'Artifact manifest'
#############################################
- job: PushToSWDownloads
dependsOn: CheckArtifacts
condition: and(succeeded(), eq(variables.isMain, true))
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
inputs:
path: '$(Build.ArtifactStagingDirectory)'
- bash: ./CI/azure/prepare_assets.sh swdownloads
displayName: "Prepare artifacts for SWDownloads"
- task: DownloadSecureFile@1
name: key
displayName: 'Download rsa key'
inputs:
secureFile: 'id_rsa'
- bash: chmod 600 $(key.secureFilePath) ; scp -2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o HostKeyAlgorithms=+ssh-dss -i $(key.secureFilePath) -r /home/vsts/work/1/a/* $MAPPED_VAR
env:
MAPPED_VAR: $(SERVER_ADDRESS)
displayName: 'Push artifacts to SW Downloads'
##############################################
- job: PushToGithubRelease
dependsOn: CheckArtifacts
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
inputs:
path: '$(Build.ArtifactStagingDirectory)'
- bash: ./CI/azure/prepare_assets.sh release
displayName: 'Prepare assets for release'
- task: GithubRelease@0
displayName: 'Attach artifacts to GitHub Release'
inputs:
gitHubConnection: libiio-release
repositoryName: $(Build.Repository.Name)
action: create
target: $(Build.SourceVersion)
tag: $(Build.SourceBranchName)
title: "Libiio release $(Build.SourceBranchName)"
assets: $(Build.ArtifactStagingDirectory)/*
addChangeLog: true
isDraft: true