1- name : Python Wheel CI
1+ name : Depthai Python CI/CD
22
33# Controls when the action will run. Triggers the workflow on push
44
@@ -7,15 +7,58 @@ name: Python Wheel CI
77# as self-hosted runners are used, and security policy for them has not been yet determined by GitHub
88# pay close attention to not enable workflows on pull_request events
99# 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+
1121# ##################################
1222# ##################################
1323
1424# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1525jobs :
1626
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+
1759 # This job builds wheels for armhf arch (RPi)
1860 build-linux-armhf :
61+ needs : build-docstrings
1962 runs-on : luxonis-armhf
2063 container :
2164 image : registry.gitlab.com/luxonis/depthai-crosscompile/debian-buster
2871 - uses : actions/checkout@v2
2972 with :
3073 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+
3182 - name : Append build hash if not a tagged commit
3283 if : startsWith(github.ref, 'refs/tags/v') != true
3384 run : echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
@@ -43,10 +94,11 @@ jobs:
4394
4495 # This job builds wheels for Windows x86_64 arch
4596 build-windows-x86_64 :
97+ needs : build-docstrings
4698 runs-on : windows-latest
4799 strategy :
48100 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]
50102 python-architecture : [x64, x86]
51103 steps :
52104 - name : Cache .hunter folder
@@ -57,6 +109,14 @@ jobs:
57109 - uses : actions/checkout@v2
58110 with :
59111 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+
60120 - name : Set up Python ${{ matrix.python-version }}
61121 uses : actions/setup-python@v2
62122 with :
@@ -78,10 +138,11 @@ jobs:
78138
79139 # This job builds wheels for macOS x86_64 arch
80140 build-macos-x86_64 :
141+ needs : build-docstrings
81142 runs-on : macos-latest
82143 strategy :
83144 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]
85146 steps :
86147 - name : Cache .hunter folder
87148 uses : actions/cache@v2
@@ -91,6 +152,14 @@ jobs:
91152 - uses : actions/checkout@v2
92153 with :
93154 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+
94163 - name : Set up Python ${{ matrix.python-version }}
95164 uses : actions/setup-python@v2
96165 with :
@@ -117,6 +186,7 @@ jobs:
117186
118187 # This job builds wheels for x86_64 arch
119188 build-linux-x86_64 :
189+ needs : build-docstrings
120190 runs-on : ubuntu-latest
121191 container :
122192 image : quay.io/pypa/manylinux2014_x86_64
@@ -139,6 +209,14 @@ jobs:
139209 ln -s /opt/python/cp38-cp38/bin/cmake /bin/
140210 - name : Create folder structure
141211 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+
142220 - name : Append build hash if not a tagged commit
143221 if : startsWith(github.ref, 'refs/tags/v') != true
144222 run : echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
@@ -156,7 +234,8 @@ jobs:
156234 name : audited-wheels
157235 path : wheelhouse/audited/
158236
159- # Run tests
237+
238+ # # Run tests
160239 # tests:
161240 # runs-on: luxonis-arm-tests
162241 # needs: [build-linux-armhf, build-windows-x86_64, build-macos-x86_64, build-linux-x86_64]
@@ -219,3 +298,38 @@ jobs:
219298 PYPI_USER : ${{ secrets.PYPI_USER }}
220299 PYPI_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
221300
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