Skip to content

Commit 803552f

Browse files
committed
Add aarch64 wheel build to CI workflow
- Add build-wheels-aarch64 job using native ubuntu-24.04-arm runner - Add workflow_dispatch for manual triggering - Add build/* branch pattern to push triggers for testing
1 parent 5963a33 commit 803552f

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

.github/workflows/ci.yml

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main, develop, 'build/*' ]
66
pull_request:
77
branches: [ main ]
8+
workflow_dispatch:
89

910
env:
1011
CARGO_TERM_COLOR: always
@@ -375,3 +376,78 @@ jobs:
375376
with:
376377
name: wheels-${{ matrix.os }}
377378
path: dist/
379+
380+
build-wheels-aarch64:
381+
name: Build wheels (Linux aarch64)
382+
runs-on: ubuntu-24.04-arm
383+
384+
steps:
385+
- uses: actions/checkout@v4
386+
387+
- name: Install OpenCV and LLVM dependencies
388+
run: |
389+
sudo apt-get update
390+
sudo apt-get install -y pkg-config clang libclang-dev llvm-dev wget cmake build-essential
391+
# Install LLVM 18 which has the proper libclang.so symlink
392+
sudo apt-get install -y llvm-18 llvm-18-dev llvm-18-tools libclang1-18 libclang-cpp18
393+
# Set environment variables for LLVM 18
394+
echo "LIBCLANG_PATH=/usr/lib/llvm-18/lib" >> $GITHUB_ENV
395+
echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV
396+
echo "LD_LIBRARY_PATH=/usr/lib/llvm-18/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
397+
398+
# Build OpenCV 4.12 from source
399+
echo "Building OpenCV 4.12 from source..."
400+
cd /tmp
401+
wget -q https://github.com/opencv/opencv/archive/4.12.0.tar.gz
402+
tar -xzf 4.12.0.tar.gz
403+
cd opencv-4.12.0
404+
mkdir build
405+
cd build
406+
cmake \
407+
-DCMAKE_BUILD_TYPE=RELEASE \
408+
-DCMAKE_INSTALL_PREFIX=/usr/local \
409+
-DWITH_CUDA=OFF \
410+
-DWITH_OPENGL=OFF \
411+
-DWITH_OPENCL=OFF \
412+
-DWITH_TBB=OFF \
413+
-DWITH_IPP=OFF \
414+
-DWITH_1394=OFF \
415+
-DWITH_V4L=OFF \
416+
-DWITH_GTK=OFF \
417+
-DBUILD_TESTS=OFF \
418+
-DBUILD_PERF_TESTS=OFF \
419+
-DBUILD_EXAMPLES=OFF \
420+
-DBUILD_opencv_python2=OFF \
421+
-DBUILD_opencv_python3=OFF \
422+
-DBUILD_opencv_java=OFF \
423+
-DOPENCV_GENERATE_PKGCONFIG=ON \
424+
..
425+
make -j$(nproc)
426+
sudo make install
427+
sudo ldconfig
428+
429+
# Set OpenCV environment variables
430+
echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
431+
echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
432+
433+
- name: Set up Python
434+
uses: actions/setup-python@v4
435+
with:
436+
python-version: 3.11
437+
438+
- name: Install Rust toolchain
439+
uses: dtolnay/rust-toolchain@master
440+
with:
441+
toolchain: 1.89
442+
443+
- name: Install maturin
444+
run: pip install maturin[patchelf]
445+
446+
- name: Build wheels
447+
run: maturin build --release --out dist --no-default-features --features python-bindings,simd,opencv
448+
449+
- name: Upload wheels
450+
uses: actions/upload-artifact@v4
451+
with:
452+
name: wheels-linux-aarch64
453+
path: dist/

0 commit comments

Comments
 (0)