fix: Check RPATH on MacOS to debug #783
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: CMake Build Matrix | |
on: [push, pull_request] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
CMAKE_VERSION: 3.21.1 | |
BUILD_TYPE: Release | |
CCACHE_VERSION: 4.4 | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
# TODO: Get build matrix working for MacOS | |
strategy: | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Latest GCC", | |
os: ubuntu-latest, | |
cc: "gcc", cxx: "g++", fort: "gfortran", | |
coverage: "ON" | |
} | |
- { | |
name: "Ubuntu Latest Clang", | |
os: ubuntu-latest, | |
cc: "clang", cxx: "clang++", fort: "gfortran", | |
coverage: "OFF" | |
} | |
- { | |
name: "MacOS 13", | |
os: macos-13, | |
cc: "clang", cxx: "clang++", fort: "gfortran-14", | |
coverage: "OFF" | |
} | |
- { | |
name: "MacOS 14", | |
os: macos-14, | |
cc: "clang", cxx: "clang++", fort: "gfortran-14", | |
coverage: "OFF" | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies (Ubuntu) | |
if: ${{ matrix.config.os != 'macos-13' && matrix.config.os != 'macos-14' }} | |
run: sudo apt update && sudo apt install -y libhdf5-dev lcov ${{ matrix.config.cc }} cmake && pip install codecov | |
- name: Install dependencies (MacOS) | |
if: ${{ matrix.config.os == 'macos-13' || matrix.config.os == 'macos-14' }} | |
run: | | |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | |
brew update | |
brew install hdf5 | |
brew install cmake | |
- name: Set up cache | |
id: cache-cpm | |
uses: actions/cache@v4 | |
with: | |
path: ~/cpm-cache | |
key: ${{ matrix.config.name }}-cpm-${{ hashFiles('**/') }} | |
restore-keys: | | |
${{ matrix.config.name }}-cpm- | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
create-symlink: True | |
key: ${{ matrix.config.name }}-ccache-${{ github.sha }} | |
restore-keys: | | |
${{ matrix.config.name }}-ccache- | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DACHILLES_ENABLE_TESTING=ON \ | |
-DACHILLES_COVERAGE=${{ matrix.config.coverage }} -DCPM_SOURCE_CACHE=~/cpm-cache \ | |
-DACHILLES_ENABLE_SHERPA=OFF -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx}} \ | |
-DCMAKE_Fortran_COMPILER=${{ matrix.config.fort }} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} -j4 | |
- name: Test C++ | |
working-directory: ${{ github.workspace }}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ./test/achilles-testsuite | |
- name: Test Fotran | |
working-directory: ${{ github.workspace }}/build | |
run: ./test/achilles-fortran-testsuite | |
- name: Install | |
working-directory: ${{ github.workspace }} | |
run: cmake --install ${{ github.workspace }}/build | |
- name: Simple test run | |
working-directory: ${{ github.workspace }}/install | |
run: | | |
cp ../run.yml . | |
cp ../data/default/FormFactors.yml . | |
otool -l ./bin/achilles | |
./bin/achilles | |
# - name: Code coverage | |
# if: ${{ matrix.config.cxx == 'g++' }} | |
# working-directory: ${{ github.workspace }} | |
# run: | | |
# lcov --directory . --capture --output-file coverage.info | |
# lcov --remove coverage.info '/Library/*' '/usr/*' "${HOME}"'/.cache/*' '*/test/*' '*/external/*' '*/_deps/*' '*/gzstream/*' '*/SHERPA-MC/*' --output-file coverage.info | |
# lcov --list coverage.info | |
# bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports" |