macos #117
This file contains 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: macos | |
on: | |
workflow_dispatch: | |
schedule: | |
# Run job every Saturday at 08:20 UTC | |
- cron: '20 8 * * 6' | |
# push: | |
# branches-ignore: | |
# - '**/dev2' | |
# - '**/*dev2' | |
# pull_request: | |
# This workflow hangs intermittently at random places, after building a demo | |
# program and just before running it. Something is broken but it's not | |
# SuiteSparse; it's github. Tests on an M1 Mac and Intel Mac have never shown | |
# this behavior outside of github. As a result, this workflow has been | |
# relegated to a "workflow_dispatch" only. It is not run on push or pull | |
# requests. The hang has nothing to do with parallelism; it can hang in | |
# check_AMD, which does not use OpenMP. | |
concurrency: ci-macos-${{ github.ref }} | |
env: | |
# string with name of libraries to be built | |
BUILD_LIBS: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CSparse:CXSparse:LDL:KLU:UMFPACK:ParU:RBio:SPQR:SPEX:GraphBLAS:LAGraph" | |
jobs: | |
macos: | |
# For available GitHub-hosted runners, see: | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners | |
runs-on: macos-latest | |
steps: | |
- name: get runner hardware information | |
run: | | |
sysctl hw | |
sysctl machdep | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: install dependencies | |
# Homebrew's Python conflicts with the Python that comes pre-installed | |
# on the GitHub runners. Some of SuiteSparse's dependencies depend on | |
# different versions of Homebrew's Python. Enforce using the ones from | |
# Homebrew to avoid errors on updates. | |
# See: https://github.com/orgs/Homebrew/discussions/3928 | |
# It looks like "gfortran" isn't working correctly unless "gcc" is | |
# re-installed. | |
run: | | |
brew update | |
brew install --overwrite python@3.10 python@3.11 python@3.12 | |
brew reinstall gcc | |
brew install autoconf automake ccache cmake gmp lapack libomp mpfr openblas | |
HOMEBREW_PREFIX=$(brew --prefix) | |
echo "HOMEBREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV | |
- name: prepare ccache | |
# create key with human readable timestamp | |
# used in action/cache/restore and action/cache/save steps | |
id: ccache-prepare | |
run: | | |
echo "key=ccache:macos-latest:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT | |
- name: restore ccache | |
# setup the GitHub cache used to maintain the ccache from one job to the next | |
uses: actions/cache/restore@v4 | |
with: | |
path: /Users/runner/Library/Caches/ccache | |
key: ${{ steps.ccache-prepare.outputs.key }} | |
# Prefer caches from the same branch. Fall back to caches from the dev branch. | |
restore-keys: | | |
ccache:macos-latest:${{ github.ref }} | |
ccache:macos-latest | |
- name: configure ccache | |
# Limit the maximum size to avoid exceeding the total cache limits. | |
run: | | |
test -d /Users/runner/Library/Preferences/ccache || mkdir /Users/runner/Library/Preferences/ccache | |
echo "max_size = 300M" >> /Users/runner/Library/Preferences/ccache/ccache.conf | |
ccache -s | |
- name: build | |
run: | | |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}" | |
for lib in "${libs[@]}"; do | |
printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n" | |
echo "::group::Configure $lib" | |
cd ${GITHUB_WORKSPACE}/${lib}/build | |
cmake -DCMAKE_BUILD_TYPE="Release" \ | |
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \ | |
-DBLA_VENDOR="Apple" \ | |
-DCMAKE_PREFIX_PATH="${HOMEBREW_PREFIX}/opt/lapack;${HOMEBREW_PREFIX}/opt/openblas;${HOMEBREW_PREFIX}/opt/libomp" \ | |
.. | |
echo "::endgroup::" | |
echo "::group::Build $lib" | |
cmake --build . --config Release | |
echo "::endgroup::" | |
done | |
- name: check Mongoose | |
run: | | |
cd ${GITHUB_WORKSPACE}/Mongoose/build | |
ctest . | |
- name: check AMD | |
run: | | |
cd ${GITHUB_WORKSPACE}/AMD | |
make demos | |
- name: check CAMD | |
run: | | |
cd ${GITHUB_WORKSPACE}/CAMD | |
make demos | |
- name: check COLAMD | |
run: | | |
cd ${GITHUB_WORKSPACE}/COLAMD | |
make demos | |
- name: check CCOLAMD | |
run: | | |
cd ${GITHUB_WORKSPACE}/CCOLAMD | |
make demos | |
- name: check CHOLMOD | |
run: | | |
cd ${GITHUB_WORKSPACE}/CHOLMOD | |
make demos | |
cd ${GITHUB_WORKSPACE}/CHOLMOD/build | |
ctest . | |
- name: check CSparse | |
run: | | |
cd ${GITHUB_WORKSPACE}/CSparse | |
make demos | |
- name: check CXSparse | |
run: | | |
cd ${GITHUB_WORKSPACE}/CXSparse | |
make demos | |
- name: check LDL | |
run: | | |
cd ${GITHUB_WORKSPACE}/LDL | |
make demos | |
- name: check KLU | |
run: | | |
cd ${GITHUB_WORKSPACE}/KLU | |
make demos | |
- name: check UMFPACK | |
run: | | |
cd ${GITHUB_WORKSPACE}/UMFPACK | |
make demos | |
- name: check RBio | |
run: | | |
cd ${GITHUB_WORKSPACE}/RBio | |
make demos | |
- name: check SPQR | |
run: | | |
cd ${GITHUB_WORKSPACE}/SPQR | |
make demos | |
- name: check SPEX | |
run: | | |
cd ${GITHUB_WORKSPACE}/SPEX | |
make demos | |
- name: check GraphBLAS | |
run: | | |
cd ${GITHUB_WORKSPACE}/GraphBLAS | |
make demos | |
- name: check LAGraph | |
run: | | |
cd ${GITHUB_WORKSPACE}/LAGraph | |
make demos | |
- name: check ParU | |
run: | | |
cd ${GITHUB_WORKSPACE}/ParU | |
make demos | |
- name: ccache status | |
continue-on-error: true | |
run: ccache -s | |
- name: save ccache | |
# Save the cache after we are done (successfully) building | |
# This helps to retain the ccache even if the subsequent steps are failing. | |
uses: actions/cache/save@v4 | |
with: | |
path: /Users/runner/Library/Caches/ccache | |
key: ${{ steps.ccache-prepare.outputs.key }} | |
- name: install | |
run: | | |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}" | |
for lib in "${libs[@]}"; do | |
printf "::group::\033[0;32m==>\033[0m Installing library \033[0;32m${lib}\033[0m\n" | |
cd ${GITHUB_WORKSPACE}/${lib}/build | |
cmake --install . | |
echo "::endgroup::" | |
done | |
- name: build example | |
run: | | |
cd ${GITHUB_WORKSPACE}/Example/build | |
printf "::group::\033[0;32m==>\033[0m Configuring example\n" | |
cmake \ | |
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake;${HOMEBREW_PREFIX}/opt/lapack;${HOMEBREW_PREFIX}/opt/openblas;${HOMEBREW_PREFIX}/opt/libomp" \ | |
.. | |
echo "::endgroup::" | |
printf "::group::\033[0;32m==>\033[0m Building example\n" | |
cmake --build . | |
echo "::endgroup::" | |
printf "::group::\033[0;32m==>\033[0m Executing example\n" | |
printf "\033[1;35m C binary with shared libraries\033[0m\n" | |
./my_demo | |
printf "\033[1;35m C++ binary with shared libraries\033[0m\n" | |
./my_cxx_demo | |
printf "\033[1;35m C binary with statically linked libraries\033[0m\n" | |
./my_demo_static | |
printf "\033[1;35m C++ binary with statically linked libraries\033[0m\n" | |
./my_cxx_demo_static | |
echo "::endgroup::" | |