Skip to content

Commit 7a2932d

Browse files
committed
Base for new python CI
1 parent 5e7403e commit 7a2932d

File tree

12 files changed

+102
-224
lines changed

12 files changed

+102
-224
lines changed

.github/actions/dgtal-config/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
if: ${{ runner.os == 'Linux' && inputs.config-name == 'default' }}
3232
shell: bash
3333
run: |
34-
echo "DGTAL_CMAKE_CONFIG -DDGTAL_WITH_CGAL=true -DDGTAL_WITH_LIBIGL=true -DDGTAL_WITH_FFTW3=true -DDGTAL_WITH_HDF5=true -DDGTAL_WITH_OPENMP=true -DDGTAL_WITH_POLYSCOPE_VIEWER=true -DDGTAL_WITH_CAIRO=true -DDGTAL_WITH_ITK=true -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true -DDGTAL_WARNING_AS_ERROR=ON -G Ninja" >> "$GITHUB_ENV"
34+
echo "DGTAL_CMAKE_CONFIG=-DDGTAL_WITH_CGAL=true -DDGTAL_WITH_LIBIGL=true -DDGTAL_WITH_FFTW3=true -DDGTAL_WITH_HDF5=true -DDGTAL_WITH_OPENMP=true -DDGTAL_WITH_POLYSCOPE_VIEWER=true -DDGTAL_WITH_CAIRO=true -DDGTAL_WITH_ITK=true -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true -DDGTAL_WARNING_AS_ERROR=ON -G Ninja" >> "$GITHUB_ENV"
3535
3636
- name: "Default MacOS"
3737
if: ${{ runner.os == 'macOS' && inputs.config-name == 'default' }}

.github/actions/setup-linux/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
using: "composite"
1111
steps:
1212
- name: Set up Python ${{ inputs.python-version }}
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: ${{ inputs.python-version }}
1616

.github/actions/setup-macos/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
using: "composite"
1111
steps:
1212
- name: Set up Python ${{ inputs.python-version }}
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: ${{ inputs.python-version }}
1616

.github/actions/setup-windows/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ inputs:
44
python-version:
55
description: "Version of python to use"
66
required: true
7-
default: "3.9"
7+
default: "3.11"
88

99
runs:
1010
using: "composite"
1111
steps:
1212
- name: Set up Python ${{ inputs.python-version }}
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: ${{ inputs.python-version }}
16+
architecture: x64
1617

1718
- name: Install conan
1819
uses: turtlebrowser/get-conan@main

.github/workflows/build-PR-master.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI (linux/macOS/windows), PR
22

33
on:
44
push:
5-
branches: [ master, GHActions ]
5+
branches: [ master ]
66
pull_request:
7-
branches: [ master, GHActions ]
7+
branches: [ master ]
88

99
jobs:
1010
build:
Lines changed: 37 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,54 @@
1-
name: CI Python bindings (linux/macOS/windows)
1+
name: CI (linux/macOS/windows), PR
22

33
on:
4-
pull_request:
5-
branches: [ master, main2.0 ]
6-
7-
env:
8-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
9-
TESTBLACKLIST: "(testLinearStructure|testIntegerConverter|testArithmeticalDSSComputerOnSurfels)"
10-
CONFIG_GLOBAL: -DDGTAL_BUILD_EXAMPLES=false -DDGTAL_BUILD_TESTS=false
11-
CONFIG_PYTHON: -DDGTAL_WRAP_PYTHON=ON -DDGTAL_BUILD_TESTS_PYTHON=ON
12-
CONFIG_LINUX:
13-
CONFIG_MAC:
14-
CONFIG_WINDOWS: -DDGTAL_WITH_OPENMP=true -DENABLE_CONAN=true -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe"
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version xx.xx.xx"
8+
required: true
159

1610
jobs:
17-
build:
11+
build_wheels:
1812
runs-on: ${{ matrix.os }}
1913
strategy:
2014
fail-fast: false
2115
matrix:
2216
os: [ubuntu-latest, macOS-latest, windows-latest]
23-
python-version: ["3.9"]
24-
BUILD_TYPE: [Release]
2517

