|
1 | | -name: CI Python bindings (linux/macOS/windows) |
| 1 | +name: CI (linux/macOS/windows), PR |
2 | 2 |
|
3 | 3 | 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 |
15 | 9 |
|
16 | 10 | jobs: |
17 | | - build: |
| 11 | + build_wheels: |
18 | 12 | runs-on: ${{ matrix.os }} |
19 | 13 | strategy: |
20 | 14 | fail-fast: false |
21 | 15 | matrix: |
22 | 16 | os: [ubuntu-latest, macOS-latest, windows-latest] |
23 | | - python-version: ["3.9"] |
24 | | - BUILD_TYPE: [Release] |
25 | 17 |
|
26 | | - steps: |
| 18 | + steps: |
27 | 19 | - uses: actions/checkout@v4 |
28 | 20 | 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 |
41 | 23 |
|
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 |
60 | 26 | 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. |
63 | 29 |
|
| 30 | + - name: Install cibuildwheel |
| 31 | + run: python -m pip install cibuildwheel==3.1.4 |
64 | 32 |
|
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) |
76 | 34 | 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 |
0 commit comments