-
Notifications
You must be signed in to change notification settings - Fork 32
/
azure-pipelines.yml
260 lines (247 loc) · 7.94 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
variables:
libiioPipelineId: 9
PYTHON: python
PIP: pip
AnalogDevices_OpenSource_GUID: '02a28b00-b3c8-4fdf-af9c-c2460499147f'
IS_PULL_REQUEST: ${{ eq('$(Build.Reason)', 'PullRequest') }}
BRANCH_NAME: $(Build.SourceBranchName)
REPO_SLUG: $(Build.Repository.Name)
CURRENT_COMMIT: $(Build.SourceVersion)
LIBIIO_VERSION: 'libiio-v0'
GLOG_VERSION: 'v0.4.0'
trigger:
- main
- master
- staging/*
- 20*
- v*.*.*
- ci-*
pr:
- main
- master
- 20*
parameters:
- name: pythonVersions
type: object
default:
- 3.11
- '3.10'
- 3.9
- 3.8
- 3.7
jobs:
- job: LinuxBuilds
strategy:
matrix:
ubuntu_20_04:
imageName: 'ubuntu-20.04'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: focal
artifactName: 'Linux-Ubuntu-20.04'
ubuntu_22_04:
imageName: 'ubuntu-22.04'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: jammy
artifactName: 'Linux-Ubuntu-22.04'
deploy_doxygen:
imageName: 'ubuntu-20.04'
OS_TYPE: 'doxygen'
OS_VERSION: focal
artifactName: 'Linux-Ubuntu-20.04'
pool:
vmImage: $(imageName)
steps:
- checkout: self
fetchDepth: 1
clean: true
persistCredentials: true
- script: ./CI/ubuntu/install_deps
displayName: "Install Dependencies"
- task: CopyFiles@2
condition: ne(variables['System.JobName'], 'deploy_doxygen')
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build/'
contents: '$(Agent.BuildDirectory)/s/libiio/build/?(*.deb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- script: ./CI/ubuntu/make_linux
displayName: "Build"
- task: CopyFiles@2
condition: ne(variables['System.JobName'], 'deploy_doxygen')
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/'
contents: '$(Agent.BuildDirectory)/s/build/?(libm2k*.deb|libm2k*.rpm)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
condition: and(succeeded(), ne(variables['System.JobName'], 'deploy_doxygen'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
- job: macOSBuilds
workspace:
clean: all
strategy:
matrix:
macOS_12:
poolName: 'Azure Pipelines'
vmImage: 'macOS-12'
artifactName: 'macOS-12'
macOS_13_x64:
poolName: 'Azure Pipelines'
vmImage: 'macOS-13'
artifactName: 'macOS-13-x64'
macOS_14_x64:
poolName: 'Azure Pipelines'
vmImage: 'macOS-14'
artifactName: 'macOS-14-x64'
# TODO: discuss with DevOps team how to setup ARM agent
# macOS_13_arm64:
# poolName: 'Default'
# vmImage:
# agentName: 'macOS_arm64'
# artifactName: 'macOS-13-arm64'
pool:
name: $(poolName)
vmImage: $(vmImage)
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
addToPath: true
- script: ./CI/macOS/install_deps
displayName: "Install Dependencies"
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build/'
contents: '$(Agent.BuildDirectory)/s/libiio/build/?(*.pkg)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build_tar/'
contents: '$(Agent.BuildDirectory)/s/libiio/build_tar/?(*.tar.gz)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- script: ./CI/macOS/make_macOS
displayName: "Build"
- ${{ each pyVersion in parameters.pythonVersions }}:
- task: UsePythonVersion@0
displayName: Use Python ${{ pyVersion }}
inputs:
versionSpec: '${{ pyVersion }}'
- script: |
python3 --version
python3 -m pip install wheel twine build virtualenv
cd '$(Agent.BuildDirectory)/s/build/'
mkdir -p wheelhouse
export COMPILE_BINDINGS=True
python3 -m build
export COMPILE_BINDINGS=
cp dist/*.whl wheelhouse
displayName: Wheel Python ${{ pyVersion }}
- 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/'
contents: '$(Agent.BuildDirectory)/s/build/wheelhouse/?(*.whl)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build_tar/'
contents: '$(Agent.BuildDirectory)/s/build_tar/?(*.tar.gz)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
condition: succeeded()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
- script: |
python -m pip install --upgrade pip twine
cd '$(Agent.BuildDirectory)/s/build/wheelhouse/'
python -m twine upload --repository "testpypi" *.whl
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
displayName: "Upload to PyPI"
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: $(TWINE_PASSWORD)
- job: WindowsBuilds
workspace:
clean: all
strategy:
matrix:
VS_2022:
poolName: 'Azure Pipelines'
vmImage: 'windows-2022'
COMPILER: 'Visual Studio 17 2022'
ARCH: 'x64'
PLATFORM: 'win64'
artifactName: 'Windows-VS-2022-x64'
VS_2019:
poolName: 'Azure Pipelines'
vmImage: 'windows-2019'
COMPILER: 'Visual Studio 16 2019'
ARCH: 'x64'
PLATFORM: 'win64'
artifactName: 'Windows-VS-2019-x64'
pool:
vmImage: $[ variables['vmImage'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- task: PowerShell@2
displayName: 'Install Dependencies'
inputs:
targetType: filePath
filePath: ./CI/windows/install_deps.ps1
- task: PowerShell@2
displayName: "Build libm2k"
inputs:
targetType: 'filePath'
filePath: ./CI/windows/make_windows.ps1
- ${{ each pyVersion in parameters.pythonVersions }}:
- task: UsePythonVersion@0
displayName: Use Python ${{ pyVersion }}
inputs:
versionSpec: '${{ pyVersion }}'
- powershell: |
$SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY
$OUTSIDE_BUILD = $SRC_DIR.Parent.FullName
$BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$env:PLATFORM"
$TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$env:PLATFORM"
Set-Location $TEMP_BUILD_DIR
python.exe -m pip install --user --upgrade pip setuptools wheel twine build virtualenv
$env:COMPILE_BINDINGS = $true
python.exe -m build
Remove-Item Env:COMPILE_BINDINGS
Copy-Item -Path "dist/libm2k*.whl" -Destination (Join-Path $BUILD_DIR "dist")
Set-Location $SRC_DIR
displayName: Wheel Python ${{ pyVersion }}
- task: PowerShell@2
displayName: 'Create libm2k-system-setup installer'
condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022'))
inputs:
targetType: 'filePath'
filePath: ./CI/windows/create_installer.ps1
- task: PublishPipelineArtifact@1
condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/installer'
artifactName: 'Libm2k-System-Setup-Exe'
- task: PowerShell@2
displayName: "Create ZIPs"
inputs:
targetType: 'filePath'
filePath: ./CI/windows/create_zips.ps1
- task: PublishPipelineArtifact@1
condition: succeeded()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/libm2k-$(PLATFORM)'
artifactName: '$(artifactName)'