26-
steps:
18+
steps:
2719
- uses: actions/checkout@v4
2820
with:
29-
fetch-depth: 1
30-
31-
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v4
33-
with:
34-
python-version: ${{ matrix.python-version }}
35-
36-
- name: Installing dependencies (Linux)
37-
if: matrix.os == 'ubuntu-latest'
38-
run: |
39-
sudo apt-get update
40-
sudo apt-get install zsh libqglviewer-dev-qt5 libcgal-dev ninja-build libhdf5-serial-dev libcairo2-dev libfftw3-dev libinsighttoolkit5-dev xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
21+
# Note: at least (5 + 1) for the whitelist to work
22+
fetch-depth: 6
4123

42-
- name: Installing dependencies (macOS)
43-
if: matrix.os == 'macOS-latest'
44-
run: brew install ninja libomp ccache cgal
45-
46-
- name: Install dependencies (conan - Windows 1/2)
47-
if: matrix.os == 'windows-latest'
48-
id: conan
49-
uses: turtlebrowser/get-conan@main
50-
with:
51-
version: 2.4.0
52-
53-
- name: Install dependencies (conan - Windows 2/2)
54-
if: matrix.os == 'windows-latest'
55-
run: |
56-
conan profile detect --force
57-
58-
- uses: actions/cache@v3
59-
if: matrix.os == 'windows-latest'
24+
- name: Setup OS
25+
uses: ./.github/actions/setup-os
6026
with:
61-
path: ~/.conan2
62-
key: ${{ runner.os }}-conan2-${{ matrix.BUILD_TYPE }}
27+
python-version: "3.11" # At least 3.11 for cibuildwheel 3.1.4
28+
# Note that the tool will build other python versions.
6329

30+
- name: Install cibuildwheel
31+
run: python -m pip install cibuildwheel==3.1.4
6432

