forked from NordicSemiconductor/pc-ble-driver-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
208 lines (204 loc) · 6.83 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
trigger:
- master
- release/*
jobs:
# Linux
- job: Linux
variables:
wheel_platform: 'manylinux2010_x86_64'
pool:
vmImage: 'ubuntu-18.04'
steps:
- task: Docker@2
displayName: 'Build ManyLinux wheel'
inputs:
containerRegistry: acr-nrfprivateeu
command: run
arguments: '--rm -e PLAT=$(wheel_platform) -v $(System.DefaultWorkingDirectory):/data nrfwayland.azurecr.io/nrf/projects-pc-ble-driver-py-linux:v3 /build/build-wheels.sh'
- bash: |
set -o errexit -o pipefail
ls -R wheelhouse
cp --verbose -R wheelhouse/*.whl "$(Build.ArtifactStagingDirectory)"
displayName: 'Copy wheels'
- task: GitHubRelease@0
inputs:
gitHubConnection: 'waylandCI'
repositoryName: 'NordicSemiconductor/pc-ble-driver-py'
action: 'edit'
tagSource: 'Git tag'
tag: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
isDraft: 'true'
addChangeLog: 'false'
condition: ne(variables['Build.Reason'], 'PullRequest')
# macOS
- job: macOS
variables:
VCPKG_ROOT: '$(Agent.HomeDirectory)/vcpkg'
python_arch: 'x64'
strategy:
matrix:
py36:
python_version: '3.6.8'
python_bin: '3.6'
py37:
python_version: '3.7.5'
python_bin: '3.7'
py38:
python_version: '3.8.0'
python_bin: '3.8'
pool:
vmImage: 'macos-10.15'
steps:
- script: |
set -o errexit -o pipefail
ls /Applications
sudo xcode-select -s /Applications/Xcode_11.app
displayName: 'Install XCode'
- script: |
brew install swig gcc@6
displayName: 'Install gcc and swig'
- script: |
set -o errexit -o pipefail
git clone https://github.com/NordicPlayground/vcpkg.git $(VCPKG_ROOT)
CC=gcc-6 CXX=g++-6 $(VCPKG_ROOT)/bootstrap-vcpkg.sh
displayName: 'Install vcpkg'
- script: |
set -o errexit -o pipefail
export PATH=$VCPKG_ROOT:$PATH
export VCPKG_OSX_DEPLOYMENT_TARGET=10.9
vcpkg install nrf-ble-driver:$(python_arch)-osx
displayName: 'Install nrf-ble-driver'
- bash: |
set -o errexit -o pipefail
wget https://www.python.org/ftp/python/$(python_version)/python-$(python_version)-macosx10.9.pkg
sudo installer -pkg python-$(python_version)-macosx10.9.pkg -target /
displayName: 'Install all pythons'
- bash: |
set -o errexit -o pipefail
rm -rf _skbuild
pypath=`which python$(python_bin)`
${pypath} -m pip install -r requirements-dev.txt
${pypath} setup.py bdist_wheel --build-type Release -- -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
displayName: 'Build for python$(python_bin)'
- bash: |
cp -R dist/*.whl "$(Build.ArtifactStagingDirectory)"
displayName: 'Copy artifacts'
- task: GitHubRelease@0
inputs:
gitHubConnection: 'waylandCI'
repositoryName: 'NordicSemiconductor/pc-ble-driver-py'
action: 'edit'
tagSource: 'Git tag'
tag: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
isDraft: 'true'
addChangeLog: 'false'
condition: ne(variables['Build.Reason'], 'PullRequest')
# Windows
- job: Windows
variables:
VCPKG_ROOT: '$(Agent.HomeDirectory)\vcpkg'
strategy:
matrix:
py36_win64:
python_version: '3.6'
python_lib: '36'
python_arch: 'x64'
generator: 'Visual Studio 15 2017 Win64'
py36_win32:
python_version: '3.6'
python_lib: '36'
python_arch: 'x86'
generator: 'Visual Studio 15 2017'
py37_win64:
python_version: '3.7'
python_lib: '37'
python_arch: 'x64'
generator: 'Visual Studio 15 2017 Win64'
py37_win32:
python_version: '3.7'
python_lib: '37'
python_arch: 'x86'
generator: 'Visual Studio 15 2017'
py38_win64:
python_version: '3.8'
python_lib: '38'
python_arch: 'x64'
generator: 'Visual Studio 15 2017 Win64'
py38_win32:
python_version: '3.8'
python_lib: '38'
python_arch: 'x86'
generator: 'Visual Studio 15 2017'
pool:
vmImage: 'vs2017-win2016'
steps:
- script: |
choco install -y --x86 swig
displayName: 'Install toolchain on Windows'
- script: |
git clone https://github.com/NordicPlayground/vcpkg.git $(VCPKG_ROOT)
$(VCPKG_ROOT)\bootstrap-vcpkg.bat
displayName: 'Install vcpkg'
- script: |
set PATH=$(VCPKG_ROOT);%PATH%
vcpkg install nrf-ble-driver:$(python_arch)-windows
displayName: 'Install nrf-ble-driver'
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python_version)'
architecture: '$(python_arch)'
- bash: |
set -o errexit -o pipefail
rm -rf _skbuild
pypath=`which python`
pyroot=`dirname ${pypath}`
pyheader=`ls ${pyroot}/include/Python.h`
pyincldir=`dirname ${pyheader}`
pylib=`ls ${pyroot}/libs/python$(python_lib).lib`
pip install -r requirements-dev.txt
python setup.py bdist_wheel --build-type Release -- -DPYTHON_INCLUDE_DIR=${pyincldir} -DPYTHON_LIBRARY=${pylib} -G "$(generator)"
displayName: 'Build for python $(python_version)'
- bash: |
for f in dist/*; do mv "${f}" "${f/cp38m/cp38}"; done;
cp -R dist/*.whl "$(Build.ArtifactStagingDirectory)"
displayName: 'Copy artifacts'
- task: GitHubRelease@0
inputs:
gitHubConnection: 'waylandCI'
repositoryName: 'NordicSemiconductor/pc-ble-driver-py'
action: 'edit'
tagSource: 'Git tag'
tag: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
isDraft: 'true'
addChangeLog: 'false'
condition: ne(variables['Build.Reason'], 'PullRequest')
- job: TriggerTest
dependsOn: [
Windows,
Linux,
macOS,
]
strategy:
matrix:
linux:
osType: 'linux'
mac:
osType: 'mac'
win64:
osType: 'win64'
win32:
osType: 'win32'
pool: server
steps:
- task: InvokeRESTAPI@1
displayName: 'Trigger test (check test result on Jenkins)'
inputs:
connectionType: 'connectedServiceName'
serviceConnection: 'waylandJenkins'
method: 'POST'
urlSuffix: 'view/pc-ble-driver-py/job/pc-ble-driver-py-$(osType)/buildWithParameters?BRANCH=$(Build.SourceBranch)&VSTS_URL=$(system.CollectionUri)&TOKEN=$(system.AccessToken)&PROJECT_ID=$(system.teamProjectId)&HUB_NAME=$(system.hostType)&PLAN_ID=$(system.planId)&TASK_ID=$(system.taskInstanceId)&JOB_ID=$(system.jobId)'
waitForCompletion: 'false'
condition: ne(variables['Build.Reason'], 'PullRequest')