Skip to content

CI and Build System Improvements (#75) #1

CI and Build System Improvements (#75)

CI and Build System Improvements (#75) #1

Workflow file for this run

name: MacOS
on: [push, pull_request]
concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-macos
cancel-in-progress: true
jobs:
MacOS-Clang:
name: Apple [email protected] - SUNDIALS ${{matrix.sundials}} - AMReX ${{matrix.amrex_mode}}
runs-on: macos-latest
# env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual"}
strategy:
matrix:
sundials: [OFF, ON]
amrex_mode: [internal, external_src]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Clone AMReX for dependency scripts
run: |
git clone https://github.com/AMReX-Codes/amrex.git ${{runner.workspace}}/amrex
- name: Setup
run: |
if [ "${{matrix.amrex_mode}}" == "external_src" ]; then
echo "AMREX_SRC_DIR=${{runner.workspace}}/amrex" >> $GITHUB_ENV
if [ "${{matrix.sundials}}" == "ON" ]; then
git clone https://github.com/LLNL/sundials.git ${{runner.workspace}}/sundials
echo "SUNDIALS_SRC_DIR=${{runner.workspace}}/sundials" >> $GITHUB_ENV
fi
fi
- name: Install Dependencies
run: |
# Install OpenMP support for macOS
brew install libomp
# Run AMReX dependency script
${{runner.workspace}}/amrex/.github/workflows/dependencies/dependencies_mac.sh
- name: Set Up Cache
uses: actions/cache@v4
with:
path: ~/Library/Caches/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Configure Project and Generate Build System
run: |
if [ "${{matrix.amrex_mode}}" == "external_src" ]; then
if [ "${{matrix.sundials}}" == "ON" ]; then
cmake \
-B${{runner.workspace}}/FerroX/build-${{matrix.sundials}}-${{matrix.amrex_mode}} \
-DBUILD_SHARED_LIBS:BOOL=FALSE \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DOpenMP_ROOT=/opt/homebrew \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/include" \
-DOpenMP_C_LIB_NAMES=omp \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/include" \
-DOpenMP_CXX_LIB_NAMES=omp \
-DOpenMP_omp_LIBRARY=/opt/homebrew/lib/libomp.dylib \
-DFerroX_MPI:BOOL=ON \
-DFerroX_SUNDIALS:BOOL=ON \
-DFerroX_ENABLE_ALL_WARNINGS:BOOL=ON \
-DFerroX_amrex_src:PATH=${{env.AMREX_SRC_DIR}} \
-DFerroX_sundials_src:PATH=${{env.SUNDIALS_SRC_DIR}} \
${{github.workspace}};
else
cmake \
-B${{runner.workspace}}/FerroX/build-${{matrix.sundials}}-${{matrix.amrex_mode}} \
-DBUILD_SHARED_LIBS:BOOL=FALSE \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DOpenMP_ROOT=/opt/homebrew \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/include" \
-DOpenMP_C_LIB_NAMES=omp \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/include" \
-DOpenMP_CXX_LIB_NAMES=omp \
-DOpenMP_omp_LIBRARY=/opt/homebrew/lib/libomp.dylib \
-DFerroX_MPI:BOOL=ON \
-DFerroX_SUNDIALS:BOOL=OFF \
-DFerroX_ENABLE_ALL_WARNINGS:BOOL=ON \
-DFerroX_amrex_src:PATH=${{env.AMREX_SRC_DIR}} \
${{github.workspace}};
fi
else
cmake \
-B${{runner.workspace}}/FerroX/build-${{matrix.sundials}}-${{matrix.amrex_mode}} \
-DBUILD_SHARED_LIBS:BOOL=FALSE \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DOpenMP_ROOT=/opt/homebrew \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/include" \
-DOpenMP_C_LIB_NAMES=omp \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/include" \
-DOpenMP_CXX_LIB_NAMES=omp \
-DOpenMP_omp_LIBRARY=/opt/homebrew/lib/libomp.dylib \
-DFerroX_MPI:BOOL=ON \
-DFerroX_SUNDIALS:BOOL=${{matrix.sundials}} \
-DFerroX_ENABLE_ALL_WARNINGS:BOOL=ON \
${{github.workspace}};
fi
- name: Compile and Link
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=250M
export CCACHE_SLOPPINESS=time_macros
ccache -z
cmake --build ${{runner.workspace}}/FerroX/build-${{matrix.sundials}}-${{matrix.amrex_mode}} --parallel 2 --verbose \
2>&1 | tee -a ${{runner.workspace}}/build-output-${{matrix.sundials}}-${{matrix.amrex_mode}}.txt;
du -hs ~/Library/Caches/ccache
ccache -s
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-output-${{matrix.sundials}}-${{matrix.amrex_mode}}.txt \
| egrep -v "_deps/.*amrex" | egrep -v "_deps/.*sundials" | egrep -v "${{runner.workspace}}/amrex" | egrep -v "${{runner.workspace}}/sundials" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-output-warnings-${{matrix.sundials}}-${{matrix.amrex_mode}}.txt
cat ${{runner.workspace}}/build-output-warnings-${{matrix.sundials}}-${{matrix.amrex_mode}}.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-output-warnings-${{matrix.sundials}}-${{matrix.amrex_mode}}.txt | awk '{print $2}')
exit ${return}