Update GitHub workflows #290
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 | |
CMAKE_OPTIONS: >- | |
-DCMAKE_BUILD_TYPE=Debug | |
-DFYPP_FLAGS='-DTRAVIS' | |
jobs: | |
gcc-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
mpi: [nompi, openmpi] | |
socket: [nosocket, socket] | |
config: [Debug] | |
version: [11] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install GCC (Linux) | |
if: ${{ contains(matrix.os, 'ubuntu') }} | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install -y gcc-${{ matrix.version}} gfortran-${{ matrix.version }} g++-${{ matrix.version }} | |
sudo update-alternatives \ | |
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.version }} 100 \ | |
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.version }} \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.version }} \ | |
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.version }} | |
- 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 (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
echo "FC=gfortran" >> $GITHUB_ENV | |
echo "CC=gcc" >> $GITHUB_ENV | |
- name: Install HDF5 | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install hdf5-tools libhdf5-dev libhdf5-103 | |
- name: Install OpenMPI (Linux) | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'openmpi') | |
run: | | |
sudo apt-get update | |
sudo apt-get install libopenmpi-dev | |
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS}" >> $GITHUB_ENV | |
- name: Install cmake | |
run: pip3 install cmake ninja fypp numpy h5py | |
- name: Configure build | |
run: >- | |
cmake -B _build -G Ninja | |
-DCMAKE_INSTALL_PREFIX=${PWD}/_install | |
${CMAKE_OPTIONS} | |
-DWITH_MPI=${WITH_MPI} | |
-DWITH_SOCKETS=${WITH_SOCKETS} | |
- name: Build project | |
run: cmake --build ${BUILD_DIR} | |
- name: Run regression tests | |
run: | | |
pushd ${BUILD_DIR} | |
ctest -j 2 --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] | |
fc: [ifort] | |
cc: [icx] | |
env: | |
FC: ${{ matrix.fc }} | |
CC: ${{ matrix.cc }} | |
WITH_MPI: false | |
APT_PACKAGES: >- | |
intel-oneapi-compiler-fortran | |
intel-oneapi-compiler-dpcpp-cpp | |
intel-oneapi-mkl | |
intel-oneapi-mkl-devel | |
CMAKE_OPTIONS: >- | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo | |
-DFYPP_FLAGS='-DTRAVIS' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Add Intel repository | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null | |
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | |
sudo apt-get update | |
- name: Install Intel oneAPI compiler | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install ${APT_PACKAGES} | |
source /opt/intel/oneapi/setvars.sh | |
printenv >> $GITHUB_ENV | |
- name: Install HDF5 | |
if: contains(matrix.os, 'ubuntu') | |
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/ | |
CC=icx CXX=icx FC=ifort F9X=ifort ./configure --prefix=${PWD}/hdf5 --enable-fortran --enable-shared | |
make -j -l2 | |
make install | |
export HDF5_ROOT=${PWD}/hdf5 | |
cd ../../ | |
printenv >> $GITHUB_ENV | |
- name: Disable MPI build | |
if: contains(matrix.mpi, 'nompi') | |
run: | | |
echo "WITH_MPI=false" >> $GITHUB_ENV | |
echo "FC=ifort" >> $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 cmake | |
run: | | |
pip3 install --upgrade pip | |
pip3 install cmake ninja fypp numpy h5py | |
- name: Configure build | |
run: >- | |
cmake -B _build -G Ninja | |
-DCMAKE_INSTALL_PREFIX=${PWD}/_install | |
${CMAKE_OPTIONS} | |
-DWITH_MPI=${WITH_MPI} | |
-DWITH_SOCKETS=${WITH_SOCKETS} | |
- name: Build project | |
run: cmake --build ${BUILD_DIR} | |
- name: Run regression tests | |
run: | | |
pushd ${BUILD_DIR} | |
ctest -j 2 --output-on-failure | |
popd | |
- name: Install project | |
run: | | |
cmake --install ${BUILD_DIR} |