Skip to content

👷 Disable HighGUI in OpenCV build #64

👷 Disable HighGUI in OpenCV build

👷 Disable HighGUI in OpenCV build #64

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-opencv:
name: Build OpenCV
strategy:
matrix:
os: [ubuntu, macos, windows]
defaults:
run:
shell: bash
env:
MATRIX_OS: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
steps:
- name: Get latest release
id: latest-release
run: |
curl -s https://api.github.com/repos/opencv/opencv/releases/latest \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
| jq -r '.tag_name' | tee latest-release.txt
echo "tag=$(cat latest-release.txt)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
repository: opencv/opencv
ref: ${{ steps.latest-release.outputs.tag }}
- uses: Chocobo1/setup-ccache-action@v1
with:
windows_compile_environment: msvc
- uses: ilammy/msvc-dev-cmd@v1
id: msvc-env
if: matrix.os == 'windows'
- name: Setup MSVC environment
if: steps.msvc-env.conclusion == 'success'
run: |
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
echo "CC=cl" >> $GITHUB_ENV
echo "CXX=cl" >> $GITHUB_ENV
- name: CMake build
run: |
mkdir build
cd build
cmake .. \
-D CMAKE_INSTALL_PREFIX=../opencv \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_LIST=core,imgproc,features2d \
-D BUILD_SHARED_LIBS=OFF \
-D ENABLE_CCACHE=ON \
-D WITH_ADE=OFF \
-D WITH_PROTOBUF=OFF \
-D WITH_QUIRC=OFF \
-D WITH_ITT=OFF \
-D WITH_OPENEXR=OFF
cmake --build . --target install --parallel 4
- uses: actions/upload-artifact@v3
with:
name: opencv-${{ matrix.os }}
path: ./opencv
build:
name: Build Wheel
needs: [build-opencv]
strategy:
matrix:
os: [ubuntu, macos, windows]
python: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash
env:
MATRIX_OS: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: opencv-${{ matrix.os }}
path: ./opencv
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: ilammy/msvc-dev-cmd@v1
id: msvc-env
if: matrix.os == 'windows'
- name: Setup MSVC environment
if: steps.msvc-env.conclusion == 'success'
run: |
CV_DIR=$(find ./opencv/x64 | grep -i '\.cmake$' | head -n 1)
echo "OpenCV_DIR=$(realpath $(dirname $CV_DIR))" >> $GITHUB_ENV
echo "OpenCV_STATIC=ON" >> $GITHUB_ENV
- name: Setup Unix environment
if: steps.msvc-env.conclusion == 'skipped'
run: |
echo "OpenCV_DIR=$(pwd)/opencv/lib/cmake/opencv4" >> $GITHUB_ENV
echo "OpenCV_STATIC=ON" >> $GITHUB_ENV
- name: Build wheel
env:
VERBOSE: 1
run: |
pip install poetry
poetry build --format wheel
- uses: actions/upload-artifact@v3
with:
name: wheel-${{matrix.os}}-${{matrix.python}}
path: ./dist/*.whl
- name: Test wheel import
env:
SYSTEM_VERSION_COMPAT: 0
run: |
pip install dist/*.whl
python -vc "from orb_slam3 import ORBExtractor"
test:
name: Test Wheel
needs: [build]
strategy:
matrix:
os: [ubuntu, macos, windows]
python: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: wheel-${{matrix.os}}-${{matrix.python}}
path: ./dist
- name: Install Poetry
run: |
pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: poetry
- name: Install dependencies
run: |
poetry install --no-root --only=test
poetry run pip install dist/*.whl
- name: Run tests
run: |
poetry run pytest
cleanup:
name: Cleanup artifacts
runs-on: ubuntu-latest
needs: [build, test]
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: opencv-*
- uses: actions/download-artifact@v3
- name: Merge wheels
run: |
mkdir dist
cp -v wheel-*/*.whl dist/
- uses: actions/upload-artifact@v3
with:
name: wheel-all
path: ./dist/*.whl