Update GitHub workflows #300
Workflow file for this run
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: Build and Test | |
on: [push, pull_request] | |
env: | |
CI: "ON" | |
BUILD_DIR: _build | |
INSTALL_DIR: _install | |
jobs: | |
gcc-build: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
mpi: [nompi, mpich] | |
socket: [nosocket, socket] | |
config: [Debug] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Set up miniforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
auto-activate-base: true | |
activate-environment: "" | |
- name: Install GCC (Linux) | |
run: mamba install c-compiler cxx-compiler fortran-compiler | |
- name: Enable MPI build | |
if: contains(matrix.mpi, 'openmpi') || contains(matrix.mpi, 'mpich') | |
run: echo "WITH_MPI=true" >> $GITHUB_ENV | |
- name: Disable MPI build | |
if: contains(matrix.mpi, 'nompi') | |
run: echo "WITH_MPI=false" >> $GITHUB_ENV | |
- name: Enable socket build | |
if: contains(matrix.socket, 'socket') | |
run: echo "WITH_SOCKETS=true" >> $GITHUB_ENV | |
- name: Disable socket build | |
if: contains(matrix.socket, 'nosocket') | |
run: echo "WITH_SOCKETS=false" >> $GITHUB_ENV | |
- name: Set Compiler | |
run: | | |
echo "FC=${CONDA_PREFIX}/bin/gfortran" >> $GITHUB_ENV | |
echo "CC=${CONDA_PREFIX}/bin/gcc" >> $GITHUB_ENV | |
- name: Install HDF5 | |
run: mamba install hdf5 | |
- name: Set HDF5 search paths | |
run: | | |
echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX}/" >> $GITHUB_ENV | |
- name: Install OpenMPI | |
if: contains(matrix.mpi, 'openmpi') | |
run: mamba install openmpi openmpi-mpifort | |
- name: Install MPICH | |
if: contains(matrix.mpi, 'mpich') | |
run: mamba install mpich mpich-mpifort | |
- name: Install BLAS | |
run: mamba install openblas libopenblas | |
- name: Install requirements (conda) | |
run: mamba install cmake fypp numpy h5py | |
- name: Configure build | |
run: | | |
cmake -B ${BUILD_DIR} -DWITH_MPI=${WITH_MPI} -DWITH_SOCKETS=${WITH_SOCKETS} \ | |
-DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} . | |
- name: Build project | |
run: cmake --build ${BUILD_DIR} -j2 | |
- name: Run regression tests | |
run: | | |
pushd ${BUILD_DIR} | |
ctest -j2 --output-on-failure | |
popd | |
- name: Install project | |
run: cmake --install ${BUILD_DIR} | |
intel-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
mpi: [nompi] | |
socket: [nosocket, socket] | |
config: [RelWithDebInfo] | |
env: | |
FC: ifx | |
CC: icx | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Setup Intel compiler | |
uses: rscohn2/setup-oneapi@v0 | |
with: | |
components: | | |
[email protected] | |
[email protected] | |
[email protected] | |
- name: Setup Intel environment | |
run: | | |
source /opt/intel/oneapi/setvars.sh | |
printenv >> ${GITHUB_ENV} | |
echo "FC=${FC}" >> ${GITHUB_ENV} | |
echo "CC=${CC}" >> ${GITHUB_ENV} | |
echo "CXX=${CC}" >> ${GITHUB_ENV} | |
- name: Install HDF5 | |
run: | | |
wget https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_4/downloads/hdf5-1.14.4-3.tar.gz | |
tar xfz hdf5-1.14.4-3.tar.gz | |
cd hdf5-1.14.4-3/ | |
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} \ | |
-DHDF5_BUILD_FORTRAN=1 -DBUILD_SHARED_LIBS=1 -B ${BUILD_DIR} | |
cmake --build ${BUILD_DIR} -j2 | |
cmake --install ${BUILD_DIR} | |
echo "HDF5_ROOT=${PWD}/${BUILD_DIR}/${INSTALL_DIR}" >> ${GITHUB_ENV} | |
- name: Disable MPI build | |
if: contains(matrix.mpi, 'nompi') | |
run: echo "WITH_MPI=false" >> $GITHUB_ENV | |
- name: Enable socket build | |
if: contains(matrix.socket, 'socket') | |
run: echo "WITH_SOCKETS=true" >> $GITHUB_ENV | |
- name: Disable socket build | |
if: contains(matrix.socket, 'nosocket') | |
run: echo "WITH_SOCKETS=false" >> $GITHUB_ENV | |
- name: Install requirements (pip) | |
run: | | |
pip3 install --upgrade pip | |
pip3 install cmake fypp numpy h5py | |
- name: Configure build | |
run: | | |
cmake -B ${BUILD_DIR} -DWITH_MPI=${WITH_MPI} -DWITH_SOCKETS=${WITH_SOCKETS} \ | |
-DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} . | |
- name: Build project | |
run: cmake --build ${BUILD_DIR} -j2 | |
- name: Run regression tests | |
run: | | |
pushd ${BUILD_DIR} | |
ctest -j2 --output-on-failure | |
popd | |
- name: Install project | |
run: cmake --install ${BUILD_DIR} |