gha: build - fix boost cache path and extract command #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build open_iA" | |
| on: | |
| # manual triggering allowed: | |
| workflow_dispatch: | |
| #pull_request: | |
| # branches: [ "main" ] | |
| # required for manual triggering when not in main branch: | |
| push: | |
| branches: | |
| - '**' | |
| schedule: | |
| # trigger automatic build Mon-Sat at 4:39 UTC: | |
| - cron: '39 4 * * 1-6' | |
| env: | |
| BUILD_TYPE: Release | |
| VTK_CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DVTK_BUILD_EXAMPLES=OFF -DVTK_BUILD_TESTING=OFF -DVTK_LEGACY_REMOVE:BOOL=ON -DVTK_MODULE_ENABLE_VTK_GUISupportQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_GUISupportQtSQL:STRING=NO -DVTK_MODULE_ENABLE_VTK_RenderingQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_ViewsQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2:STRING=YES | |
| # optional: -DVTK_SMP_IMPLEMENTATION_TYPE:STRING=${VTK_SMP_TYPE} | |
| # Qt: -DQt6_DIR:PATH=${Qt6_DIR} -DQt6WidgetsTools_DIR:PATH=${Qt6_DIR}WidgetsTools -DQt6CoreTools_DIR:PATH=${Qt6_DIR}CoreTools -DQt6GuiTools_DIR:PATH=${Qt6_DIR}GuiTools | |
| # Compiler: -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | |
| ITK_CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING:BOOL=OFF -DITK_USE_GPU:BOOL=OFF -DITK_USE_64BITS_IDS:BOOL=ON -DModule_ITKReview:BOOL=ON -DModule_HigherOrderAccurateGradient:BOOL=ON -DModule_SplitComponents:BOOL=ON -DModule_ITKVtkGlue:BOOL=On | |
| OPENIA_CMAKE_OPTIONS: -DopeniA_CUDA_ENABLED:BOOL=OFF -DModule_CommonImageFilters:BOOL=ON -DModule_FeatureCharacteristics:BOOL=ON -DModule_MetaFilters:BOOL=ON -DModule_Metrics:BOOL=ON -DModule_Segmentation:BOOL=ON -DModule_Surfaces:BOOL=ON -DModule_4DCT:BOOL=ON -DModule_BoneThickness:BOOL=ON -DModule_CompVis:BOOL=ON -DModule_DynamicVolumeLines:BOOL=ON -DModule_FeatureAnalyzer:BOOL=ON -DModule_FeatureAnalyzerComputation:BOOL=ON -DModule_FeatureScout:BOOL=ON -DModule_FiAKEr:BOOL=ON -DModule_FilterPreview:BOOL=ON -DModule_FoamCharacterization:BOOL=ON -DModule_FuzzyFeatureTracking:BOOL=ON -DModule_GEMSe:BOOL=ON -DModule_InSpectr:BOOL=ON -DModule_Labelling:BOOL=ON -DModule_NModalTF:BOOL=ON -DModule_Remote:BOOL=ON -DModule_TripleHistogramTF:BOOL=ON -DModule_Uncertainty:BOOL=ON -DModule_VolumePlayer:BOOL=ON | |
| QT_VERSION: 6.8.2 | |
| VTK_VERSION: 9.4.1 | |
| VTK_SHORTVER: 9.4 | |
| ITK_VERSION: 5.4.2 | |
| ITK_SHORTVER: 5.4 | |
| HDF5_VERSION: 1.14.5 | |
| HDF5_ZLIB_VERSION: 1.3.1 | |
| OPENXR_VERSION: 1.1.45 | |
| OPENVR_VERSION: 2.5.1 | |
| BOOST_VERSION: 1.87.0 | |
| BOOST_VERSION_UNDERSCORE: 1_87_0 | |
| # EIGEN: tested, working commit from Jun 18, 2024: | |
| EIGEN_LONGREF: d791d48859c6fc7850c9fd5270d2b236c818068d | |
| EIGEN_SHORTREF: d791d48859c6 | |
| jobs: | |
| build: | |
| name: Build open_iA | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| # , macos-latest | |
| permissions: | |
| # required for all workflows | |
| security-events: write | |
| steps: | |
| - name: Checkout open_iA | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| fetch-tags: true | |
| fetch-depth: 500 | |
| - name: Qt install | |
| # see https://github.com/marketplace/actions/install-qt for details | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: ${{env.QT_VERSION}} | |
| modules: 'qtcharts qthttpserver qtwebsockets' | |
| setup-python: false | |
| cache: true | |
| cache-key-prefix: Qt | |
| ################################################################## | |
| # VR: OpenXR, OpenVR, boost | |
| - if: runner.os == 'Windows' | |
| name: Check cache OpenXR | |
| uses: actions/cache@v4 | |
| id: cache-openxr | |
| with: | |
| path: openxr-${{ env.OPENXR_VERSION }} | |
| key: ${{ runner.os }}-openxr-${{ env.OPENXR_VERSION }} | |
| - if: ${{ (runner.os == 'Windows' && steps.cache-openxr.outputs.cache-hit != 'true' ) }} | |
| name: Download OpenXR | |
| run: | | |
| curl -L https://github.com/KhronosGroup/OpenXR-SDK-Source/releases/download/release-${{ env.OPENXR_VERSION }}/openxr_loader_windows-${{ env.OPENXR_VERSION }}.zip --output openxr-${{ env.OPENXR_VERSION }}.zip | |
| Expand-Archive openxr-${{ env.OPENXR_VERSION }}.zip -DestinationPath openxr-${{ env.OPENXR_VERSION }} | |
| - if: runner.os == 'Windows' | |
| name: Set up OpenXR options | |
| run: | | |
| "VTK_CMAKE_OPTIONS=${{env.VTK_CMAKE_OPTIONS}} -DVTK_MODULE_ENABLE_VTK_RenderingOpenXR:BOOL=YES -DOpenXR_DIR:PATH=${{github.workspace}}/openxr-${{ env.OPENXR_VERSION }}/x64/lib/cmake/openxr" >> $env:GITHUB_ENV | |
| "ITK_CMAKE_OPTIONS=${{env.ITK_CMAKE_OPTIONS}} -DOpenXR_DIR:PATH=${{github.workspace}}/openxr-${{ env.OPENXR_VERSION }}/x64/lib/cmake/openxr" >> $env:GITHUB_ENV | |
| "OPENIA_CMAKE_OPTIONS=${{env.OPENIA_CMAKE_OPTIONS}} -DOpenXR_DIR:PATH=${{github.workspace}}/openxr-${{ env.OPENXR_VERSION }}/x64/lib/cmake/openxr" >> $env:GITHUB_ENV | |
| - if: runner.os == 'Windows' | |
| name: Check cache OpenVR | |
| uses: actions/cache@v4 | |
| id: cache-openvr | |
| with: | |
| path: openvr-${{ env.OPENVR_VERSION }} | |
| key: ${{ runner.os }}-openvr-${{ env.OPENVR_VERSION }} | |
| - if: ${{ (runner.os == 'Windows' && steps.cache-openvr.outputs.cache-hit != 'true' ) }} | |
| name: Download OpenVR | |
| run: | | |
| curl -L https://github.com/ValveSoftware/openvr/archive/v${{ env.OPENVR_VERSION }}.zip --output openvr-${{ env.OPENVR_VERSION }}.zip | |
| Expand-Archive openvr-${{ env.OPENVR_VERSION }}.zip -DestinationPath . | |
| - if: runner.os == 'Windows' | |
| name: Set up OpenVR options | |
| run: | | |
| "VTK_CMAKE_OPTIONS=${{env.VTK_CMAKE_OPTIONS}} -DVTK_MODULE_ENABLE_VTK_RenderingOpenVR:BOOL=YES -DOpenVR_INCLUDE_DIR:PATH=${{github.workspace}}/openvr-${{ env.OPENVR_VERSION }}/headers -DOpenVR_LIBRARY:FILEPATH=${{github.workspace}}/openvr-${{ env.OPENVR_VERSION }}/lib/win64/openvr_api.lib" >> $env:GITHUB_ENV | |
| "ITK_CMAKE_OPTIONS=${{env.ITK_CMAKE_OPTIONS}} -DOpenVR_INCLUDE_DIR:PATH=${{github.workspace}}/openvr-${{ env.OPENVR_VERSION }}/headers -DOpenVR_LIBRARY:FILEPATH=${{github.workspace}}/openvr-${{ env.OPENVR_VERSION }}/lib/win64/openvr_api.lib" >> $env:GITHUB_ENV | |
| "OPENIA_CMAKE_OPTIONS=${{env.OPENIA_CMAKE_OPTIONS}} -DOpenVR_INCLUDE_DIR:PATH=${{github.workspace}}/openvr-${{ env.OPENVR_VERSION }}/headers -DOpenVR_LIBRARY:FILEPATH=${{github.workspace}}/openvr-${{ env.OPENVR_VERSION }}/lib/win64/openvr_api.lib" >> $env:GITHUB_ENV | |
| # set up boost, required for VR: | |
| - if: runner.os == 'Windows' | |
| name: Check cache Boost | |
| uses: actions/cache@v4 | |
| id: cache-boost | |
| with: | |
| path: boost-${{ env.BOOST_VERSION_UNDERSCORE }} | |
| key: ${{ runner.os }}-boost-${{ env.BOOST_VERSION }} | |
| - if: ${{ (runner.os == 'Windows' && steps.cache-boost.outputs.cache-hit != 'true' ) }} | |
| name: Download Boost | |
| run: | | |
| curl -L https://archives.boost.io/release/${{env.BOOST_VERSION}}/source/boost_${{env.BOOST_VERSION_UNDERSCORE}}.zip --output boost-${{ env.BOOST_VERSION }}.zip | |
| Expand-Archive boost-${{ env.BOOST_VERSION }}.zip -DestinationPath . | |
| #- if: runner.os == 'Linux' | |
| # name: Install OpenXR and OpenVR | |
| # run: | | |
| # sudo apt update && apt install libopenxr-dev libopenvr-dev libboost-dev | |
| # boost could be problematic - no findpackage(boost) in open_iA (yet) | |
| # enable open_iA VR modules, set boost path | |
| - if: runner.os == 'Windows' | |
| name: Set up VR modules | |
| run: | | |
| "OPENIA_CMAKE_OPTIONS=${{env.OPENIA_CMAKE_OPTIONS}} -DModule_ImNDT:BOOL=YES -DModule_VRAnnotation:BOOL=YES -DModule_XVRA:BOOL=YES -DBOOST_INCLUDE_DIR=${{github.workspace}}/boost_${{env.BOOST_VERSION_UNDERSCORE}}" >> $env:GITHUB_ENV | |
| ################################################################## | |
| # VTK | |
| - name: Check cache for VTK build | |
| id: cache-vtk | |
| uses: actions/cache@v4 | |
| with: | |
| path: vtk-${{ env.VTK_VERSION }} | |
| key: ${{ runner.os }}-qt${{env.QT_VERSION}}-vtk-${{ env.VTK_VERSION }} | |
| - if: ${{ ( runner.os == 'Linux' && steps.cache-vtk.outputs.cache-hit != 'true' ) }} | |
| name: VTK install prerequisites (Linux) | |
| run: | | |
| sudo apt update && sudo apt install libopengl-dev libglx-dev libglw-dev | |
| - if: steps.cache-vtk.outputs.cache-hit != 'true' | |
| name: VTK download, extract, configure, build, install | |
| run: | | |
| mkdir vtk | |
| curl https://vtk.org/files/release/${{ env.VTK_SHORTVER }}/VTK-${{ env.VTK_VERSION }}.tar.gz --output vtk/src-${{ env.VTK_VERSION }}.tar.gz | |
| cd vtk | |
| tar -xzf src-${{ env.VTK_VERSION }}.tar.gz | |
| mkdir bin-${{ env.VTK_VERSION }} | |
| cd bin-${{ env.VTK_VERSION }} | |
| cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.VTK_CMAKE_OPTIONS}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vtk-${{ env.VTK_VERSION }} ../VTK-${{ env.VTK_VERSION }} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} | |
| cd ../.. | |
| rm -r vtk | |
| ################################################################## | |
| # ITK | |
| - name: Check cache for ITK build | |
| id: cache-itk | |
| uses: actions/cache@v4 | |
| with: | |
| path: itk-${{ env.ITK_VERSION }} | |
| key: ${{ runner.os }}-qt${{env.QT_VERSION}}-itk-${{ env.ITK_VERSION }} | |
| - if: runner.os == 'Windows' | |
| # Since ITK install is currently broken on Windows (see below), we also need to cache source folder here: | |
| name: Check cache for ITK source folder | |
| id: cache-itk-src | |
| uses: actions/cache@v4 | |
| with: | |
| path: itk-src-${{ env.ITK_VERSION }} | |
| key: ${{ runner.os }}-qt${{env.QT_VERSION}}-itk-src-${{ env.ITK_VERSION }} | |
| - if: steps.cache-itk.outputs.cache-hit != 'true' | |
| name: ITK download and extract | |
| run: | | |
| curl -L https://github.com/InsightSoftwareConsortium/ITK/archive/refs/tags/v${{ env.ITK_VERSION }}.tar.gz --output itk-src-${{ env.ITK_VERSION }}.tar.gz | |
| tar -xzf itk-src-${{ env.ITK_VERSION }}.tar.gz | |
| mv ITK-${{ env.ITK_VERSION }} itk-src-${{ env.ITK_VERSION }} | |
| - if: ${{ runner.os == 'Linux' && steps.cache-itk.outputs.cache-hit != 'true' }} | |
| # TODO: maybe just set a environment variable or something to the build directory depending on OS? | |
| name: ITK configure, build, install (Linux) | |
| run: | | |
| mkdir -p itk-bin-${{ env.ITK_VERSION }} | |
| cd itk-bin-${{ env.ITK_VERSION }} | |
| cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.ITK_CMAKE_OPTIONS}} -DVTK_DIR:PATH=${{github.workspace}}/vtk-${{ env.VTK_VERSION }}/lib/cmake/vtk-${{ env.VTK_SHORTVER }} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/itk-${{ env.ITK_VERSION }} ../itk-src-${{ env.ITK_VERSION }} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} | |
| cd .. | |
| rm -r itk-src-${{ env.ITK_VERSION }} itk-bin-${{ env.ITK_VERSION }} | |
| - if: runner.os == 'Linux' | |
| name: set ITK_DIR (Linux) | |
| run: | | |
| echo "ITK_DIR=${{github.workspace}}/itk-${{ env.ITK_VERSION }}/lib/cmake/ITK-${{ env.ITK_SHORTVER }}" >> "$GITHUB_ENV" | |
| - if: ${{ runner.os == 'Windows' && (steps.cache-itk.outputs.cache-hit != 'true' || steps.cache-itk-src.outputs.cache-hit != 'true') }} | |
| # ITK install is currently broken on Windows, see https://discourse.itk.org/t/7414 | |
| # therefore, we build ITK instead at the location to which we would otherwise install it, and keep the build and source folder (see also src cache step above): | |
| name: ITK configure, build (Windows) | |
| run: | | |
| mkdir itk-${{ env.ITK_VERSION }} | |
| cd itk-${{ env.ITK_VERSION }} | |
| cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.ITK_CMAKE_OPTIONS}} -DVTK_DIR:PATH=${{github.workspace}}/vtk-${{ env.VTK_VERSION }}/lib/cmake/vtk-${{ env.VTK_SHORTVER }} ../itk-src-${{ env.ITK_VERSION }} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cd .. | |
| rm itk-src-${{ env.ITK_VERSION }}.tar.gz | |
| - if: runner.os == 'Windows' | |
| name: set ITK_DIR (Windows) | |
| run: | | |
| "ITK_DIR=${{github.workspace}}/itk-${{ env.ITK_VERSION }}" >> $env:GITHUB_ENV | |
| ################################################################## | |
| # eigen | |
| - name: Check cache for eigen | |
| id: cache-eigen | |
| uses: actions/cache@v4 | |
| with: | |
| path: eigen-${{env.EIGEN_SHORTREF}} | |
| key: ${{ runner.os }}-eigen-${{env.EIGEN_SHORTREF}} | |
| - if: steps.cache-eigen.outputs.cache-hit != 'true' | |
| name: Clone eigen repository | |
| # "workaround" for only checking out a specific commit, from https://stackoverflow.com/a/78674407: | |
| run: | | |
| mkdir eigen-${{env.EIGEN_SHORTREF}} | |
| cd eigen-${{env.EIGEN_SHORTREF}} | |
| git init | |
| git remote add origin https://gitlab.com/libeigen/eigen.git | |
| git fetch origin --depth 1 ${{env.EIGEN_LONGREF}} | |
| git checkout FETCH_HEAD | |
| ################################################################## | |
| # HDF5 | |
| - name: Check cache for hdf5 | |
| id: cache-hdf5 | |
| uses: actions/cache@v4 | |
| with: | |
| path: hdf5-${{env.HDF5_VERSION}} | |
| key: ${{ runner.os }}-hdf5-${{env.HDF5_VERSION}} | |
| - if: steps.cache-hdf5.outputs.cache-hit != 'true' | |
| name: Build hdf5 | |
| run: | | |
| mkdir hdf5 | |
| cd hdf5 | |
| curl -L https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_${{env.HDF5_VERSION}}.tar.gz --output src-${{ env.HDF5_VERSION }}.tar.gz | |
| tar xf src-${{ env.HDF5_VERSION }}.tar.gz | |
| curl -L https://github.com/madler/zlib/releases/download/v${{env.HDF5_ZLIB_VERSION}}/zlib-${{env.HDF5_ZLIB_VERSION}}.tar.gz --output zlib-${{env.HDF5_ZLIB_VERSION}}.tar.gz | |
| mkdir bin | |
| cd bin | |
| cmake -C ../hdf5-hdf5_${{env.HDF5_VERSION}}/config/cmake/cacheinit.cmake --log-level=VERBOSE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DBUILD_SHARED_LIBS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_TGZ_NAME:STRING=zlib-${{env.HDF5_ZLIB_VERSION}}.tar.gz -DZLIB_USE_LOCALCONTENT:BOOL=ON -DZLIB_USE_EXTERNAL:BOOL=ON -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DTGZPATH:PATH=${{github.workspace}}/hdf5 -DCMAKE_INSTALL_PREFIX:PATH=${{github.workspace}}/hdf5-${{env.HDF5_VERSION}} ../hdf5-hdf5_${{env.HDF5_VERSION}} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} | |
| ################################################################## | |
| # Node/npm (required for Remote module) | |
| - name: Install npm | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| ################################################################## | |
| # open_iA | |
| # dependencies stated in superbuild: libgl1-mesa-dev libxt-dev libxt-dev libxcursor-dev libsdl2-dev | |
| # VR: libboost-dev libopenvr-dev libopenxr-dev | |
| # OpenCL: ocl-icd-opencl-dev opencl-headers opencl-clhpp-headers | |
| # clang: clang libomp-dev | |
| # if: runner.os == 'Linux' only runs on ubuntu currently anyway | |
| - name: open_iA build | |
| run: | | |
| mkdir bin | |
| cd bin | |
| cmake -B . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.OPENIA_CMAKE_OPTIONS}} -DITK_DIR=${{env.ITK_DIR}} -DEIGEN3_INCLUDE_DIR=${{github.workspace}}/eigen-${{env.EIGEN_SHORTREF}} -DHDF5_DIR:PATH=${{github.workspace}}/hdf5-${{env.HDF5_VERSION}}/cmake .. | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install | |
| - name: Create zip archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open_iA-${{runner.os}}-latest.zip | |
| path: ${{github.workspace}}/install | |
| if-no-files-found: error | |
| overwrite: true |