Skip to content

Commit 8e1ba73

Browse files
authored
Merge pull request #1170 from luxonis/v3_deps_cleanup
Move from Hunter to VCPKG
2 parents a7e4a16 + b3d38c7 commit 8e1ba73

71 files changed

Lines changed: 5757 additions & 1174 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-main.yml

Lines changed: 76 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
# Job which builds docstrings for the rest of the wheel builds
2626
build-docstrings:
2727
runs-on: ubuntu-latest
28+
env:
29+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
2830
steps:
2931
- name: Cache .hunter folder
3032
uses: actions/cache@v3
@@ -33,6 +35,12 @@ jobs:
3335
key: hunter-ubuntu-latest-v3-develop
3436
- name: List .hunter cache directory
3537
run: ls -a -l ~/.hunter/_Base/ || true
38+
- name: Export GitHub Actions cache environment variables
39+
uses: actions/github-script@v7
40+
with:
41+
script: |
42+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
43+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
3644
- uses: actions/checkout@v3
3745
with:
3846
submodules: 'recursive'
@@ -44,7 +52,7 @@ jobs:
4452
run: |
4553
sudo apt update
4654
python -m pip install --upgrade pip
47-
sudo apt install libusb-1.0-0-dev libopencv-dev libpcl-dev
55+
sudo apt install libusb-1.0-0-dev pkg-config bison autoconf libtool libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev
4856
python -m pip install -r bindings/python/docs/requirements_mkdoc.txt
4957
- name: Configure project
5058
run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp"
@@ -61,6 +69,8 @@ jobs:
6169
# Build and test bindings
6270
pytest:
6371
needs: build-docstrings
72+
env:
73+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
6474
strategy:
6575
matrix:
6676
# os: [ubuntu-latest, windows-latest, macos-latest]
@@ -82,6 +92,12 @@ jobs:
8292
with:
8393
path: C:/.hunter/
8494
key: hunter-pytest-${{ matrix.os }}-v3-develop
95+
- name: Export GitHub Actions cache environment variables
96+
uses: actions/github-script@v7
97+
with:
98+
script: |
99+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
100+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
85101
86102
- uses: actions/checkout@v3
87103
with:
@@ -103,28 +119,22 @@ jobs:
103119
if: matrix.os == 'ubuntu-latest'
104120
run: |
105121
python -m pip install --upgrade pip
106-
sudo apt install libusb-1.0-0-dev libopencv-dev
122+
sudo apt install libusb-1.0-0-dev pkg-config bison autoconf libtool libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev
107123
108124
- name: Install dependencies (MacOS)
109125
if: matrix.os == 'macos-latest'
110126
run: |
111127
python -m pip install --upgrade pip
112128
brew install libusb
113-
brew install opencv
114129
115130
- name: Setup cmake
116131
if: matrix.os == 'macos-latest'
117132
uses: jwlawson/actions-setup-cmake@v1.13
118133

119-
- name: Install dependencies (Windows)
120-
if: matrix.os == 'windows-latest'
121-
run: |
122-
choco install opencv
123-
echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
124134

125135
- name: Install pytest
126136
run: |
127-
python -m pip install pytest numpy opencv-python
137+
python -m pip install pytest numpy opencv-python jinja2
128138
129139
- name: Compile
130140
run: |
@@ -194,7 +204,10 @@ jobs:
194204
python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible
195205
fail-fast: false
196206
env:
197-
DEPTHAI_BUILD_BASALT: ON
207+
DEPTHAI_BUILD_BASALT: OFF
208+
DEPTHAI_BUILD_PCL: ON
209+
DEPTHAI_BUILD_RTABMAP: ON
210+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
198211
steps:
199212
- name: Cache .hunter folder
200213
uses: actions/cache@v3
@@ -204,6 +217,12 @@ jobs:
204217
- uses: actions/checkout@v3
205218
with:
206219
submodules: 'recursive'
220+
- name: Export GitHub Actions cache environment variables
221+
uses: actions/github-script@v7
222+
with:
223+
script: |
224+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
225+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
207226
208227
- uses: actions/download-artifact@v3
209228
with:
@@ -212,18 +231,6 @@ jobs:
212231
- name: Specify docstring to use while building the wheel
213232
run: echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
214233

