From 9f9403c7a5fa320f0f88a87eedbd6debfcc0cc7e Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Wed, 11 Jan 2023 11:29:44 -0500 Subject: [PATCH 1/3] ENH: Build windows binaries COMP: Switch to ITK zlib Using ITK zlib avoids having to build zlib on Windows. Appears to build fine on Mac OS also. --- .github/workflows/release-win-binaries.yml | 78 ++++++++++++++++++++++ SuperBuild/External_ITKv5.cmake | 4 +- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-win-binaries.yml diff --git a/.github/workflows/release-win-binaries.yml b/.github/workflows/release-win-binaries.yml new file mode 100644 index 000000000..b5d90a302 --- /dev/null +++ b/.github/workflows/release-win-binaries.yml @@ -0,0 +1,78 @@ +# Build for Windows using visual studio +name: Native Windows release binaries + +# Controls when the action will run. Triggers the workflow on push +on: + release: + types: [created] + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - { + name: "Windows-22", + os: "windows-2022", + vs: "2019", + build_type: "Release" + } + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} + # Set up vs studio. Use default windows shell (powershell) not bash, + # to avoid conflicts with link executable + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ runner.arch }} + vsversion: ${{ matrix.vs }} + - name: Get ANTs version + run: | + $antsVersion="${{ env.ANTS_TAG }}" + $antsVersion=$antsVersion.Substring(1) + echo "ANTS_VERSION=$antsVersion" | Out-File -FilePath $env:GITHUB_ENV -Append + env: + ANTS_TAG: ${{ github.ref_name }} + - name: Define env + run: | + echo github.event.action: ${{ github.event.action }} + echo "ARTIFACT=${{ runner.temp }}/ants-${{ env.ANTS_VERSION }}-${{ matrix.config.os }}-${{ runner.arch }}-VS${{ matrix.config.vs }}.zip" | Out-File -FilePath $env:GITHUB_ENV -Append + - name: Configure + working-directory: ${{ runner.temp }} + run: | + mkdir build + cd build + cmake ` + -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} ` + -DCMAKE_INSTALL_PREFIX:PATH=${{ runner.temp }}/install/ants-${{ env.ANTS_VERSION }} ` + ${{ github.workspace }} + - name: Build + working-directory: ${{ runner.temp }} + run: | + cd build + cmake --build . --config ${{ matrix.config.build_type }} --parallel + - name: Install + working-directory: ${{ runner.temp }} + run: | + cd build/ANTS-build + cmake --install . + - name: Pack + working-directory: ${{ runner.temp }} + run: | + cd install + 7z a ${{ env.ARTIFACT }} . + - name: Upload release asset + # Previously was using actions/upload-release-asset@v1 , but this had some + # errors with large files + uses: ncipollo/release-action@v1.11.1 + with: + allowUpdates: true + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + artifacts: "${{ env.ARTIFACT }}" + artifactContentType: application/zip + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/SuperBuild/External_ITKv5.cmake b/SuperBuild/External_ITKv5.cmake index ceca05ef5..41d7e6ca9 100644 --- a/SuperBuild/External_ITKv5.cmake +++ b/SuperBuild/External_ITKv5.cmake @@ -109,7 +109,8 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) string(REPLACE "-fopenmp" "" ITK_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REPLACE "-fopenmp" "" ITK_CMAKE_CXX_FLAGS "${CMAKE_CX_FLAGS}") - find_package(ZLIB REQUIRED) + # ITK now has zlib-ng, so we no longer depend on system zlib + # find_package(ZLIB REQUIRED) set(${proj}_CMAKE_OPTIONS -DBUILD_TESTING:BOOL=OFF @@ -129,6 +130,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) #-DITK_INSTALL_NO_DEVELOPMENT:BOOL=ON -DKWSYS_USE_MD5:BOOL=ON # Required by SlicerExecutionModel -DITK_WRAPPING:BOOL=OFF #${BUILD_SHARED_LIBS} ## HACK: QUICK CHANGE + -DITKZLIB:BOOL=ON -DModule_MGHIO:BOOL=ON -DModule_ITKReview:BOOL=ON -DModule_GenericLabelInterpolator:BOOL=ON From 5b2d314803cbb15aa163f90b6d79e46ef4afce8f Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Wed, 11 Jan 2023 22:43:08 -0500 Subject: [PATCH 2/3] ENH: Run tests on release --- .github/workflows/release-binaries.yml | 9 +++++++++ .github/workflows/release-docker-binaries.yml | 9 +++++++++ .github/workflows/release-win-binaries.yml | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index e1c53a28a..f58edaab1 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -96,6 +96,9 @@ jobs: cmake \ -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -G "${{ matrix.config.generators }}" \ + -DBUILD_TESTING=ON \ + -DRUN_SHORT_TESTS=ON \ + -DRUN_LONG_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX:PATH=${{ runner.temp }}/install/ants-${{ env.ANTS_VERSION }} \ ${GITHUB_WORKSPACE} - name: Build @@ -104,6 +107,12 @@ jobs: run: | cd build cmake --build . --config ${{ matrix.config.build_type }} --parallel + - name: Test + shell: bash + working-directory: ${{ runner.temp }} + run: | + cd build/ANTS-build + ctest - name: Install shell: bash working-directory: ${{ runner.temp }} diff --git a/.github/workflows/release-docker-binaries.yml b/.github/workflows/release-docker-binaries.yml index da706a77b..a5be387f9 100644 --- a/.github/workflows/release-docker-binaries.yml +++ b/.github/workflows/release-docker-binaries.yml @@ -64,6 +64,9 @@ jobs: cmake \ -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -G "${{ matrix.config.generators }}" \ + -DBUILD_TESTING=ON \ + -DRUN_SHORT_TESTS=ON \ + -DRUN_LONG_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX:PATH=/opt/install/ants-${{ env.ANTS_VERSION }} \ ${GITHUB_WORKSPACE} - name: Build @@ -71,6 +74,12 @@ jobs: run: | cd /opt/build cmake --build . --config ${{ matrix.config.build_type }} --parallel 1 + - name: Test + shell: bash + working-directory: ${{ runner.temp }} + run: | + cd build/ANTS-build + ctest - name: Install shell: bash run: | diff --git a/.github/workflows/release-win-binaries.yml b/.github/workflows/release-win-binaries.yml index b5d90a302..2f03faf72 100644 --- a/.github/workflows/release-win-binaries.yml +++ b/.github/workflows/release-win-binaries.yml @@ -48,6 +48,9 @@ jobs: cd build cmake ` -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} ` + -DBUILD_TESTING=ON ` + -DRUN_SHORT_TESTS=ON ` + -DRUN_LONG_TESTS=OFF ` -DCMAKE_INSTALL_PREFIX:PATH=${{ runner.temp }}/install/ants-${{ env.ANTS_VERSION }} ` ${{ github.workspace }} - name: Build @@ -60,6 +63,11 @@ jobs: run: | cd build/ANTS-build cmake --install . + - name: Test + working-directory: ${{ runner.temp }} + run: | + cd build/ANTS-build + ctest - name: Pack working-directory: ${{ runner.temp }} run: | From 4c58ea3596c76d0a8515a839965ee063bb0bb62c Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Thu, 12 Jan 2023 00:33:10 -0500 Subject: [PATCH 3/3] BUG: Fixing test config. Windows requires ctest -C --- .github/workflows/release-docker-binaries.yml | 2 +- .github/workflows/release-win-binaries.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-docker-binaries.yml b/.github/workflows/release-docker-binaries.yml index a5be387f9..9cdab0bc9 100644 --- a/.github/workflows/release-docker-binaries.yml +++ b/.github/workflows/release-docker-binaries.yml @@ -78,7 +78,7 @@ jobs: shell: bash working-directory: ${{ runner.temp }} run: | - cd build/ANTS-build + cd /opt/build/ANTS-build ctest - name: Install shell: bash diff --git a/.github/workflows/release-win-binaries.yml b/.github/workflows/release-win-binaries.yml index 2f03faf72..7acec1bfa 100644 --- a/.github/workflows/release-win-binaries.yml +++ b/.github/workflows/release-win-binaries.yml @@ -58,16 +58,16 @@ jobs: run: | cd build cmake --build . --config ${{ matrix.config.build_type }} --parallel - - name: Install + - name: Test working-directory: ${{ runner.temp }} run: | cd build/ANTS-build - cmake --install . - - name: Test + ctest -C release + - name: Install working-directory: ${{ runner.temp }} run: | cd build/ANTS-build - ctest + cmake --install . - name: Pack working-directory: ${{ runner.temp }} run: |