Skip to content

Commit

Permalink
Merge pull request #1386 from olivier-roussel/poc_conda-ci
Browse files Browse the repository at this point in the history
Introduce ci for Python bindings using conda
  • Loading branch information
fspindle authored Apr 19, 2024
2 parents ba85d29 + db43500 commit d0aab60
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/conda/environment_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: visp
channels:
- conda-forge
dependencies:
- cxx-compiler
- cmake
- ninja
- xorg-libx11
- xorg-libxfixes
- mesa-libegl-cos7-x86_64
- libxml2
- libdc1394 >=2.2.6
- librealsense
- libgomp
- eigen
- libjpeg-turbo
- libpng
- mkl-devel
- pybind11
19 changes: 19 additions & 0 deletions .github/workflows/conda/environment_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: visp
channels:
- conda-forge
dependencies:
- cxx-compiler
- cmake
- ninja
- xorg-libx11
- xorg-libxfixes
- libxml2
- libdc1394 >=2.2.6
- librealsense
- libopencv
- eigen
- libjpeg-turbo
- libpng
- libopenblas
- llvm-openmp
- pybind11
17 changes: 17 additions & 0 deletions .github/workflows/conda/environment_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: visp
channels:
- conda-forge
dependencies:
- cxx-compiler
- cmake
- clang
- ninja
- llvm-openmp
- openmp
- pthreads-win32
- libopencv
- eigen
- libjpeg-turbo
- libpng
- mkl-devel
- pybind11
103 changes: 103 additions & 0 deletions .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: MacOS-Linux-conda-CI

on: [push,pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
visp-conda:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }} ${{ matrix.build_type }} ${{ matrix.cxx_options }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
build_type: [Release]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install miniconda on ubuntu
uses: conda-incubator/setup-miniconda@v3
if: startsWith(matrix.os,'ubuntu') == true
with:
activate-environment: visp
auto-update-conda: true
environment-file: .github/workflows/conda/environment_linux.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Install miniconda on macOS
uses: conda-incubator/setup-miniconda@v3
if: startsWith(matrix.os,'macos') == true
with:
activate-environment: visp
auto-update-conda: true
environment-file: .github/workflows/conda/environment_macos.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Show conda config
shell: bash -el {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Determine number of processor on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
echo "NPROC=$(nproc)" >> $GITHUB_ENV
- name: Determine number of processor on MacOS
if: matrix.os == 'macos-latest'
run: |
echo "NPROC=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
- name: Build visp python bindings
shell: bash -el {0}
run: |
echo "Number of processors: ${NPROC}"
mkdir build
cd build
cmake .. \
-G "Ninja" \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TUTORIALS=OFF \
-DBUILD_APPS=OFF \
-DBUILD_DEMOS=OFF \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
# Build
cmake --build . --parallel ${NPROC} --target visp_python_bindings
# Tests
cmake --build . --parallel ${NPROC} --target visp_python_bindings_test
check:
if: always()
name: check-macos-linux-conda

needs:
- visp-conda

runs-on: Ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
94 changes: 94 additions & 0 deletions .github/workflows/windows-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Windows-conda-CI

on: [push,pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
visp-conda:
name: ${{ matrix.os }} ${{ matrix.compiler }} - Python ${{ matrix.python-version }} ${{ matrix.build_type }} ${{ matrix.cxx_options }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: ["windows-latest"]
compiler: ["cl", "clang-cl"]
build_type: [Release]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install miniconda on windows
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: visp
auto-update-conda: true
environment-file: .github/workflows/conda/environment_windows.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Show conda config
shell: cmd /C CALL {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
- name: Build visp python bindings
shell: cmd /C CALL {0}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
run: |
:: start building
call "%programfiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
if errorlevel 1 exit 1
mkdir build
cd build
cmake .. ^
-G "Ninja" ^
-DCMAKE_PREFIX_PATH=%CONDA_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DVISP_LIB_INSTALL_PATH="lib" ^
-DVISP_BIN_INSTALL_PATH="bin" ^
-DVISP_CONFIG_INSTALL_PATH="cmake" ^
-DBUILD_TESTS=OFF ^
-DBUILD_EXAMPLES=OFF ^
-DBUILD_TUTORIALS=OFF ^
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
if errorlevel 1 exit 1
:: Build visp libs & install them
cmake --build . --target install
:: Build bindings
cmake --build . --target visp_python_bindings
if errorlevel 1 exit 1
:: Tests
cmake --build . --target visp_python_bindings_test
if errorlevel 1 exit 1
check:
if: always()
name: check-windows-conda

needs:
- visp-conda

runs-on: Ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
2 changes: 1 addition & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ViSP 3.x.x (Version in development)
- Contributors:
. Fabien Spindler, Romain Lagneau, Pierre Perraud, Florent Lamiraux, Samuel Felton, François Chaumette,
Souriya Trinh
Souriya Trinh, Olivier Roussel
- New classes
. vpPololu and vpRobotPololuPtu to control respectively a servo motor using a pololu maestro board or a 3D printed
2 dof pan-tilt unit. Visual servoing example provided in example/servo-pololu-ptu. Tests available in
Expand Down

0 comments on commit d0aab60

Please sign in to comment.