Skip to content

ci: support python 3.13 #572

ci: support python 3.13

ci: support python 3.13 #572

Workflow file for this run

name: Windows
on: [push, pull_request]
jobs:
build-mingw:
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: true
matrix:
build_type: [Release, Debug]
sys: [mingw64]
include:
- sys: mingw64
env: x86_64
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
# Running Ninja requires cmd.exe to be in the PATH
path-type: minimal
update: true # Currently, necessary for eigen3 3.4.0
install: >-
mingw-w64-${{matrix.env}}-boost
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-eigen3
mingw-w64-${{matrix.env}}-fmt
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-lld
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-opencv
mingw-w64-${{matrix.env}}-pybind11
mingw-w64-${{matrix.env}}-python
mingw-w64-${{matrix.env}}-python-jinja
mingw-w64-${{matrix.env}}-python-lxml
mingw-w64-${{matrix.env}}-python-numpy
mingw-w64-${{matrix.env}}-python-pip
mingw-w64-${{matrix.env}}-python-pygments
mingw-w64-${{matrix.env}}-python-pytest
mingw-w64-${{matrix.env}}-python-pytest-xdist
- name: Setup Coverage Dependencies
if: matrix.build_type == 'Debug'
run: |
pip install 'gcovr==7.2'
- name: Setup Environment
run: |
echo "Python_ROOT=$(dirname $(dirname $(which python)))" >> $GITHUB_ENV
- name: Setup Debug Environment
if: ${{matrix.build_type == 'Debug'}}
run: |
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
- name: Configure
env:
CXX: ${{matrix.env}}-w64-mingw32-g++
CXXFLAGS: -fuse-ld=lld -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wundef -Wfloat-equal -Werror ${{env.CXXFLAGS}}
run: |
cmake -S . -B build_${{matrix.build_type}}/ \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON \
-G Ninja
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}}
- name: Test
run: |
ctest --test-dir build_${{matrix.build_type}} \
-j$(nproc) \
--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
build-msvc:
name: ${{matrix.msvc}}-${{matrix.arch}}-${{matrix.build_type}}-Python-${{matrix.python}}
runs-on: ${{matrix.os}}
defaults:
run:
shell: powershell
env:
CL: /MP
strategy:
fail-fast: true
matrix:
arch:
- x64
build_type:
- Debug
- Release
msvc:
- VS-16-2019
- VS-17-2022
python:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13.0-rc.2'
include:
- msvc: VS-16-2019
os: windows-2019
generator: 'Visual Studio 16 2019'
marker: vc16
- msvc: VS-17-2022
os: windows-2022
generator: 'Visual Studio 17 2022'
marker: vc17
- arch: x64
address_model: 64
steps:
- uses: actions/checkout@v4
# NOTE Extracting Boost using Expand-Archive is very slow taking more than
# 20 min. whereas 7z takes less than a 1 min.
- name: Cache Boost
id: cache-boost
uses: actions/cache@v4
with:
path: boost/
key: ${{runner.os}}-boost-1.84-${{matrix.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.7z", "boost_1_84_0.7z");
7z x boost_1_84_0.7z;
- name: Setup Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
cd boost_1_84_0
./bootstrap.bat
./b2 address-model=${{matrix.address_model}} `
variant=$('${{matrix.build_type}}'.ToLower()) `
--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: |
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip", "eigen-3.4.0.zip");
7z x 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 `
-A ${{matrix.arch}} `
-DBUILD_TESTING=OFF `
-DCMAKE_Fortran_COMPILER= `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/eigen `
-DEIGEN_BUILD_DOC=OFF
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.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip", "fmt-10.2.1.zip");
7z x 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 `
-A ${{matrix.arch}} `
-DFMT_TEST=OFF `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/fmt
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-${{matrix.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/opencv/opencv/archive/refs/tags/4.10.0.zip", "4.10.0.zip");
7z x 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 `
-A ${{matrix.arch}} `
-DBUILD_LIST="core,imgproc" `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/opencv
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 Dependencies (VC17)
if: matrix.msvc == 'VS-17-2022'
run: |
# pybind11 prior to version 2.9.0 causes compilation erros in debug
# builds that use Visual Studio 2022.
pip install pybind11>=2.9.0
- name: Setup Environment
run: |
echo "Boost_ROOT=${{github.workspace}}/boost" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Eigen3_ROOT=${{github.workspace}}/eigen" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "fmt_ROOT=${{github.workspace}}/fmt" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "OpenCV_ROOT=${{github.workspace}}/opencv" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "pybind11_ROOT=$(pybind11-config --cmakedir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Runtime Environment
run: |
echo "${{github.workspace}}/opencv/${{matrix.arch}}/${{matrix.marker}}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "HOGPPPATH=${{github.workspace}}/opencv/${{matrix.arch}}/${{matrix.marker}}/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Configure
env:
CXXFLAGS: /WX
Python_ROOT: ${{env.pythonLocation}}
run: |
cmake -S . -B build_${{matrix.build_type}}/ `
-A ${{matrix.arch}} `
-DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} `
-DCMAKE_INSTALL_PREFIX:PATH=./install `
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON `
-G "${{matrix.generator}}"
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}}
- name: Test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}} `
--target RUN_TESTS