STYLE: Make ParameterMapInterface default-constructible #2
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: Elastix | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| max-parallel: 3 | |
| matrix: | |
| os: [ubuntu-22.04, windows-2022, macos-14] | |
| include: | |
| - os: ubuntu-22.04 | |
| c-compiler: "gcc" | |
| cxx-compiler: "g++" | |
| libtorch-cpu-url: "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.8.0%2Bcpu.zip" | |
| cuda-version: "cpu" | |
| itk-git-tag: "v5.4.5" | |
| cmake-build-type: "Release" | |
| libs: | |
| - elastix-build/bin/libelx-ANNlib.so | |
| - elastix-build/bin/libImpactMetric.so | |
| - os: windows-2022 | |
| c-compiler: "cl.exe" | |
| cxx-compiler: "cl.exe" | |
| libtorch-cpu-url: "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.8.0%2Bcpu.zip" | |
| cuda-version: "cpu" | |
| itk-git-tag: "v5.4.5" | |
| cmake-build-type: "Release" | |
| libs: | |
| - elastix-build/bin/elx-ANNlib.dll | |
| - elastix-build/bin/ImpactMetric.dll | |
| vcvars64: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
| - os: macos-14 | |
| c-compiler: "clang" | |
| cxx-compiler: "clang++" | |
| libtorch-cpu-url: "https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.8.0.zip" | |
| cuda-version: "cpu" | |
| itk-git-tag: "v5.4.5" | |
| cmake-build-type: "Release" | |
| libs: | |
| - elastix-build/bin/libelx-ANNlib.dylib | |
| - elastix-build/bin/libImpactMetric.so | |
| steps: | |
| - name: Clone elastix | |
| uses: actions/checkout@v3 | |
| - name: Make directory structure | |
| run: | | |
| items=(*) | |
| mkdir elastix-source | |
| mv ${items[*]} elastix-source | |
| mv .editorconfig elastix-source | |
| mv .clang-format elastix-source | |
| mv elastix-source/Dockerfile . | |
| shell: bash | |
| - name: Clone and build ITK | |
| uses: ./.github/actions/build_itk | |
| with: | |
| itk-git-tag: ${{ matrix.itk-git-tag }} | |
| c-compiler: ${{ matrix.c-compiler }} | |
| cxx-compiler: ${{ matrix.cxx-compiler }} | |
| cmake-build-type: ${{ matrix.cmake-build-type }} | |
| vcvars: ${{ matrix.vcvars64 }} | |
| - name: Download and extract libtorch | |
| if: matrix.os != 'macos-14' | |
| uses: ./.github/actions/download_libtorch | |
| with: | |
| libtorch_url: ${{ matrix.libtorch-cpu-url }} | |
| - name: Build libtorch | |
| if: matrix.os == 'macos-14' | |
| uses: ./.github/actions/build_libtorch | |
| with: | |
| install_prefix: ${{ github.workspace }}/libtorch/libtorch | |
| - name: Set up Python | |
| uses: actions/setup-python@v5.4.0 | |
| with: | |
| python-version: 3.9 | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install ninja | |
| - name: Get specific version of CMake, Ninja | |
| uses: lukka/get-cmake@latest | |
| - name: Install requirements of PythonTests | |
| run: python -m pip install -r ${{ github.workspace }}/elastix-source/Testing/PythonTests/requirements.txt | |
| - name: Configure CTest script | |
| shell: bash | |
| run: | | |
| operating_system="${{ matrix.os }}" | |
| cat > dashboard.cmake << EOF | |
| set(CTEST_SITE "GitHubActions") | |
| file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}" CTEST_DASHBOARD_ROOT) | |
| file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/elastix-source" CTEST_SOURCE_DIRECTORY) | |
| file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/elastix-build" CTEST_BINARY_DIRECTORY) | |
| set(dashboard_source_name "${GITHUB_REPOSITORY}") | |
| set(branch "${GITHUB_REF#refs/heads/}") | |
| set(sha "${GITHUB_SHA}") | |
| set(dashboard_model "Experimental") | |
| set(CTEST_BUILD_NAME "${GITHUB_REPOSITORY}-${operating_system}-\${branch}-\${sha}") | |
| set(CTEST_UPDATE_VERSION_ONLY 1) | |
| set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL}) | |
| set(CTEST_BUILD_CONFIGURATION "Release") | |
| set(CTEST_CMAKE_GENERATOR "Ninja") | |
| set(dashboard_no_clean 1) | |
| set(ENV{CC} ${{ matrix.c-compiler }}) | |
| set(ENV{CXX} ${{ matrix.cxx-compiler }}) | |
| if(WIN32) | |
| set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\${CTEST_DASHBOARD_ROOT}/libtorch/libtorch/lib;\$ENV{PATH}") | |
| endif() | |
| set(dashboard_cache " | |
| ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build | |
| Torch_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/libtorch/libtorch/share/cmake/Torch | |
| ELASTIX_USE_GTEST:BOOL=ON | |
| USE_ALL_COMPONENTS:BOOL=ON | |
| BUILD_TESTING:BOOL=ON | |
| ") | |
| string(TIMESTAMP build_date "%Y-%m-%d") | |
| message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}") | |
| message("CTEST_SITE= \${CTEST_SITE}") | |
| include(\${CTEST_SOURCE_DIRECTORY}/Testing/Dashboard/elxCommonCDash.cmake) | |
| EOF | |
| cat dashboard.cmake | |
| - name: Test (MacOs) | |
| if: startsWith(matrix.os, 'macos') | |
| run: ctest --output-on-failure -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP|elastix_run_3DCT_lung.NMI.bspline.ASGD.001_COMPARE_TP" -S dashboard.cmake | |
| - name: Test (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| call "${{ matrix.vcvars64 }}" | |
| ctest --output-on-failure -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP" -S dashboard.cmake | |
| shell: cmd | |
| - name: Test (Ubuntu) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: ctest --output-on-failure -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP" -S dashboard.cmake | |
| - name: Build externalproject example (non-Windows) | |
| if: ${{ !startsWith(matrix.os, 'windows') }} | |
| run: | | |
| mkdir externalproject-build | |
| cd externalproject-build | |
| cmake -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DElastix_DIR=${{ github.workspace }}/elastix-build -GNinja ../elastix-source/dox/externalproject | |
| ninja | |
| - name: Build externalproject example (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| mkdir externalproject-build | |
| cd externalproject-build | |
| call "${{ matrix.vcvars64 }}" | |
| cmake -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DElastix_DIR=${{ github.workspace }}/Elastix-build -GNinja ../elastix-source/dox/externalproject | |
| ninja | |
| shell: cmd | |
| - name: Run externalproject example (non-Windows) | |
| if: ${{ !startsWith(matrix.os, 'windows') }} | |
| run: | | |
| cd externalproject-build | |
| ./elastix_impact_metric_example | |
| - name: Run externalproject example (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| set PATH=${{ github.workspace }}\Elastix-build\bin;${{ github.workspace }}\libtorch\libtorch\lib;%PATH% | |
| cd externalproject-build | |
| .\elastix_impact_metric_example.exe | |
| shell: cmd | |
| - name: Publish | |
| uses: ./.github/actions/publish | |
| with: | |
| libs: ${{ join(matrix.libs, ' ') }} | |
| upload-name: ${{ matrix.os }}-libtorch-2.8.0-${{ matrix.cuda-version }} | |
| docker-username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| docker-password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |