Skip to content

MacOS

MacOS #1096

Workflow file for this run

name: MacOS
on:
pull_request:
branches:
- master
schedule:
# Runs every day at 23:15
- cron: '15 23 * * *'
jobs:
build:
name: Building with ${{ matrix.sofa_version }}
runs-on: macos-12
if: ${{ false }}
strategy:
fail-fast: false
matrix:
sofa_version: [ master ]
include:
- sofa_version: master
SOFA_VERSION_I: 999999
PYTHON_VERSION: 3.9
PYBIND11_VERSION: 2.6
BOOST_VERSION: 1.76.0
BOOST_LINK: https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz
QT_VERSION: 5.12.6
env:
SOFA_VERSION: ${{ matrix.sofa_version }}
SOFA_ROOT: /opt/sofa
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
BOOST_VERSION: ${{ matrix.BOOST_VERSION }}
QT_VERSION: ${{ matrix.QT_VERSION }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
git fetch origin
git rebase origin/master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7' #${{ matrix.PYTHON_VERSION }}
- name: Install requirements
run: |
brew install ccache eigen libpng libjpeg libtiff glew
python3 -m pip install numpy
# PYBIND11
- name: Install pybind11
run: |
git clone --depth 1 -b v${{ matrix.PYBIND11_VERSION }} https://github.com/pybind/pybind11.git /tmp/pybind11
cmake -S/tmp/pybind11 -B/tmp/pybind11/build -DPYBIND11_TEST=OFF -DCMAKE_BUILD_TYPE=Release
sudo cmake --install /tmp/pybind11/build
rm -rf /tmp/pybind11
- name: Opt permission
run: sudo chown -R $(whoami) /opt
# BOOST
- name: cache boost
uses: actions/cache@v2
id: cache-boost
with:
path: /opt/boost
key: boost-${{ matrix.BOOST_VERSION }}-macos-1015
- name: Download boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
curl --output boost.tar.gz -L "${{ matrix.BOOST_LINK }}"
tar xzf boost.tar.gz
- name: Patch boost
if: ${{ steps.cache-boost.outputs.cache-hit != 'true' && matrix.BOOST_VERSION == '1.67.0' }}
run: |
curl --output a.patch -L "https://github.com/boostorg/build/commit/b3a59d265929a213f02a451bb63cea75d668a4d9.patch?full_index=1"
git apply -v --directory=boost_1_67_0/tools/build a.patch
curl --output b.patch -L "https://gist.githubusercontent.com/jnbrunet/d9537ff8679b2b35976356f11f334777/raw/8d2a2a1e46d13064c2e18c5caa229b9b81933285/6e14ca24.patch"
patch -d boost_1_67_0 boost/atomic/detail/ops_gcc_x86_dcas.hpp < b.patch
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
if [ "$BOOST_VERSION" = "1.76.0" ]; then
cd boost_1_76_0
./bootstrap.sh --prefix=/opt/boost --without-libraries=python,mpi,log --without-icu --libdir=/opt/boost/lib
./b2 cxxflags=-std=c++11 link=shared threading=multi,single --layout=tagged -d0 -q variant=release architecture=x86 install
else
cd boost_1_67_0
./bootstrap.sh --prefix=/opt/boost --without-libraries=python,mpi,log --without-icu --libdir=/opt/boost/lib -with-toolset=darwin
./b2 toolset=darwin cxxflags=-std=c++11 link=shared threading=multi,single --layout=tagged -d0 -q variant=release architecture=x86 install
fi
# QT
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: /opt/qt
key: ${{ format('qt-{0}-macos-10.15', matrix.QT_VERSION) }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.QT_VERSION }}
dir: '/opt/qt'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
modules: 'qtcharts qtwebengine'
aqtversion: '==2.0.5'
setup-python: false
# SOFA
- name: Download SOFA Release
run: |
if [ "$SOFA_VERSION" = "master" ]; then
curl --output sofa.zip -L "https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=master,CI_SCOPE=standard/lastSuccessfulBuild/artifact/MacOS/*zip*/MacOS.zip"
unzip sofa.zip -d temp
mv temp/MacOS/`ls temp/MacOS` sofa.zip
rm -rf temp
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
else
curl --output sofa.zip -L "https://github.com/sofa-framework/sofa/releases/download/$SOFA_VERSION/SOFA_"$SOFA_VERSION"_MacOS.zip"
unzip sofa.zip -d temp
sudo mv temp/`ls temp` $SOFA_ROOT
fi
# CCACHE
- name: Get Time
id: time
uses: nanzm/get-time-action@v1.0
with:
timeZone: 8
format: 'YYYY-MM-DD-HH-mm-ss'
- name: ccache cache files
uses: actions/cache@v2
if: ${{ always() }}
with:
path: .ccache
key: macos-ccache-${{ steps.time.outputs.time }}
restore-keys: |
macos-ccache-
# MKL
- name: cache MKL
uses: actions/cache@v2
id: cache-mkl
with:
path: /opt/intel
key: mkl-macos-10.15
- name: Install MKL
if: steps.cache-mkl.outputs.cache-hit != 'true'
run: |
URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17714/m_BaseKit_p_2021.2.0.2855_offline.dmg
curl --output intel_mkl.dmg --url "$URL" --retry 5 --retry-delay 5
hdiutil attach intel_mkl.dmg
echo "MKL volume mounted. Now trying to install..."
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper --action install --components intel.oneapi.mac.mkl.devel --eula=accept --continue-with-optional-error=yes --log-dir=. -c
sudo chown -R $(whoami) /opt
echo "MKL installation done."
# CARIBOU
- name: Build caribou
env:
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: "500M"
PYTHONEXE: ${{ format('/usr/bin/python{0}', matrix.PYTHON_VERSION) }}
run:
export CCACHE_BASEDIR=$GITHUB_WORKSPACE &&
export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache &&
ccache -z &&
cmake
-DBOOST_ROOT=/opt/boost
-DPYTHON_EXECUTABLE=$PYTHONEXE
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCARIBOU_BUILD_TESTS=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=SofaCaribou
.
&& make && make install
&& tar czvf SofaCaribou.tar.gz SofaCaribou
&& echo ${CCACHE_BASEDIR}
&& ccache -s
- name: Archive production
uses: actions/upload-artifact@v2
with:
name: caribou_macos_${{ matrix.sofa_version }}
path: SofaCaribou.tar.gz