diff --git a/.github/workflows/build-python.yaml b/.github/workflows/build-python.yaml index d5870fca..ae3eeba8 100644 --- a/.github/workflows/build-python.yaml +++ b/.github/workflows/build-python.yaml @@ -13,17 +13,13 @@ env: BOOST_MAJOR_VERSION: '1' BOOST_MINOR_VERSION: '80' BOOST_PATCH_VERSION: '0' - LIBNABO_VERSION: '1.0.7' - PYBIND11_VERSION: 'v2.10.2' + LIBNABO_VERSION: '1.1.2' BOOST_INSTALL_PATH: ${{ github.workspace }}/.tmp/boost/install BOOST_SRC_DIR: ${{ github.workspace }}/.tmp/boost LIBNABO_INSTALL_PATH: ${{ github.workspace }}/.tmp/libnabo-build/install LIBNABO_SRC_DIR: ${{ github.workspace }}/.tmp/libnabo - PYBIND11_INSTALL_PATH: ${{ github.workspace }}/.tmp/pybind11-build/install - PYBIND11_SRC_DIR: ${{ github.workspace }}/.tmp/pybind11 PYTHON_WHEEL_DIR: ${{ github.workspace }}/.tmp/python-wheel VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/.tmp/bin-cache' - CMAKE_BUILD_PARALLEL_LEVEL: 2 BUILD_DIR: ${{ github.workspace }}/build jobs: @@ -31,16 +27,18 @@ jobs: strategy: fail-fast: false matrix: - python_version: ['3.8', '3.9', '3.10', '3.11'] - os: + python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + os: # - windows-2019 cannot compile on Windows # (!) TODO: The workflow contains code for Windows building, but we cannot compile it with MS MPI. Changes in the source code are needed. + - ubuntu-22.04 - ubuntu-20.04 - + - ubuntu-24.04 + permissions: contents: write - + runs-on: ${{ matrix.os }} steps: @@ -54,10 +52,10 @@ jobs: run: | echo "BOOST_DIR=boost_${{ env.BOOST_MAJOR_VERSION }}_${{ env.BOOST_MINOR_VERSION }}_${{ env.BOOST_PATCH_VERSION }}" >> $GITHUB_ENV echo "BOOST_VERSION=${{ env.BOOST_MAJOR_VERSION }}.${{ env.BOOST_MINOR_VERSION }}.${{ env.BOOST_PATCH_VERSION }}" >> $GITHUB_ENV - + - name: Init env variable on Linux if: ${{ runner.os == 'Linux' }} - run: | + run: | echo "BOOST_ARCHIVE_NAME=${{ env.BOOST_DIR }}.7z" >> $GITHUB_ENV - name: Init base env variable on Windows @@ -65,12 +63,12 @@ jobs: run: | echo "BOOST_DIR=boost_${{ env.BOOST_MAJOR_VERSION }}_${{ env.BOOST_MINOR_VERSION }}_${{ env.BOOST_PATCH_VERSION }}" | Out-File -FilePath $env:GITHUB_ENV -Append echo "BOOST_VERSION=${{ env.BOOST_MAJOR_VERSION }}.${{ env.BOOST_MINOR_VERSION }}.${{ env.BOOST_PATCH_VERSION }}" | Out-File -FilePath $env:GITHUB_ENV -Append - + - name: Init env variable on Windows if: ${{ runner.os == 'Windows' }} - run: | + run: | echo "BOOST_ARCHIVE_NAME=${{ env.BOOST_DIR }}.zip" | Out-File -FilePath $env:GITHUB_ENV -Append - + - name: Cache boost id: cache-boost if: ${{ runner.os == 'Linux' }} @@ -94,21 +92,12 @@ jobs: path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} key: ${{ runner.os }}-vcpkg-cache-${{ matrix.python_version }} - - name: Cache pybind11 - id: cache-pybind11 - uses: actions/cache@v3 - with: - path: ${{ env.PYBIND11_INSTALL_PATH }} - key: ${{ runner.os }}-pybind11-cache--${{ env.PYBIND11_VERSION }}-python-${{ matrix.python_version }} - - name: Make dirs on Linux if: ${{ runner.os == 'Linux' }} run: | mkdir -p ${{ env.BOOST_SRC_DIR }} mkdir -p ${{ env.LIBNABO_SRC_DIR }} - mkdir -p ${{ env.PYBIND11_SRC_DIR }} mkdir -p ${{ env.BOOST_INSTALL_PATH }} - mkdir -p ${{ env.PYBIND11_INSTALL_PATH }} mkdir -p ${{ env.LIBNABO_INSTALL_PATH }} mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} @@ -117,9 +106,7 @@ jobs: run: | mkdir -Force ${{ env.BOOST_SRC_DIR }} mkdir -Force ${{ env.LIBNABO_SRC_DIR }} - mkdir -Force ${{ env.PYBIND11_SRC_DIR }} mkdir -Force ${{ env.BOOST_INSTALL_PATH }} - mkdir -Force ${{ env.PYBIND11_INSTALL_PATH }} mkdir -Force ${{ env.LIBNABO_INSTALL_PATH }} mkdir -Force ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} @@ -154,8 +141,8 @@ jobs: - name: Install required dependencies for Python run: | python -m pip install -U 'pip>=23.0' - pip install 'numpy>=1.20' wheel 'setuptools>=61.0' 'build~=0.10' - + pip install 'numpy>=1.20' wheel 'setuptools>=61.0' 'build~=0.10' `cmake` `pybind11` + - name: Install dependencies on Windows if: ${{ runner.os == 'Windows' }} run: | @@ -223,47 +210,12 @@ jobs: cd - rm -r ./libnabo/build - - name: Download source code pybind11 ${{ env.PYBIND11_VERSION }} - if: steps.cache-pybind11.outputs.cache-hit != 'true' - working-directory: ${{ env.PYBIND11_SRC_DIR }} - run: | - git clone -b ${{ env.PYBIND11_VERSION }} --single-branch https://github.com/pybind/pybind11.git - - - - name: Install pybind11 ${{ env.PYBIND11_VERSION }} on Linux - working-directory: ${{ env.PYBIND11_SRC_DIR }} - if: ${{ steps.cache-pybind11.outputs.cache-hit != 'true' && runner.os == 'Linux' }} - run: | - cd pybind11 - cmake -GNinja \ - -DCMAKE_INSTALL_PREFIX=${{ env.PYBIND11_INSTALL_PATH }} \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DPYBIND11_TEST:BOOL=OFF \ - -S . -B ./build - cmake --build ./build --target install - rm -r ./build - - - name: Install pybind11 ${{ env.PYBIND11_VERSION }} on Windows - working-directory: ${{ env.PYBIND11_SRC_DIR }} - if: ${{ steps.cache-pybind11.outputs.cache-hit != 'true' && runner.os == 'Windows' }} - run: | - cd pybind11 - cmake -A x64 ` - -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" ` - -DCMAKE_INSTALL_PREFIX=${{ env.PYBIND11_INSTALL_PATH }} ` - -DCMAKE_BUILD_TYPE=RelWithDebInfo ` - -DPYBIND11_TEST:BOOL=OFF ` - -S . -B ./build - cmake --build ./build --target install - rm -r ./build - - name: Compile libpointmatcher on Linux if: runner.os == 'Linux' run: | cmake \ -DBOOST_ROOT:PATH=${{ env.BOOST_INSTALL_PATH }} \ -DLIBNABO_INSTALL_DIR=${{ env.LIBNABO_INSTALL_PATH }} \ - -Dpybind11_DIR=${{ env.PYBIND11_INSTALL_PATH }}/share/cmake/pybind11 \ -DBUILD_PYTHON_MODULE:BOOL=ON \ -DUSE_OPEN_MP:BOOL=ON \ -DBoost_USE_STATIC_LIBS:BOOL=ON \ @@ -278,8 +230,7 @@ jobs: run: | cmake -A x64 ` -DCMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" ` - -DLIBNABO_INSTALL_DIR:PATH="${{ env.LIBNABO_INSTALL_PATH }}" ` - -Dpybind11_DIR:PATH="${{ env.PYBIND11_INSTALL_PATH }}/share/cmake/pybind11" ` + -DLIBNABO_INSTALL_DIR:PATH="${{ env.LIBNABO_INSTALL_PATH }}" `` -DBUILD_PYTHON_MODULE:BOOL=ON ` -DBoost_USE_STATIC_LIBS:BOOL=ON ` -DPYTHON_INSTALL_TARGET:PATH="./python/${{ env.PYTHON_PACKAGE_NAME }}" ` @@ -288,7 +239,7 @@ jobs: -DCMAKE_BUILD_TYPE="RelWithDebInfo" ` -S . -B ${{ env.BUILD_DIR }} cmake --build ${{ env.BUILD_DIR }} --target install - + - name: Build python wheel working-directory: ./python run: | @@ -298,7 +249,7 @@ jobs: working-directory: ./python run: | pip install ${{ env.PYTHON_WHEEL_DIR }}/*.whl - + - name: Test import working-directory: ${{ runner.temp }} run: python -c "from pypointmatcher import *"