215-
- name: Install dependencies for x86
216-
if: matrix.python-architecture == 'x86'
217-
run: |
218-
choco install opencv --x86
219-
echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
220-
221-
- name: Install dependencies for x64
222-
if: matrix.python-architecture == 'x64'
223-
run: |
224-
choco install opencv
225-
echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
226-
227234
- name: Select Windows SDK
228235
run: echo "CMAKE_ARGS=-DCMAKE_SYSTEM_VERSION=${{ env.CMAKE_WINDOWS_SDK_VERSION }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
229236

@@ -262,11 +269,11 @@ jobs:
262269
os: [macos-13, macos-14] # macos-13 is x64, macos-14 is arm64
263270
fail-fast: false
264271
runs-on: ${{ matrix.os }}
265-
# env:
266-
# TODO(Morato) - re-enable basalt, pcl, rtabmap after everything is ported
267-
# DEPTHAI_BUILD_BASALT: ON
268-
# DEPTHAI_BUILD_PCL: ON
269-
# DEPTHAI_BUILD_RTABMAP: ON
272+
env:
273+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
274+
DEPTHAI_BUILD_BASALT: ON
275+
DEPTHAI_BUILD_PCL: ON
276+
DEPTHAI_BUILD_RTABMAP: ON
270277
steps:
271278
- name: Cache .hunter folder
272279
uses: actions/cache@v3
@@ -277,6 +284,12 @@ jobs:
277284
run: |
278285
ls -a -l ~/.hunter/_Base/ || true
279286
echo "PATH=$PATH"
287+
- name: Export GitHub Actions cache environment variables
288+
uses: actions/github-script@v7
289+
with:
290+
script: |
291+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
292+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
280293
281294
- uses: actions/checkout@v3
282295
with:
@@ -300,8 +313,7 @@ jobs:
300313
run: |
301314
python -m pip install --upgrade pip
302315
brew install libusb
303-
brew install opencv
304-
brew install pcl
316+
brew install nasm
305317
python -m pip install delocate
306318
- name: Building wheels
307319
run: cd bindings/python && python -m pip wheel . -w ./wheelhouse/ --verbose
@@ -388,30 +400,34 @@ jobs:
388400
needs: build-docstrings
389401
runs-on: ubuntu-latest
390402
container:
391-
image: mmorato/depthai-manylinux2014:0.4 # TODO(mmorato) temporary location, push to luxonis namespace
403+
image: quay.io/pypa/manylinux_2_28_x86_64
392404
env:
393-
PLAT: manylinux2014_x86_64
405+
PLAT: manylinux_2_28_x86_64
394406
strategy:
395407
matrix:
396-
python-set: ["7..9", "10..12"]
408+
python-set: ["7", "8", "9", "10", "11", "12"]
397409
env:
398-
# workaround required for cache@v3, https://github.com/actions/cache/issues/1428
399-
# to be removed when upgrading the manylinux image
400-
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
401410
DEPTHAI_BUILD_BASALT: ON
402411
DEPTHAI_BUILD_PCL: ON
403412
DEPTHAI_BUILD_RTABMAP: ON
413+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
404414
steps:
405415
- name: Cache .hunter folder
406416
uses: actions/cache@v3
407417
with:
408418
path: ~/.hunter
409419
key: hunter-x86_64-v3-develop
420+
- name: Export GitHub Actions cache environment variables
421+
uses: actions/github-script@v7
422+
with:
423+
script: |
424+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
425+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
410426
- uses: actions/checkout@v3
411427
with:
412428
submodules: 'recursive'
413429
- name: Installing libusb1-devel dependency
414-
run: yum install -y --disableplugin=fastestmirror libusb1-devel perl-core curl zip unzip tar ninja-build
430+
run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake
415431
- name: Installing cmake dependency
416432
run: |
417433
cd bindings/python
@@ -427,12 +443,6 @@ jobs:
427443
- name: Specify docstring to use while building the wheel
428444
run: echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV
429445