65-
- name: Create Build Environment
66-
run: cmake -E make_directory ${{runner.workspace}}/build
67-
68-
- name: Configure CMake (Linux)
69-
if: matrix.os == 'ubuntu-latest'
70-
shell: bash
71-
working-directory: ${{runner.workspace}}/build
72-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_PYTHON $CONFIG_GLOBAL $CONFIG_LINUX -G Ninja
73-
74-
- name: Configure CMake (macOS)
75-
if: matrix.os == 'macOS-latest'
33+
- name: Conan (Windows)
7634
shell: bash
77-
working-directory: ${{runner.workspace}}/build
78-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_PYTHON $CONFIG_GLOBAL $CONFIG_MAC -G Ninja
79-
80-
- name: Configure CMake (Windows)
81-
if: matrix.os == 'windows-latest'
82-
shell: bash
83-
working-directory: ${{runner.workspace}}/build
84-
run: |
85-
conan install $GITHUB_WORKSPACE --build=missing -s:a compiler.cppstd=20
86-
cmake $GITHUB_WORKSPACE -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_PYTHON $CONFIG_GLOBAL $CONFIG_WINDOWS
87-
88-
89-
- name: Build
90-
shell: bash
91-
working-directory: ${{runner.workspace}}/build
92-
# Execute the build. You can specify a specific target with "--target <NAME>"
93-
run: cmake --build . --config ${{ matrix.BUILD_TYPE }} --parallel 8
94-
95-
- name: Import module Test
96-
shell: bash
97-
working-directory: ${{runner.workspace}}/build
98-
run: |
99-
python -c "import dgtal"
100-
101-
- name: Install python dependencies
102-
shell: bash
103-
run: |
104-
python -m pip install pytest
105-
python -m pip install numpy
106-
python -m pip install itk
107-
108-
- name: Run unit tests
109-
shell: bash
110-
working-directory: ${{runner.workspace}}/build
111-
run: |
112-
ctest -R python -C ${{ matrix.BUILD_TYPE }} -V --output-on-failure
113-
114-
115-
35+
if: ${{ runner.os == 'Windows'}}
36+
run:
37+
conan install . --build=missing -s:a compiler.cppstd=20
38+
39+
- name: Building wheels (Windows)
40+
if: ${{ runner.os == 'Windows' }}
41+
env:
42+
CMAKE_ARGS: -DCMAKE_BUILD_TYPE:STRING=Release -DENABLE_CONAN:BOOL=ON -DCMAKE_TOOLCHAIN_FILE:STRING='conan_toolchain.cmake'
43+
run: python -m cibuildwheel --output-dir wheelhouse
44+
45+
- name: Building wheels (linux / macOS)
46+
if: ${{ runner.os != 'Windows' }}
47+
env:
48+
CMAKE_ARGS: -DCMAKE_BUILD_TYPE:STRING=Release
49+
run: python -m cibuildwheel --output-dir wheelhouse
50+
51+
- uses: actions/upload-artifact@v4
52+
with:
53+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
54+
path: ./wheelhouse/*.whl

cmake/deps/boost.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@ option(BOOST_IOSTREAMS_ENABLE_BZIP2 "Boost.Iostreams: Enable BZip2 support" OFF)
187187
option(BOOST_IOSTREAMS_ENABLE_LZMA "Boost.Iostreams: Enable LZMA support" OFF)
188188
option(BOOST_IOSTREAMS_ENABLE_ZSTD "Boost.Iostreams: Enable Zstd support" OFF)
189189

190-
if(SKBUILD)
191-
set(OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
192-
set(BUILD_SHARED_LIBS ON)
193-
endif()
194-
195190
include(CPM)
196191
CPMAddPackage(
197192
NAME Boost

pyproject.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[build-system]
2+
requires = ["scikit-build-core"]
3+
build-backend = "scikit_build_core.build"
4+
5+
[project]
6+
name = "DGtal"
7+
version = "2.0.0"
8+
description = "DGtal is an open-source, cross-platform library providing Digital Geometry Tools and Algorithm"
9+
10+
authors = [
11+
{ name = "David Coeurjolly", email = "david.coeurjolly@cnrs.fr" }
12+
]
13+
classifiers = [
14+
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
15+
"Programming Language :: Python",
16+
"Programming Language :: C++",
17+
"Development Status :: 5 - Production/Stable"
18+
"Intended Audience :: Developers",
19+
"Intended Audience :: Education",
20+
"Intended Audience :: Science/Research",
21+
"Topic :: Scientific/Engineering",
22+
"Topic :: Scientific/Engineering :: Information Analysis",
23+
"Topic :: Software Development :: Libraries",
24+
"Operating System :: Microsoft :: Windows",
25+
"Operating System :: POSIX",
26+
"Operating System :: Unix",
27+
"Operating System :: MacOS"
28+
]
29+
30+
[project.urls]
31+
Homepage = "https://www.dgtal.org/"
32+
33+
[tool.scikit-build]
34+
sdist.include = [
35+
"tables/**.zip"
36+
]
37+
cmake.args = [
38+
'-DCMAKE_BUILD_TYPE=Release',
39+
'-DDGTAL_BUILD_SHARED_LIBS:BOOL=OFF',
40+
'-DDGTAL_BUILD_EXAMPLES:BOOL=OFF',
41+
'-DDGTAL_BUILD_TESTS:BOOL=OFF',
42+
'-DDGTAL_WRAP_PYTHON:BOOL=ON'
43+
]
44+
45+
[tool.cibuildwheel]
46+
# Necessary to see build output from the actual compilation
47+
build-verbosity = 1
48+
# TODO: Remove both lines. This is debug to speed up ci
49+
build = "cp311-*"
50+
archs = ["auto64"]
51+
52+
53+
[tool.cibuildwheel.windows]
54+
# CIBuildWheel uses a 64 bit compiler on windows
55+
archs = ["auto64"]

wrap/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ install(FILES ${wrap_header_common}
5353
DESTINATION ${CMAKE_INSTALL_PYTHONINCLUDEDIR}
5454
COMPONENT dev)
5555

56-
install(FILES deploy/__init__.py
56+
install(FILES __init__.py
5757
DESTINATION ${CMAKE_INSTALL_PYTHONLIBDIR}
5858
COMPONENT runtime
5959
)
6060
# Copy deploy/__init__ at configure time
61-
file(COPY deploy/__init__.py DESTINATION ${CMAKE_BUILD_PYTHONLIBDIR})
61+
file(COPY __init__.py DESTINATION ${CMAKE_BUILD_PYTHONLIBDIR})
6262
# Copy at build time
6363
add_custom_command(
6464
TARGET _dgtal

0 commit comments

Comments
 (0)