-
Notifications
You must be signed in to change notification settings - Fork 31
/
azure-pipelines.yml
273 lines (267 loc) · 8.92 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
variables:
IS_PULL_REQUEST: ${{ eq('$(Build.Reason)', 'PullRequest') }}
BRANCH_NAME: $(Build.SourceBranchName)
REPO_SLUG: $(Build.Repository.Name)
CURRENT_COMMIT: $(Build.SourceVersion)
trigger:
branches:
include:
- main
- master
- staging/*
- v*.*.*
- ci-*
tags:
include:
- v*
pr:
branches:
include:
- main
- master
parameters:
- name: pythonVersions
type: object
default:
- '3.10'
- 3.9
- 3.8
- 3.7
stages:
- stage: Builds
jobs:
- job: LinuxBuilds
strategy:
matrix:
ubuntu_18_04_x86_64:
imageName: 'ubuntu-latest'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: bionic
artifactName: 'Linux-Ubuntu-18.04-x86_64'
PACKAGE_TO_INSTALL: 'build/*.deb'
pythonVersion: 3.8
ubuntu_20_04_x86_64:
imageName: 'ubuntu-latest'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: focal
artifactName: 'Linux-Ubuntu-20.04-x86_64'
PACKAGE_TO_INSTALL: 'build/*.deb'
pythonVersion: 3.8
Bionic_doxygen:
imageName: 'ubuntu-18.04'
pythonVersion: 3.8
OS_TYPE: 'doxygen'
OS_VERSION: bionic
artifactName: 'Linux-Ubuntu-18.04-doxygen'
pool:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
- checkout: self
fetchDepth: 10
clean: true
persistCredentials: true
- script: ./CI/travis/before_install_linux.sh
displayName: "Install dependencies"
- script: ./CI/travis/make_linux.sh
displayName: "Build"
- script: ./CI/travis/before_deploy_linux.sh
displayName: "Before deploy linux"
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/'
contents: '$(Agent.BuildDirectory)/s/build/?(*.deb|*.rpm)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
- job: macOSBuilds
strategy:
matrix:
macOS_10_15:
imageName: 'macOS-10.15'
artifactName: 'macOS-10.15'
macOS_11:
imageName: 'macOS-11'
artifactName: 'macOS-11'
pool:
vmImage: $(imageName)
steps:
- checkout: self
fetchDepth: 10
clean: true
- script: ./CI/travis/before_install_darwin.sh
displayName: "Install Dependencies"
- script: ./CI/travis/make_darwin.sh
displayName: "Build"
- ${{ each pyVersion in parameters.pythonVersions }}:
- task: UsePythonVersion@0
displayName: Use Python ${{ pyVersion }}
inputs:
versionSpec: ${{ pyVersion }}
- script: |
uname -a
python3 --version
python3 -m pip install wheel twine build virtualenv cython
cd '$(Agent.BuildDirectory)/s/build'
mkdir -p $(Agent.BuildDirectory)/s/build/wheelhouse
python3 -m build
cp dist/*.whl $(Agent.BuildDirectory)/s/build/wheelhouse
cd $(Agent.BuildDirectory)/s/build/
displayName: Wheel Python ${{ pyVersion }}
- script: ./CI/travis/before_deploy_darwin.sh
displayName: "Before deploy"
- 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: PublishPipelineArtifact@1
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
- script: |
python -m pip install --upgrade pip twine
python -m twine upload --repository "testpypi" '$(Agent.BuildDirectory)/s/build/wheelhouse/*.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
strategy:
matrix:
VS2019_Win32:
imageName: 'windows-2019'
COMPILER: 'Visual Studio 16 2019'
ARCH: 'Win32'
artifactName: 'Windows-VS-16-2019-Win32'
pyArch: 'x86'
VS2019_Win64:
imageName: 'windows-2019'
COMPILER: 'Visual Studio 16 2019'
ARCH: 'x64'
artifactName: 'Windows-VS-16-2019-x64'
pyArch: 'x64'
pool:
vmImage: $[ variables['imageName'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: UsePythonVersion@0
displayName: Use Python 3.10
inputs:
versionSpec: '3.10'
architecture: $(pyArch)
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: .\CI\install_deps_win.ps1
displayName: Dependencies
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: .\CI\build_win.ps1
displayName: Build
- task: CopyFiles@2
displayName: 'Copy libraries'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/src'
contents: 'libsmu.*'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy smu.exe'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/src/cli/Release'
contents: 'smu.exe'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy examples'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/examples/Release'
contents: '*.exe'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy tests'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/tests/Release'
contents: '*.exe'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy tests script'
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/tests'
contents: 'run-tests.bat'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
displayName: 'Copy dependencies'
inputs:
targetType: 'filePath'
filePath: .\CI\publish_deps.ps1
- ${{ each pyVersion in parameters.pythonVersions }}:
- task: UsePythonVersion@0
displayName: Use Python ${{ pyVersion }}
inputs:
versionSpec: ${{ pyVersion }}
architecture: $(pyArch)
- script: |
python3 --version
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine build virtualenv cython six
cd $(Agent.BuildDirectory)\s\build
python3 -m build
displayName: Wheel Python ${{ pyVersion }}
- task: CopyFiles@2
inputs:
sourceFolder: '$(Agent.BuildDirectory)/s/build/dist/'
contents: '$(Agent.BuildDirectory)/s/build/dist/?(*.whl)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
- script: |
python -m pip install --upgrade pip twine
python -m twine upload --repository "testpypi" '$(Agent.BuildDirectory)/s/build/dist/*.whl'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
displayName: "Upload to PyPI"
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: $(TWINE_PASSWORD)
- stage: PushArtifacts
dependsOn: Builds
jobs:
- job: GenerateSetupExe
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')))
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadPipelineArtifact@2
inputs:
path: '$(Build.ArtifactStagingDirectory)\Windows-VS-16-2019-Win32'
artifact: 'Windows-VS-16-2019-Win32'
- task: DownloadPipelineArtifact@2
inputs:
path: '$(Build.ArtifactStagingDirectory)\Windows-VS-16-2019-x64'
artifact: 'Windows-VS-16-2019-x64'
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: .\CI\generate_exe.ps1
displayName: "Generate libsmu setup for 32bit and 64bit"
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'Windows-VS-16-2019-setup'