Skip to content

macos

macos #22

Workflow file for this run

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:AMD:COLAMD:SPEX"
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 [email protected] [email protected] [email protected]
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 AMD
run: |
cd ${GITHUB_WORKSPACE}/AMD
make demos
- name: check COLAMD
run: |
cd ${GITHUB_WORKSPACE}/COLAMD
make demos
- name: check SPEX
run: |
cd ${GITHUB_WORKSPACE}/SPEX
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