forked from analogdevicesinc/libm2k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
168 lines (163 loc) · 5.06 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
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)
trigger:
- main
- master
- staging/*
- 20*
- v*.*.*
- ci-*
pr:
- main
- master
- 20*
parameters:
- name: pythonVersions
type: object
default:
- '3.10'
- 3.9
- 3.8
- 3.7
jobs:
- job: LinuxBuilds
strategy:
matrix:
ubuntu_18_04:
imageName: 'ubuntu-18.04'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: bionic
artifactName: 'Linux-Ubuntu-18.04'
PACKAGE_TO_INSTALL: 'build/*.deb'
ubuntu_20_04:
imageName: 'ubuntu-20.04'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: focal
artifactName: 'Linux-Ubuntu-20.04'
PACKAGE_TO_INSTALL: 'build/*.deb'
ubuntu_22_04:
imageName: 'ubuntu-22.04'
OS_TYPE: 'ubuntu_docker'
OS_VERSION: jammy
artifactName: 'Linux-Ubuntu-22.04'
PACKAGE_TO_INSTALL: 'build/*.deb'
deploy_doxygen:
imageName: 'ubuntu-20.04'
OS_TYPE: 'doxygen'
OS_VERSION: focal
artifactName: 'Linux-Ubuntu-20.04'
PACKAGE_TO_INSTALL: 'build/*.deb'
pool:
vmImage: $(imageName)
steps:
- checkout: self
fetchDepth: 1
clean: true
persistCredentials: true
- task: DownloadPipelineArtifact@2
displayName: 'Get libiio artifacts'
inputs:
source: 'specific'
project: '$(AnalogDevices_OpenSource_GUID)'
pipeline: $(libiioPipelineId)
artifact: '$(artifactName)'
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
path: '$(Agent.BuildDirectory)/s/build/'
- script: ./CI/travis/before_install_linux
displayName: "Install Dependencies"
- script: ./CI/travis/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/?(*.deb|*.rpm)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne(variables['System.JobName'], 'deploy_doxygen'))
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(artifactName)'
- job: macOSBuilds
strategy:
matrix:
macOS_11:
imageName: 'macOS-11'
artifactName: 'macOS-11'
macOS_12:
imageName: 'macOS-12'
artifactName: 'macOS-12'
pool:
vmImage: $(imageName)
variables:
PACKAGE_TO_INSTALL: 'build/*.pkg'
steps:
- checkout: self
fetchDepth: 1
clean: true
- task: DownloadPipelineArtifact@2
displayName: 'Get libiio artifacts'
inputs:
source: 'specific'
project: '$(AnalogDevices_OpenSource_GUID)'
pipeline: $(libiioPipelineId)
artifact: '$(artifactName)'
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
path: '$(Agent.BuildDirectory)/s/build/'
- script: ./CI/travis/before_install_darwin
displayName: "Install Dependencies"
- script: ./CI/travis/make_darwin
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: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
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)