Skip to content

Migrate bindings from pybind11 to nanobind (#560) #1498

Migrate bindings from pybind11 to nanobind (#560)

Migrate bindings from pybind11 to nanobind (#560) #1498

name: Test C++ interface
on:
push:
branches: [ "main" ]
paths: &cpp-paths
- "include/**"
- "**/CMakeLists.txt"
- "**/*.cmake"
- "cmake/**"
pull_request:
branches: [ "main" ]
paths: *cpp-paths
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: linux-gcc-12
os: ubuntu-latest
container: almalinux:9
compiler: gcc-toolset-12
- name: linux-gcc-13
os: ubuntu-latest
container: almalinux:9
compiler: gcc-toolset-13
- name: linux-gcc-14
os: ubuntu-latest
container: almalinux:9
compiler: gcc-toolset-14
- name: linux-gcc-15
os: ubuntu-latest
container: almalinux:9
compiler: gcc-toolset-15
- name: linux-clang-15
os: ubuntu-latest
container: fedora:42
compiler: clang-15
- name: linux-clang-17
os: ubuntu-latest
container: fedora:42
compiler: clang-17
- name: linux-clang-18
os: ubuntu-latest
container: fedora:42
compiler: clang-18
- name: linux-clang-19
os: ubuntu-latest
container: fedora:42
compiler: clang-19
- name: macos-clang
os: macos-latest
- name: windows
os: windows-latest
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Cache dnf packages
if: matrix.container != ''
uses: actions/cache@v6
with:
path: /var/cache/dnf
key: dnf-${{ matrix.name }}
- name: Install dependencies
if: matrix.container == 'fedora:42'
run: |
dnf install -y ${{ matrix.compiler }}
dnf install -y git cmake boost-devel tbb libomp.x86_64
- name: Install dependencies
if: matrix.container == 'almalinux:9'
run: |
dnf install -y ${{ matrix.compiler }}
source /opt/rh/${{ matrix.compiler }}/enable
dnf install -y git cmake boost-devel tbb libomp.x86_64
- name: Cache Homebrew downloads
if: matrix.os == 'macos-latest'
uses: actions/cache@v6
with:
path: ~/Library/Caches/Homebrew/downloads
key: brew-${{ runner.os }}-boost-tbb-libomp
- name: Install dependencies
if: matrix.os == 'macos-latest'
run: |
brew install boost tbb libomp
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Export GitHub Actions cache environment variables
if: matrix.os == 'windows-latest'
uses: actions/github-script@v9
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Set up vcpkg
if: matrix.os == 'windows-latest'
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
run: |
echo "VCPKG_ROOT=C:/vcpkg" >> $env:GITHUB_ENV
echo "CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
cd C:/vcpkg
./vcpkg install boost-atomic:x64-windows alpaka:x64-windows
- name: Compile and run tests
if: matrix.container != 'almalinux:9' && matrix.os != 'windows-latest'
working-directory: ${{ github.workspace }}
run: |
cmake -B build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failure --parallel $(nproc)
- name: Compile and run tests
if: matrix.container == 'almalinux:9'
working-directory: ${{ github.workspace }}
run: |
source /opt/rh/${{ matrix.compiler }}/enable
cmake -B build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failure --parallel $(nproc)
- name: Compile and run tests
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}
run: |
cmake -B build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" -DVCPKG_TARGET_TRIPLET=x64-windows -DVCPKG_MANIFEST_DIR="${{ github.workspace }}"
cmake --build build --parallel --config Release
ctest --test-dir build --output-on-failure --parallel $env:NUMBER_OF_PROCESSORS --build-config Release