Skip to content

CI/CD Deps update (#2590) #769

CI/CD Deps update (#2590)

CI/CD Deps update (#2590) #769

name: Mac Arm64 Build
on:
push:
branches:
- master
- release_v*
tags:
- '*'
pull_request:
schedule:
- cron: '0 0 * * 0'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
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
CCACHE_MAXSIZE: "500M"
CCACHE_COMPRESS: "true"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: macos-latest
steps:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.0.4
- name: OS Setup
run: |
sudo chown -R $UID $CONDA
conda init zsh
source ~/.zshrc
brew install ccache pigz gnu-tar coreutils
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
- name: Get tags
run: git fetch --unshallow origin +refs/tags/*:refs/tags/*
- name: Conda Installs
shell: bash -l {0}
run: .github/workflows/gha_conda.sh
- name: Restore Dependencies Cache
id: cache-deps-restore
uses: actions/cache/restore@v4
with:
path: /Users/runner/install
key: ${{ runner.os }}-arm64-deps-osx${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'build_dependencies.sh') }}
- name: Build Dependencies
if: steps.cache-deps-restore.outputs.cache-hit != 'true'
shell: bash -l {0}
run: .github/workflows/gha_deps.sh
- name: Save Dependencies Cache
if: steps.cache-deps-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /Users/runner/install
key: ${{ runner.os }}-arm64-deps-osx${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'build_dependencies.sh') }}
# Rewrite SDK-versioned libiconv.tbd/libm.tbd paths that ITK hardcodes to -l flags, so the
# cached dependencies keep linking after a runner Xcode/SDK bump. See issue #2570.
- name: Fix hardcoded SDK library paths in dependencies
shell: bash -l {0}
run: .github/workflows/fix_mac_dependency_paths.sh
- name: cmake
shell: bash -l {0}
run: conda activate shapeworks && mkdir build && cd build && cmake -DCMAKE_LIBTOOL=/usr/bin/libtool -DCMAKE_CXX_FLAGS="-g -Wno-enum-constexpr-conversion" -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 -DCMAKE_PREFIX_PATH=$HOME/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPython3_ROOT_DIR:FILEPATH=${CONDA_PREFIX} -DUSE_OPENMP=OFF -DBuild_Studio=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/shapeworks-install -DBUILD_DOCUMENTATION=ON -DUSE_BUNDLED_PYTHON=ON -DGA_MEASUREMENT_ID=$GA_MEASUREMENT_ID -DGA_API_SECRET=$GA_API_SECRET ..
- name: Restore ccache
uses: actions/cache/restore@v4
with:
path: /Users/runner/.ccache
key: ${{ runner.os }}-ccache-arm64-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-arm64-
- name: make
shell: bash -l {0}
run: conda activate shapeworks && cd build && make -j4
- name: ccache stats
if: always()
shell: bash -l {0}
run: ccache -s || true
- name: Save ccache
if: always()
continue-on-error: true
uses: actions/cache/save@v4
with:
path: /Users/runner/.ccache
key: ${{ runner.os }}-ccache-arm64-${{ github.sha }}
- name: Install bundled Python packages
shell: bash -l {0}
run: conda activate shapeworks && cd build && make bundled_pip_install
- name: make install
shell: bash -l {0}
run: conda activate shapeworks && cd build && make install
- name: Build Binary Package
shell: bash -l {0}
env:
PR_NUMBER: ${{ github.event.number }}
run: conda activate shapeworks && source ./devenv.sh ./build/bin && ./Support/package.sh tag ${GITHUB_WORKSPACE}/shapeworks-install $HOME/install
- name: Smoke test packaged bundle
shell: bash
run: ./Support/smoke_test_bundle.sh "$(find package -mindepth 1 -maxdepth 1 -type d | head -1)"
- name: Download test data
shell: bash -l {0}
run: .github/workflows/download_test_data.sh
- name: make test
shell: bash -l {0}
run: conda activate shapeworks && source ./devenv.sh ./build/bin && cd build && ctest -VV
- name: Print crash reports
if: failure()
run: |
echo "=== Crash Reports ==="
for f in ~/Library/Logs/DiagnosticReports/*.crash ~/Library/Logs/DiagnosticReports/*.ips; do
if [ -f "$f" ]; then
echo "--- $f ---"
cat "$f"
echo ""
fi
done
- uses: actions/upload-artifact@v4
with:
name: artifact-${{github.sha}}-mac-arm64
path: ${{runner.workspace}}/ShapeWorks/artifacts
- name: Remove previous dev release
if: github.ref == 'refs/heads/master'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/workflows/delete_dev_release.sh dev-mac-arm64
- name: Deploy
id: deploy
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: "dev-mac-arm64"
target_commitish: ${{ github.sha }}
prerelease: true
name: "Development Build for Mac Arm64"
files: |
${{runner.workspace}}/ShapeWorks/artifacts/*.zip
${{runner.workspace}}/ShapeWorks/artifacts/*.pkg
- name: Deploy Docs
if: github.ref == 'refs/heads/master'
shell: bash -l {0}
run: conda activate shapeworks && source ./devenv.sh ./build/bin && ./Support/deploy_docs.sh ${GITHUB_WORKSPACE}/build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}