430-
- name: Build and install depthai-core
431-
run: |
432-
cmake -S . -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake
433-
cmake --build build_core --target install --parallel 4
434-
echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV
435-
436446
- name: Append build hash if not a tagged commit
437447
if: startsWith(github.ref, 'refs/tags/v') != true
438448
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
@@ -443,7 +453,9 @@ jobs:
443453
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar
444454
mv dist/* wheelhouse/audited/
445455
- name: Build wheels
446-
run: cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
456+
run: |
457+
cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
458+
447459
- name: Audit wheels
448460
run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done
449461
- name: Archive wheel artifacts
@@ -465,35 +477,47 @@ jobs:
465477
runs-on: [self-hosted, linux, ARM64]
466478
timeout-minutes: 1440 # Set timeout to 24 hours
467479
container:
468-
image: mmorato/depthai-manylinux2014_aarch64:0.4
480+
image: quay.io/pypa/manylinux_2_28_aarch64
469481
env:
470-
PLAT: manylinux2014_aarch64
482+
PLAT: manylinux_2_28_aarch64
471483
# Mount local hunter cache directory, instead of transfering to Github and back
472484
volumes:
473485
- /.hunter:/github/home/.hunter
474486
strategy:
475487
matrix:
476-
python-set: ["7..9", "10..12"]
488+
python-set: ["7", "8", "9", "10", "11", "12"]
477489
env:
478490
# workaround required for cache@v3, https://github.com/actions/cache/issues/1428
479-
# to be removed when upgrading the manylinux image
480-
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
481-
DEPTHAI_VCPKG_CFLAGS: "-std=c99" # Needed so vpckg can bootstrap itself with the old GCC on the manylinux image
482491
VCPKG_FORCE_SYSTEM_BINARIES: "1" # Needed so vpckg can bootstrap itself
492+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
483493
DEPTHAI_BUILD_BASALT: ON
484494
DEPTHAI_BUILD_PCL: ON
485495
DEPTHAI_BUILD_RTABMAP: ON
496+
VCPKG_MAX_CONCURRENCY: "2"
486497
steps:
498+
- name: Export GitHub Actions cache environment variables
499+
uses: actions/github-script@v7
500+
with:
501+
script: |
502+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
503+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
487504
- uses: actions/checkout@v3
488505
with:
489506
submodules: 'recursive'
490507
- name: Installing libusb1-devel dependency
491-
run: yum install -y --disableplugin=fastestmirror libusb1-devel perl-core curl zip unzip tar ninja-build
508+
run: yum install -y libusb1-devel perl-core curl zip unzip tar zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake
492509
- name: Installing cmake dependency
493510
run: |
494511
cd bindings/python
495512
/opt/python/cp38-cp38/bin/python3.8 -m pip install cmake
496513
ln -s /opt/python/cp38-cp38/bin/cmake /bin/
514+
- name: Setup ninja required for arm64 builds
515+
run: |
516+
git clone https://github.com/ninja-build/ninja.git
517+
cd ninja
518+
git checkout v1.10.2
519+
cmake -Bbuild-cmake
520+
cmake --build build-cmake --target install
497521
- name: Create folder structure
498522
run: cd bindings/python && mkdir -p wheelhouse/audited/
499523

@@ -504,17 +528,12 @@ jobs:
504528
- name: Specify docstring to use while building the wheel
505529
run: echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV
506530

507-
- name: Build and install depthai-core
508-
run: |
509-
cmake -S . -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake
510-
cmake --build build_core --target install --parallel 4
511-
echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV
512-
513531
- name: Append build hash if not a tagged commit
514532
if: startsWith(github.ref, 'refs/tags/v') != true
515533
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
516534
- name: Building wheels
517-
run: cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
535+
run: |
536+
cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
518537
- name: Auditing wheels
519538
run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done
520539
- name: Archive wheel artifacts

.github/workflows/test.workflow.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020

2121
# Testing
2222
test:
23+
env:
24+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
2325
strategy:
2426
matrix:
2527
# os: ['windows', 'macos', 'linux']
@@ -42,6 +44,12 @@ jobs:
4244
- uses: actions/checkout@v3
4345
with:
4446
submodules: 'recursive'
47+
- name: Export GitHub Actions cache environment variables
48+
uses: actions/github-script@v7
49+
with:
50+
script: |
51+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
52+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
4553
4654
- name: Create virtual environment
4755
run: |
@@ -72,6 +80,7 @@ jobs:
7280
export DISPLAY=:99
7381
xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &)
7482
source venv/bin/activate # Activate virtual environment
83+
python3 -m pip install jinja2
7584
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON -D DEPTHAI_BUILD_PYTHON=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON
7685
cmake --build build --parallel 4 --config Release
7786
cd tests

0 commit comments

Comments
 (0)