1
- name : Python Wheel CI
1
+ name : Depthai Python CI/CD
2
2
3
3
# Controls when the action will run. Triggers the workflow on push
4
4
@@ -7,15 +7,58 @@ name: Python Wheel CI
7
7
# as self-hosted runners are used, and security policy for them has not been yet determined by GitHub
8
8
# pay close attention to not enable workflows on pull_request events
9
9
# TLDR: do NOT add 'pull_request' here for the time being
10
- on : [push]
10
+ on :
11
+ workflow_dispatch :
12
+ push :
13
+ branches :
14
+ - main
15
+ - develop
16
+ - gen2
17
+ - gen2_develop
18
+ tags :
19
+ - ' v*'
20
+
11
21
# ##################################
12
22
# ##################################
13
23
14
24
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15
25
jobs :
16
26
27
+ # Job which builds docstrings for the rest of the wheel builds
28
+ build-docstrings :
29
+ runs-on : macos-latest
30
+ steps :
31
+ - name : Cache .hunter folder
32
+ uses : actions/cache@v2
33
+ with :
34
+ path : ~/.hunter/
35
+ key : hunter-clang
36
+ - uses : actions/checkout@v2
37
+ with :
38
+ submodules : ' recursive'
39
+ - name : Set up Python
40
+ uses : actions/setup-python@v2
41
+ with :
42
+ python-version : 3.8
43
+ - name : Install dependencies
44
+ run : |
45
+ python -m pip install --upgrade pip
46
+ brew install libusb
47
+ python -m pip install git+git://github.com/luxonis/pybind11_mkdoc.git@master
48
+ - name : Configure project
49
+ run : cmake -S . -B build -DDEPTHAI_PYTHON_BUILD_DOCSTRINGS=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/docstrings/depthai_python_docstring.hpp"
50
+ - name : Build target 'pybind11_mkdoc'
51
+ run : cmake --build build --parallel --target pybind11_mkdoc
52
+ - name : Upload docstring artifacts
53
+ uses : actions/upload-artifact@v2
54
+ with :
55
+ name : docstrings
56
+ path : docstrings/
57
+ retention-days : 1
58
+
17
59
# This job builds wheels for armhf arch (RPi)
18
60
build-linux-armhf :
61
+ needs : build-docstrings
19
62
runs-on : luxonis-armhf
20
63
container :
21
64
image : registry.gitlab.com/luxonis/depthai-crosscompile/debian-buster
28
71
- uses : actions/checkout@v2
29
72
with :
30
73
submodules : ' recursive'
74
+
75
+ - uses : actions/download-artifact@v2
76
+ with :
77
+ name : ' docstrings'
78
+ path : docstrings
79
+ - name : Specify docstring to use while building the wheel
80
+ run : echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV
81
+
31
82
- name : Append build hash if not a tagged commit
32
83
if : startsWith(github.ref, 'refs/tags/v') != true
33
84
run : echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
@@ -43,10 +94,11 @@ jobs:
43
94
44
95
# This job builds wheels for Windows x86_64 arch
45
96
build-windows-x86_64 :
97
+ needs : build-docstrings
46
98
runs-on : windows-latest
47
99
strategy :
48
100
matrix :
49
- python-version : [3.6, 3.7, 3.8, 3.9]
101
+ python-version : [3.5, 3. 6, 3.7, 3.8, 3.9]
50
102
python-architecture : [x64, x86]
51
103
steps :
52
104
- name : Cache .hunter folder
@@ -57,6 +109,14 @@ jobs:
57
109
- uses : actions/checkout@v2
58
110
with :
59
111
submodules : ' recursive'
112
+
113
+ - uses : actions/download-artifact@v2
114
+ with :
115
+ name : ' docstrings'
116
+ path : docstrings
117
+ - name : Specify docstring to use while building the wheel
118
+ run : echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/docstrings/depthai_python_docstring.hpp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
119
+
60
120
- name : Set up Python ${{ matrix.python-version }}
61
121
uses : actions/setup-python@v2
62
122
with :
@@ -78,10 +138,11 @@ jobs:
78
138
79
139
# This job builds wheels for macOS x86_64 arch
80
140
build-macos-x86_64 :
141
+ needs : build-docstrings
81
142
runs-on : macos-latest
82
143
strategy :
83
144
matrix :
84
- python-version : [3.6, 3.7, 3.8, 3.9]
145
+ python-version : [3.5, 3. 6, 3.7, 3.8, 3.9]
85
146
steps :
86
147
- name : Cache .hunter folder
87
148
uses : actions/cache@v2
@@ -91,6 +152,14 @@ jobs:
91
152
- uses : actions/checkout@v2
92
153
with :
93
154
submodules : ' recursive'
155
+
156
+ - uses : actions/download-artifact@v2
157
+ with :
158
+ name : ' docstrings'
159
+ path : docstrings
160
+ - name : Specify docstring to use while building the wheel
161
+ run : echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV
162
+
94
163
- name : Set up Python ${{ matrix.python-version }}
95
164
uses : actions/setup-python@v2
96
165
with :
@@ -117,6 +186,7 @@ jobs:
117
186
118
187
# This job builds wheels for x86_64 arch
119
188
build-linux-x86_64 :
189
+ needs : build-docstrings
120
190
runs-on : ubuntu-latest
121
191
container :
122
192
image : quay.io/pypa/manylinux2014_x86_64
@@ -139,6 +209,14 @@ jobs:
139
209
ln -s /opt/python/cp38-cp38/bin/cmake /bin/
140
210
- name : Create folder structure
141
211
run : mkdir -p wheelhouse/audited/
212
+
213
+ - uses : actions/download-artifact@v2
214
+ with :
215
+ name : ' docstrings'
216
+ path : docstrings
217
+ - name : Specify docstring to use while building the wheel
218
+ run : echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV
219
+
142
220
- name : Append build hash if not a tagged commit
143
221
if : startsWith(github.ref, 'refs/tags/v') != true
144
222
run : echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
@@ -156,7 +234,8 @@ jobs:
156
234
name : audited-wheels
157
235
path : wheelhouse/audited/
158
236
159
- # Run tests
237
+
238
+ # # Run tests
160
239
# tests:
161
240
# runs-on: luxonis-arm-tests
162
241
# needs: [build-linux-armhf, build-windows-x86_64, build-macos-x86_64, build-linux-x86_64]
@@ -219,3 +298,38 @@ jobs:
219
298
PYPI_USER : ${{ secrets.PYPI_USER }}
220
299
PYPI_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
221
300
301
+ release :
302
+ if : startsWith(github.ref, 'refs/tags/v')
303
+ needs : [deploy-pypi]
304
+ runs-on : ubuntu-latest
305
+
306
+ steps :
307
+ - uses : actions/checkout@v2
308
+ with :
309
+ submodules : ' recursive'
310
+
311
+ - name : Get tag version
312
+ id : tag
313
+ uses : battila7/get-version-action@v2
314
+
315
+ - name : Check if version matches
316
+ run : python3.8 -c 'import find_version as v; exit(0) if "${{ steps.tag.outputs.version-without-v }}" == v.get_package_version() else exit(1)'
317
+
318
+ # Create GitHub release
319
+ - uses : actions/create-release@master
320
+ id : createRelease
321
+ name : Create ${{ steps.releaseNote.outputs.version }} depthai-core release
322
+ env :
323
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
324
+ with :
325
+ tag_name : ${{ github.ref }}
326
+ release_name : Release ${{ github.ref }}
327
+ body : |
328
+ ## Features
329
+
330
+ ## Bugs
331
+
332
+ ## Misc
333
+
334
+ draft : true
335
+
0 commit comments