Skip to content

Bump minimum required cmake version to 3.10 & adopt policy CMP0167 #85

Bump minimum required cmake version to 3.10 & adopt policy CMP0167

Bump minimum required cmake version to 3.10 & adopt policy CMP0167 #85

Workflow file for this run

name: Test of package installation & execution
'on':
push:
branches-ignore:
- gh-pages
tags:
- '*'
schedule:
- cron: 0 10 * * 1
jobs:
build_cxx:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
strategy:
matrix:
sundials-version: [latest]
os: [ubuntu-latest, macos-latest, windows-latest]
with-coverage: [false, true]
with-asan: [false, true]
with-elf: [false]
with-valgrind: [false, true]
with-mpi: [false]
with-python: [false]
include:
- sundials-version: "5.7.0"
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: false
with-python: false
- sundials-version: "6.7.0"
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: false
with-python: false
- sundials-version: "7.1.1"
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: false
with-python: false
- sundials-version: latest
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: true
with-python: false
- sundials-version: "6.7.0"
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: true
with-python: false
- sundials-version: "7.1.1"
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: true
with-python: false
- sundials-version: latest
os: ubuntu-latest
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: false
with-mpi: false
with-python: true
exclude:
- os: windows-latest
with-asan: true
- os: ubuntu-latest
with-asan: true
- os: windows-latest
with-valgrind: true
- os: windows-latest
with-elf: true
- os: macos-latest
with-valgrind: true
- os: macos-latest
with-elf: true
- with-valgrind: true
with-elf: true
- with-valgrind: true
with-asan: true
- with-coverage: true
with-valgrind: true
- with-coverage: true
with-asan: true
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true
###################################
# CONDA SETUP
###################################
- name: Set up MSVC Compiler on windows
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Set up miniconda test environment (W/O MPI)
if: matrix.with-mpi == false
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: ephoto
environment-file: environment.yml
auto-update-conda: true
channels: conda-forge
channel-priority: strict
miniforge-version: latest
use-mamba: true
mamba-version: "1.5.10"
conda-remove-defaults: true
- name: Set up miniconda test environment (W/ MPI)
if: matrix.with-mpi == true
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: ephoto
environment-file: environment_mpi.yml
auto-update-conda: true
channels: conda-forge
channel-priority: strict
miniforge-version: latest
use-mamba: true
mamba-version: "1.5.10"
conda-remove-defaults: true
- name: Set USERPROFILE
if: matrix.os == 'windows-latest'
run: |
echo "USERPROFILE=${{ github.workspace }}" >> "$GITHUB_ENV"
- name: Install specific version of Sundials via conda
if: matrix.sundials-version != 'latest' && matrix.with-mpi == false
run: |
mamba install sundials==${{ matrix.sundials-version }} -y
- name: Check mamba installation
run: |
mamba info
mamba list
- name: Install doxgen on unix systems
if: matrix.os != 'windows-latest'
run: |
mamba install doxygen>=1.9.2 graphviz -y
- name: Install compilers using conda on Linux/Mac
if: matrix.os != 'windows-latest' && matrix.with-valgrind != true
run: |
mamba install c-compiler cxx-compiler
- name: Install valgrind on unix systems (and required debug symbols)
if: matrix.os != 'windows-latest' && matrix.with-valgrind == true
run: |
sudo apt-get update
sudo apt-get install libc6-dbg
mamba install valgrind
###################################
# INSTALL SUNDIALS W/ MPI
###################################
- name: CMake flags for building Sundials W/ MPI
shell: bash -l {0}
if: matrix.with-mpi == true
run: |
CMAKE_BUILD_TYPE_TEST="RelWithDebInfo"
echo "CMAKE_BUILD_TYPE_TEST=RelWithDebInfo" >> "$GITHUB_ENV"
echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DENABLE_MPI:BOOL=ON -DEXAMPLES_ENABLE_C:BOOL=OFF -DEXAMPLES_ENABLE_CXX:BOOL=OFF" >> "$GITHUB_ENV"
- name: Clone Sundials for build W/ MPI
if: matrix.with-mpi == true
run: |
git clone https://github.com/LLNL/sundials.git
- name: Check out specific version of Sundials for build W/ MPI
if: matrix.sundials-version != 'latest' && matrix.with-mpi == true
run: |
cd sundials
git checkout tags/v${{ matrix.sundials-version }} -b tagged
- name: Configure Sundials W/ MPI
if: matrix.with-mpi == true
run: |
cd sundials
mkdir build
cd build
cmake .. ${{ env.CMAKE_ARGS }}
- name: Build Sundials W/ MPI in parallel (CONDA, UNIX)
if: matrix.with-mpi == true && matrix.os != 'windows-latest'
run: |
cd sundials/build
cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }} -- -j 4
- name: Build Sundials W/ MPI in serial (CONDA, WINDOWS)
if: matrix.with-mpi == true && matrix.os == 'windows-latest'
run: |
cd sundials/build
cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }}
- name: Install Sundials W/ MPI
if: matrix.with-mpi == true
run: |
cd sundials/build
cmake --install . --prefix /home/runner/miniconda3/envs/ephoto
###################################
# PIP INSTALL THINGS
###################################
- name: Install packages not current on conda-forge (gcovr)
if: matrix.with-coverage == true
run: |
pip install gcovr
###################################
# SET CONFIG FLAGS
###################################
- name: Global config flags
run: |
CMAKE_BUILD_TYPE_TEST="Debug"
echo "CMAKE_BUILD_TYPE_TEST=Debug" >> "$GITHUB_ENV"
echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" >> "$GITHUB_ENV"
echo "CMAKE_ARGS_TEST=-DBUILD_TESTS=ON" >> "$GITHUB_ENV"
echo "TEST_FLAGS=-C ${CMAKE_BUILD_TYPE_TEST} --output-on-failure -VV" >> "$GITHUB_ENV"
echo "BUILD_ARGS=--config ${CMAKE_BUILD_TYPE_TEST}" >> "$GITHUB_ENV"
- name: Set flags to build in parallel (UNIX)
if: matrix.os != 'windows-latest'
run: |
echo "BUILD_ARGS=${{ env.BUILD_ARGS }} -- -j 4" >> "$GITHUB_ENV"
- name: Coverage config flags
if: matrix.with-coverage == true && matrix.os != 'windows-latest'
run: |
echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_COVERAGE=ON" >> "$GITHUB_ENV"
- name: ASAN config flags
if: matrix.with-asan == true
run: |
echo "CMAKE_ARGS=${{ env.CMAKE_ARGS }} -DWITH_ASAN=ON" >> "$GITHUB_ENV"
echo "ASAN_OPTIONS=detect_odr_violation=0:detect_container_overflow=0" >> $GITHUB_ENV
echo "TEST_FLAGS=${{ env.TEST_FLAGS }} -E valgrind*" >> "$GITHUB_ENV"
- name: ASAN dynamic library
if: matrix.with-asan == true && matrix.os == 'macos-latest'
run: |
echo "DYLD_INSERT_LIBRARIES=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib)" >> "$GITHUB_ENV"
- name: ELF config flags
if: matrix.with-elf == true
run: |
echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_ELF=ON" >> "$GITHUB_ENV"
- name: Valgrind off config flags
if: matrix.with-valgrind == true
run: |
echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_VALGRIND=ON" >> "$GITHUB_ENV"
###################################
# Add paths for Windows dlls
###################################
- name: Conda library paths on Windows
if: matrix.os == 'windows-latest'
run: |
# This isn't necessary, but it speeds up the build
LIB_DIRECTORY="${CONDA_PREFIX}/Library/lib"
ls ${LIB_DIRECTORY}
echo "${LIB_DIRECTORY}" >> $GITHUB_PATH
DLL_DIRECTORY="${CONDA_PREFIX}/Library/bin"
ls ${DLL_DIRECTORY}
echo "${DLL_DIRECTORY}" >> $GITHUB_PATH
###################################
# Configure
###################################
- name: Configure (CONDA)
run: |
mkdir build
cd build
which cmake
cmake .. ${{ env.CMAKE_ARGS }} ${{ env.CMAKE_ARGS_TEST }}
###################################
# Build CXX
###################################
- name: Build C++ & C
run: |
cd build
cmake --build . ${{ env.BUILD_ARGS }}
###################################
# Test CXX
###################################
- name: Test C++
if: matrix.with-coverage != true
run: |
mamba list
echo "PATH=$PATH"
cd build
which ctest
ctest ${{ env.TEST_FLAGS }}
- name: Test C++ (COVERAGE)
if: matrix.with-coverage && matrix.os != 'windows-latest'
run: |
mamba list
echo "PATH=$PATH"
cd build
make coverage
- name: Preserve coverage information
if: matrix.with-coverage && matrix.os != 'windows-latest'
run: |
cp -r build/coverage coverage
###################################
# Build Python
###################################
- name: Configure Python
if: matrix.with-python == true
run: |
cd build
cmake .. -DBUILD_PYTHON=ON ${{ env.CMAKE_ARGS }}
- name: Build & install Python
if: matrix.with-python == true
run: |
cd build
cmake --build . --target pyPhotosynthesis ${{ env.BUILD_ARGS }}
cmake --install . --prefix /home/runner/miniconda3/envs/ephoto --component Python
###################################
# Test Python
###################################
- name: Test Python Interfaces
if: matrix.with-python == true
run: |
pytest -sv tests/python
###################################
# Docs tests
###################################
- name: Build docs
if: matrix.os != 'windows-latest'
run: |
python scripts/devtasks.py docs --rebuild
###################################
# Coverage
###################################
- name: Upload coverage report
if: matrix.with-coverage == true && matrix.os != 'windows-latest'
uses: codecov/codecov-action@v4
with:
name: ${{ matrix.os }}-${{ matrix.sundials-version }}-${{ matrix.with-coverage }}-${{ matrix.with-asan }}-${{ matrix.with-elf }}-${{ matrix.with-valgrind }}-${{ matrix.with-mpi }}-${{ matrix.with-python }}
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/coverage.info
functionalities: gcov