Skip to content

Merge pull request #171 from michalmaj/development #395

Merge pull request #171 from michalmaj/development

Merge pull request #171 from michalmaj/development #395

Workflow file for this run

name: CI
on:
push:
branches: [main, development]
pull_request:
branches: [main]
jobs:
build-and-test:
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Conan
run: pip install "conan>=2,<3"
- name: Install GCC 14 (Linux — required for std::ranges::to in C++23)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y gcc-14 g++-14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
- name: Detect Conan profile
run: conan profile detect --force
- name: Allow Conan to install system packages (Linux)
if: runner.os == 'Linux'
run: |
printf "\n[conf]\ntools.system.package_manager:mode=install\ntools.system.package_manager:sudo=True\n" >> ~/.conan2/profiles/default
- name: Remove OpenCV and onnxruntime from Conan requirements (macOS — Homebrew provides both)
if: runner.os == 'macOS'
run: |
python3 -c "
import pathlib
f = pathlib.Path('conandata.yml')
skip = {'opencv', 'onnxruntime'}
f.write_text(''.join(l for l in f.read_text().splitlines(keepends=True)
if not any(s in l.lower() for s in skip)))
"
- name: Cache Conan packages
uses: actions/cache@v4
with:
path: ~/.conan2/p
key: conan-${{ matrix.os }}-${{ hashFiles('conandata.yml') }}
restore-keys: conan-${{ matrix.os }}-
- name: Install system build dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y --no-install-recommends \
build-essential ffmpeg
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: brew install opencv@4 onnxruntime
- name: Configure CMake
run: |
EXTRA=""
CONAN_ARGS="--build=missing"
if [ "$(uname)" = "Darwin" ]; then
EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix opencv@4);$(brew --prefix)"
fi
if [ "$(uname)" = "Linux" ]; then
# Disable platform-specific features not available/needed on CI runners.
# with_va/wayland: removes vaapi/system + wayland Conan deps (no GPU on CI).
# with_ffmpeg: system FFmpeg depends on libwebp::libwebp CMake target which
# Conan's ffmpeg generators don't expose correctly → link error.
# VideoWriter/CameraCapture tests are already excluded from CI.
CONAN_ARGS="${CONAN_ARGS};-o;opencv/*:with_va=False;-o;opencv/*:with_va_intel=False;-o;opencv/*:with_wayland=False;-o;opencv/*:with_ffmpeg=False"
fi
cmake \
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="conan_provider.cmake" \
-DCONAN_COMMAND=$(which conan) \
-DCMAKE_BUILD_TYPE=Release \
"-DCONAN_INSTALL_ARGS=${CONAN_ARGS}" \
$EXTRA \
-B build .
- name: Build
timeout-minutes: 60
run: |
# Both Linux and macOS runners have 7 GB RAM; unlimited parallel
# compilation OOMs on heavy C++23/visualization TUs.
# Timeout extended to 60 min: first Linux run builds OpenCV 4.8.1 via
# Conan (system libopencv-dev 4.6.0 lacks the 4.7+ objdetect/aruco API).
cmake --build build --parallel 2 --target improc_tests
- name: Run tests
run: |
if [ "$(uname)" = "Linux" ]; then
# FFmpeg disabled in Conan OpenCV build (libwebp target conflict);
# exclude all tests that read/write video files.
FILTER="-VideoWriterTest.*:VideoFileCaptureTest.*:VideoReaderTest.*:VideoViewTest.*:ViewsM4VideoBatch.*"
else
# macOS: brew OpenCV has FFmpeg; only skip tests that write to disk.
FILTER="-VideoWriterTest.WritesToMp4AndCreatesFile:VideoWriterTest.WritesToAvi"
fi
./build/improc_tests --gtest_filter="$FILTER"