macos #56
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: | |
# 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@v3 | |
- 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 [email protected] [email protected] [email protected] | |
brew reinstall gcc | |
brew install autoconf automake ccache cmake gmp lapack libomp mpfr openblas | |
- 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@v3 | |
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="OpenBLAS" \ | |
-DCMAKE_PREFIX_PATH="/usr/local/opt/lapack;/usr/local/opt/openblas;/usr/local/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@v3 | |
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;/usr/local/opt/lapack;/usr/local/opt/openblas;/usr/local/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::" | |