Skip to content

ci: support python 3.13 #464

ci: support python 3.13

ci: support python 3.13 #464

Workflow file for this run

name: macOS
on: [push, pull_request]
jobs:
build:
name: AppleClang-${{matrix.build_type}}-Python-${{matrix.python}}
runs-on: macos-14
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
build_type:
- Release
- Debug
python:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13.0-rc.2'
steps:
- uses: actions/checkout@v4
- name: Setup Dependencies
run: |
brew install ninja
- name: Cache Boost
id: cache-boost
uses: actions/cache@v4
with:
path: boost/
key: ${{runner.os}}-boost-1.84
- name: Download Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
wget https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.zip
unzip boost_1_84_0.zip;
- name: Setup Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
cd boost_1_84_0
./bootstrap.sh
./b2 --prefix=${{github.workspace}}/boost --with-test install
- name: Cache Eigen
id: cache-eigen
uses: actions/cache@v4
with:
path: eigen/
key: ${{runner.os}}-eigen-3.4.0
- name: Download Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip
unzip eigen-3.4.0.zip
- name: Setup Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
cmake -S eigen-3.4.0 -B build-eigen \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/eigen \
-DEIGEN_BUILD_DOC=OFF \
-G Ninja
cmake --build build-eigen --target install
- name: Cache fmt
id: cache-fmt
uses: actions/cache@v4
with:
path: fmt/
key: ${{runner.os}}-fmt-10.2.1-${{matrix.build_type}}
- name: Download fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
wget https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip
unzip fmt-10.2.1.zip
- name: Setup fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
cmake -S fmt-10.2.1 -B build-fmt \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/fmt \
-DFMT_TEST=OFF \
-G Ninja
cmake --build build-fmt \
--config ${{matrix.build_type}} \
--target install
- name: Cache OpenCV
id: cache-opencv
uses: actions/cache@v4
with:
path: opencv/
key: ${{runner.os}}-opencv-4.10.0
- name: Download OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
wget https://github.com/opencv/opencv/archive/refs/tags/4.10.0.zip
unzip 4.10.0.zip
- name: Setup OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
cmake -S opencv-4.10.0 -B build-opencv \
-DBUILD_LIST=core,imgproc \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/opencv \
-G Ninja
cmake --build build-opencv \
--config ${{matrix.build_type}} \
--target install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
architecture: ${{matrix.arch}}
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Setup Dependencies
run: |
pip install -r requirements.txt
- name: Setup Debug Environment
if: ${{matrix.build_type == 'Debug'}}
run: |
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
echo 'LDFLAGS=--coverage' >> $GITHUB_ENV
- name: Setup Environment
run: |
echo 'Boost_ROOT=${{github.workspace}}/boost' >> $GITHUB_ENV
echo 'Eigen3_ROOT=${{github.workspace}}/eigen' >> $GITHUB_ENV
echo 'fmt_ROOT=${{github.workspace}}/fmt' >> $GITHUB_ENV
echo 'OpenCV_ROOT=${{github.workspace}}/opencv' >> $GITHUB_ENV
echo "pybind11_ROOT=$(pybind11-config --cmakedir)" >> $GITHUB_ENV
- name: Configure
env:
CXXFLAGS: -Weverything -Wno-c++98-compat -Wno-padded -Wno-c++98-compat-pedantic -Wno-disabled-macro-expansion -Wno-shadow -Wno-used-but-marked-unused -Wno-global-constructors -Wno-shorten-64-to-32 -Wno-documentation -Werror ${{env.CXXFLAGS}}
Python_ROOT: ${{env.pythonLocation}}
run: |
cmake -S . -B build_${{matrix.build_type}} \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON \
-G Xcode
- name: Build
run: |
cmake --build build_${{matrix.build_type}} \
--config ${{matrix.build_type}}
- name: Test
run: |
ctest --test-dir build_${{matrix.build_type}} \
--build-config ${{matrix.build_type}} \
-j$(sysctl -n hw.ncpu) \
--output-on-failure
- name: Generate Coverage
if: matrix.build_type == 'Debug'
run: |
cd build_${{matrix.build_type}}
gcovr -r .. . -s --cobertura coverage.xml
- name: Upload Coverage to Codecov
if: ${{matrix.build_type == 'Debug'}}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build_${{matrix.build_type}}/coverage.xml
fail_ci_if_error: true
verbose: true