From 34a57ebebdb6069b02bee34f3fc27eda0a1a26ca Mon Sep 17 00:00:00 2001 From: Alan Morris Date: Thu, 19 Nov 2026 21:46:53 -0700 Subject: [PATCH 1/4] Retry dependency clones and stop on clone/checkout failure (#2712) A dropped connection while cloning VTK left build_dependencies.sh running against a missing directory, burying the real error. Clones now go through clone_repo, which reuses an existing clone, retries up to three times, and exits on failure; checkouts and cd's also exit on failure. --- build_dependencies.sh | 82 ++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index a1eab606a6..a86b7dd8b7 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -143,14 +143,37 @@ at_least_required_version() fi } +# clone_repo +# Clones into (relative to the current directory) and cd's into it. +# An existing clone is reused. Network failures are retried, and the script +# exits if the clone still fails so the real error isn't buried. +clone_repo() +{ + local dir=$1 + shift + if [[ ! -d "${dir}/.git" ]]; then + local attempt + for attempt in 1 2 3; do + rm -rf "${dir}" + git clone "$@" "${dir}" && break + if [[ $attempt == 3 ]]; then + echo "## ERROR: failed to clone ${dir} after ${attempt} attempts" + exit 1 + fi + echo "## clone of ${dir} failed (attempt ${attempt}), retrying in 30s..." + sleep 30 + done + fi + cd "${dir}" || exit 1 +} + build_vtk() { echo "" echo "## Building vtk..." - cd ${BUILD_DIR} - git clone https://gitlab.kitware.com/vtk/vtk.git - cd vtk - git checkout -f tags/${VTK_VER} + cd ${BUILD_DIR} || exit 1 + clone_repo vtk https://gitlab.kitware.com/vtk/vtk.git + git checkout -f tags/${VTK_VER} || exit 1 patch -p1 < ${SCRIPT_DIR}/Support/vtk-9.5.patch if [[ $BUILD_CLEAN = 1 ]]; then rm -rf build; fi mkdir -p build && cd build @@ -180,10 +203,9 @@ build_itk() { echo "" echo "## Building itk..." - cd ${BUILD_DIR} - git clone https://github.com/InsightSoftwareConsortium/ITK.git - cd ITK - git checkout -f tags/${ITK_VER} + cd ${BUILD_DIR} || exit 1 + clone_repo ITK https://github.com/InsightSoftwareConsortium/ITK.git + git checkout -f tags/${ITK_VER} || exit 1 # replace with in Modules/ThirdParty/PNG/src/itkpng/pngpriv.h if [ "$(uname)" == "Darwin" ]; then @@ -215,12 +237,11 @@ build_xlnt() { echo "" echo "## Building Xlnt..." - cd ${BUILD_DIR} - git clone https://github.com/tfussell/xlnt.git - cd xlnt - git checkout -f ${XLNT_VER} - git submodule init - git submodule update + cd ${BUILD_DIR} || exit 1 + clone_repo xlnt https://github.com/tfussell/xlnt.git + git checkout -f ${XLNT_VER} || exit 1 + git submodule init || exit 1 + git submodule update || exit 1 # move conflicting file out of the way so it builds on osx mv third-party/libstudxml/version third-party/libstudxml/version.bak @@ -254,9 +275,8 @@ build_jkqtplotter() { echo "" echo "## Building JKQTPlotter..." - cd ${BUILD_DIR} - git clone --depth 1 --branch ${JKQTPLOTTER_VER} https://github.com/akenmorris/JKQtPlotter.git jkqtplotter - cd jkqtplotter + cd ${BUILD_DIR} || exit 1 + clone_repo jkqtplotter --depth 1 --branch ${JKQTPLOTTER_VER} https://github.com/akenmorris/JKQtPlotter.git # fix compile on windows sed -i '1s/^/#include \n/' lib/jkqtcommon/jkqtpdebuggingtools.h @@ -281,10 +301,9 @@ build_openvdb() { echo "" echo "## Building OpenVDB..." - cd ${BUILD_DIR} - git clone https://github.com/AcademySoftwareFoundation/openvdb.git - cd openvdb - git checkout ${OpenVDB_VER} + cd ${BUILD_DIR} || exit 1 + clone_repo openvdb https://github.com/AcademySoftwareFoundation/openvdb.git + git checkout ${OpenVDB_VER} || exit 1 # patch for Clang 17 patch -p1 < ${SCRIPT_DIR}/Support/openvdb-9.1.0.patch @@ -314,10 +333,9 @@ build_igl() { echo " " echo "## Building Libigl..." - cd ${INSTALL_DIR} - git clone https://github.com/libigl/libigl.git - cd libigl - git checkout -f tags/${libigl_VER} + cd ${INSTALL_DIR} || exit 1 + clone_repo libigl https://github.com/libigl/libigl.git + git checkout -f tags/${libigl_VER} || exit 1 LIBIGL_DIR=${INSTALL_DIR}/libigl/cmake } @@ -326,10 +344,9 @@ build_geometry_central() { echo " " echo "## Building Geometry central..." - cd ${BUILD_DIR} - git clone --recursive https://github.com/nmwsharp/geometry-central.git - cd geometry-central - git checkout -f ${geometry_central_VER} + cd ${BUILD_DIR} || exit 1 + clone_repo geometry-central --recursive https://github.com/nmwsharp/geometry-central.git + git checkout -f ${geometry_central_VER} || exit 1 mkdir build if [[ $BUILD_CLEAN = 1 ]]; then rm -rf build; fi @@ -359,11 +376,10 @@ build_acvd() { echo "" echo "## Building ACVD..." - cd ${BUILD_DIR} + cd ${BUILD_DIR} || exit 1 #git clone https://github.com/valette/ACVD.git acvd - git clone https://github.com/akenmorris/ACVD.git acvd - cd acvd - git checkout -f ${ACVD_VER} + clone_repo acvd https://github.com/akenmorris/ACVD.git + git checkout -f ${ACVD_VER} || exit 1 # silence a bunch of output sed -i'.original' -e 's/cout/if(0)cout/' Common/vtkCurvatureMeasure.cxx From a84c52474358f862e2ef89c3d90b92846cb636a1 Mon Sep 17 00:00:00 2001 From: Alan Morris Date: Fri, 20 Nov 2026 00:46:33 -0700 Subject: [PATCH 2/4] Download CI assets from a GitHub release instead of sci.utah.edu The windows-2022 runner image no longer trusts the emSign root behind www.sci.utah.edu's new certificate, breaking the NSIS and tiny test data downloads. The NSIS, tiny test data, and rsync archives now come from the ci-assets release; the rsync download also follows redirects, since the old http URL returned a 302 page instead of the archive. --- .github/workflows/build-windows.yml | 2 +- .github/workflows/copy_artifact.sh | 4 ++-- .github/workflows/download_test_data.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 0e475f0f15..a0040bed6c 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -83,7 +83,7 @@ jobs: - name: Get NSIS working-directory: ${{runner.workspace}} run: | - curl -o nsis.zip https://www.sci.utah.edu/~amorris/NSISPortable_3.04.zip + curl -fL -o nsis.zip https://github.com/SCIInstitute/ShapeWorks/releases/download/ci-assets/NSISPortable_3.04.zip Expand-Archive -LiteralPath nsis.zip -DestinationPath . - name: Conda Installs diff --git a/.github/workflows/copy_artifact.sh b/.github/workflows/copy_artifact.sh index 88f81600f4..5f3e771cd6 100755 --- a/.github/workflows/copy_artifact.sh +++ b/.github/workflows/copy_artifact.sh @@ -16,12 +16,12 @@ if [[ "$PLATFORM" == "windows" ]]; then echo "Installing rsync for Windows/msys2" # These were the original URLs, but they keep changing and it's time consuming to keep up - # So I have just combined them in this windows_rsync.tar.gz that I'm hosting myself + # So I have just combined them in this windows_rsync.tar.gz, hosted on the ci-assets release # https://repo.msys2.org/msys/x86_64/rsync-3.2.3-1-x86_64.pkg.tar.zst # https://repo.msys2.org/msys/x86_64/libzstd-1.5.2-1-x86_64.pkg.tar.zst # https://repo.msys2.org/msys/x86_64/libxxhash-0.8.1-1-x86_64.pkg.tar.zst - curl.exe --output windows_rsync.tar.gz http://www.sci.utah.edu/~amorris/windows_rsync.tar.gz + curl.exe -fL --output windows_rsync.tar.gz https://github.com/SCIInstitute/ShapeWorks/releases/download/ci-assets/windows_rsync.tar.gz tar -xzvf windows_rsync.tar.gz diff --git a/.github/workflows/download_test_data.sh b/.github/workflows/download_test_data.sh index 81d9adec37..0f36a4b256 100755 --- a/.github/workflows/download_test_data.sh +++ b/.github/workflows/download_test_data.sh @@ -25,7 +25,7 @@ for run in {1..5}; do if tar -tzf /tmp/tiny_test_cache.tar.gz > /dev/null 2>&1 ; then break fi - wget --continue --tries=3 --timeout=60 https://www.sci.utah.edu/~shapeworks/doc-resources/zips/tiny_test_cache.tar.gz || true + wget --continue --tries=3 --timeout=60 https://github.com/SCIInstitute/ShapeWorks/releases/download/ci-assets/tiny_test_cache.tar.gz || true sleep 1 done From 451ddeb6a978a410c03c82bf947da04b99a4dc4c Mon Sep 17 00:00:00 2001 From: Alan Morris Date: Fri, 20 Nov 2026 00:48:17 -0700 Subject: [PATCH 3/4] Remove unused copy_artifact.sh Its callers were removed when CI stopped using the remote host cache. --- .github/workflows/copy_artifact.sh | 37 ------------------------------ 1 file changed, 37 deletions(-) delete mode 100755 .github/workflows/copy_artifact.sh diff --git a/.github/workflows/copy_artifact.sh b/.github/workflows/copy_artifact.sh deleted file mode 100755 index 5f3e771cd6..0000000000 --- a/.github/workflows/copy_artifact.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -x - -echo "#############################" -echo "# Copy Artifact #" -echo "#############################" - -. $GITHUB_WORKSPACE/.github/workflows/common.sh - -TARGET="/tmp/${1}.${SUFFIX}" -compress_file $TARGET "${2}" - - -if [[ "$PLATFORM" == "windows" ]]; then - # install rsync on for windows/msys2 (the one from chocolatey doesn't work) - # (adapted from https://github.com/GuillaumeFalourd/setup-rsync) - echo "Installing rsync for Windows/msys2" - - # These were the original URLs, but they keep changing and it's time consuming to keep up - # So I have just combined them in this windows_rsync.tar.gz, hosted on the ci-assets release - - # https://repo.msys2.org/msys/x86_64/rsync-3.2.3-1-x86_64.pkg.tar.zst - # https://repo.msys2.org/msys/x86_64/libzstd-1.5.2-1-x86_64.pkg.tar.zst - # https://repo.msys2.org/msys/x86_64/libxxhash-0.8.1-1-x86_64.pkg.tar.zst - curl.exe -fL --output windows_rsync.tar.gz https://github.com/SCIInstitute/ShapeWorks/releases/download/ci-assets/windows_rsync.tar.gz - - tar -xzvf windows_rsync.tar.gz - - mv usr/bin/* "C:\Program Files\Git\usr\bin\\" - echo "rsync installed on windows runner" -fi - -# try 5 times -for run in {1..5}; do - rsync -av ${TARGET} runner@${CACHE_HOST}:github/artifacts ||: - sleep 1 -done -rm ${TARGET} From 5139062812e7d84ef42762513f9828160b7a7292 Mon Sep 17 00:00:00 2001 From: Alan Morris Date: Fri, 20 Nov 2026 00:57:18 -0700 Subject: [PATCH 4/4] Remove remote cache host scripts and settings CACHE_HOST no longer exists. Drop restore_caches.sh, store_ccache.sh, the CACHE_HOST env var, and the cache archive naming/compression helpers in common.sh that only they used. --- .github/workflows/build-linux-debug.yml | 1 - .github/workflows/build-linux.yml | 1 - .github/workflows/build-mac-arm64.yml | 1 - .github/workflows/build-mac.yml | 1 - .github/workflows/build-windows.yml | 1 - .github/workflows/common.sh | 44 ------------------------- .github/workflows/coverage.yml | 1 - .github/workflows/gha_deps.sh | 2 -- .github/workflows/restore_caches.sh | 43 ------------------------ .github/workflows/store_ccache.sh | 18 ---------- 10 files changed, 113 deletions(-) delete mode 100755 .github/workflows/restore_caches.sh delete mode 100755 .github/workflows/store_ccache.sh diff --git a/.github/workflows/build-linux-debug.yml b/.github/workflows/build-linux-debug.yml index e8bee4e7f6..35be964566 100644 --- a/.github/workflows/build-linux-debug.yml +++ b/.github/workflows/build-linux-debug.yml @@ -16,7 +16,6 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Debug SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }} - CACHE_HOST: ${{ secrets.SSH_HOST }} CCACHE_DIR: /github/home/.ccache CCACHE_MAXSIZE: "500M" CCACHE_COMPRESS: "true" diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f11dc761f4..bf5b247732 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -16,7 +16,6 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }} - CACHE_HOST: ${{ secrets.SSH_HOST }} GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} GA_API_SECRET: ${{ secrets.GA_API_SECRET }} CCACHE_DIR: /github/home/.ccache diff --git a/.github/workflows/build-mac-arm64.yml b/.github/workflows/build-mac-arm64.yml index aa96c4975e..951975c14e 100644 --- a/.github/workflows/build-mac-arm64.yml +++ b/.github/workflows/build-mac-arm64.yml @@ -28,7 +28,6 @@ env: BUILD_TYPE: Release MACOSX_DEPLOYMENT_TARGET: "14.0" SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }} - CACHE_HOST: ${{ secrets.SSH_HOST }} GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} GA_API_SECRET: ${{ secrets.GA_API_SECRET }} CCACHE_DIR: /Users/runner/.ccache diff --git a/.github/workflows/build-mac.yml b/.github/workflows/build-mac.yml index 2c35296685..8f9ef7adc6 100644 --- a/.github/workflows/build-mac.yml +++ b/.github/workflows/build-mac.yml @@ -17,7 +17,6 @@ env: BUILD_TYPE: Release MACOSX_DEPLOYMENT_TARGET: "14.0" SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }} - CACHE_HOST: ${{ secrets.SSH_HOST }} GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} GA_API_SECRET: ${{ secrets.GA_API_SECRET }} CCACHE_DIR: /Users/runner/.ccache diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a0040bed6c..fe0d34d8b3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -16,7 +16,6 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }} - CACHE_HOST: ${{ secrets.SSH_HOST }} GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} GA_API_SECRET: ${{ secrets.GA_API_SECRET }} diff --git a/.github/workflows/common.sh b/.github/workflows/common.sh index 2209673c12..9236182133 100644 --- a/.github/workflows/common.sh +++ b/.github/workflows/common.sh @@ -3,11 +3,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH" fi -# absolute path to this script -SCRIPT=$(readlink -f $0) -# absolute path this script is located -SCRIPT_PATH=`dirname $SCRIPT` - if [[ "$OSTYPE" == "darwin"* ]]; then source ~/.zshrc @@ -23,7 +18,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then CCACHE_DIR="/Users/runner/Library/Caches/ccache" USE_CCACHE="ON" PATH="$(brew --prefix)/opt/gnu-tar/libexec/gnubin:$PATH" - SUFFIX="tar.gz" elif [[ "$OSTYPE" == "linux"* ]]; then if [ -f ~/.bashrc ] ; then source ~/.bashrc @@ -33,53 +27,15 @@ elif [[ "$OSTYPE" == "linux"* ]]; then DEP_PATH="$HOME/install" CCACHE_DIR="$HOME/.ccache" USE_CCACHE="ON" - SUFFIX="tar.gz" else source /c/Users/runneradmin/.bash_profile PLATFORM="windows" CONDA_PATH="C:\Miniconda\envs\shapeworks" DEP_PATH="C:\deps" USE_CCACHE="OFF" - SUFFIX="7z" fi -compress_file() { - if [[ "$PLATFORM" == "windows" ]]; then - 7z -spf a "$1" "$2" - else - df -h - which tar - tar --use-compress-program=pigz -cf "$1" "$2" - fi -} - -decompress_file() { - if [[ "$PLATFORM" == "windows" ]]; then - if 7z t "$1" ; then - 7z -spf x "$1" - fi - else - df -h - which tar - if tar -tzf "$1" >/dev/null ; then - tar --use-compress-program=pigz -xf "$1" - fi - fi -} - - if [[ "$USE_CCACHE" == "ON" ]]; then mkdir -p $CCACHE_DIR echo "compression = true" > $CCACHE_DIR/ccache.conf fi - -CONDA_HASH=`cat $SCRIPT_PATH/../../install_shapeworks.sh $SCRIPT_PATH/../../python_requirements.txt | sha1sum | awk '{ print $1 }'` -echo "CONDA_HASH = ${CONDA_HASH}" -CONDA_FILE="conda-${PLATFORM}-${CONDA_HASH}.${SUFFIX}" - -DEP_HASH=`sha1sum $SCRIPT_PATH/../../build_dependencies.sh | awk '{ print $1 }'` -DEP_HASH="${CONDA_HASH}_${DEP_HASH}" -echo "DEP_HASH = ${DEP_HASH}" -DEP_FILE="dep-${PLATFORM}-${DEP_HASH}-${BUILD_TYPE}.${SUFFIX}" - -CCACHE_FILE="${PLATFORM}-ccache.${SUFFIX}" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 09101e6523..9d6edb605a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -8,7 +8,6 @@ on: env: BUILD_TYPE: Debug SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }} - CACHE_HOST: ${{ secrets.SSH_HOST }} CCACHE_DIR: /github/home/.ccache CCACHE_MAXSIZE: "500M" CCACHE_COMPRESS: "true" diff --git a/.github/workflows/gha_deps.sh b/.github/workflows/gha_deps.sh index b923e81d3c..5ef14b2ac8 100755 --- a/.github/workflows/gha_deps.sh +++ b/.github/workflows/gha_deps.sh @@ -18,11 +18,9 @@ else conda activate shapeworks export INSTALL_DIR="$DEP_PATH" export BUILD_DIR=$HOME/build - export FILE="/tmp/${DEP_FILE}" if [[ "$PLATFORM" == "windows" ]]; then export INSTALL_DIR="C:\deps" export BUILD_DIR="/c/bdeps" - export FILE="${DEP_FILE}" fi NPROCS=4 diff --git a/.github/workflows/restore_caches.sh b/.github/workflows/restore_caches.sh deleted file mode 100755 index eb34c87aa9..0000000000 --- a/.github/workflows/restore_caches.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -x - -echo "#############################" -echo "# Restore Caches #" -echo "#############################" - -set +e - -BASE=`pwd` - -. $GITHUB_WORKSPACE/.github/workflows/common.sh - -# based on root folder -cd / - -if [[ "$USE_CCACHE" == "ON" ]]; then - # Restore ccache - scp runner@${CACHE_HOST}:github/${CCACHE_FILE} /tmp || true - if [ -f /tmp/${CCACHE_FILE} ] ; then - echo "ccache file was found" - decompress_file "/tmp/${CCACHE_FILE}" - rm /tmp/$CCACHE_FILE - fi - ccache -s -fi - -# Restore conda installs -scp runner@${CACHE_HOST}:github/${CONDA_FILE} /tmp || true -if [ -f /tmp/${CONDA_FILE} ] ; then - echo "Conda Cache file was found" - decompress_file "/tmp/${CONDA_FILE}" - rm /tmp/$CONDA_FILE -fi - -# Restore dependencies -scp runner@${CACHE_HOST}:github/${DEP_FILE} /tmp || true -if [ -f /tmp/${DEP_FILE} ] ; then - echo "Dependency Cache file was found" - decompress_file "/tmp/${DEP_FILE}" - rm /tmp/$DEP_FILE -fi - -echo "caches restored" diff --git a/.github/workflows/store_ccache.sh b/.github/workflows/store_ccache.sh deleted file mode 100755 index d812cde0a2..0000000000 --- a/.github/workflows/store_ccache.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -x - -echo "#############################" -echo "# Store CCache #" -echo "#############################" - -. $GITHUB_WORKSPACE/.github/workflows/common.sh - -if [[ "$USE_CCACHE" == "ON" ]]; then - which ccache - ccache -p - ccache -s - cd / - compress_file "/tmp/${CCACHE_FILE}" "${CCACHE_DIR}" - - scp /tmp/${CCACHE_FILE} runner@${CACHE_HOST}:github - rm /tmp/${CCACHE_FILE} -fi