Skip to content

Commit 6b5f0a8

Browse files
committed
Add aarch64 wheel build to CI workflow
- Add build-wheels-aarch64 job using native ubuntu-24.04-arm runner - Build wheels for Python 3.11, 3.12, 3.13 (matching publish workflow) - Add workflow_dispatch for manual triggering - Add build/* branch pattern to push triggers for testing
1 parent 5963a33 commit 6b5f0a8

File tree

1 file changed

+80
-1
lines changed

1 file changed

+80
-1
lines changed

.github/workflows/ci.yml

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

0 commit comments

Comments
 (0)