Refactor CMake build scripts #647
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 | |
# Controls when the action will run | |
on: | |
# Trigger the workflow on all pushes, except on tag creation | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
# Trigger the workflow on all pull requests | |
pull_request: ~ | |
# Allow workflow to be dispatched on demand | |
workflow_dispatch: ~ | |
env: | |
CLOUDSC_TOOLS: ${{ github.workspace }}/.github/tools | |
CTEST_PARALLEL_LEVEL: 1 | |
CACHE_SUFFIX: v1 # Increase to force new cache to be created | |
jobs: | |
ci: | |
name: ci | |
strategy: | |
fail-fast: false # false: try to complete all jobs | |
matrix: | |
build_type: [Release, Bit, Debug] | |
name: | |
- linux gnu-14 | |
- linux nvhpc | |
- linux intel-classic | |
- linux intel-llvm | |
include: | |
- name: linux gnu-14 | |
os: ubuntu-24.04 | |
compiler: gnu-14 | |
compiler_cc: gcc-14 | |
compiler_cxx: g++-14 | |
compiler_fc: gfortran-14 | |
python-version: 3.11 | |
caching: true | |
- name: linux nvhpc | |
os: ubuntu-24.04 | |
compiler: nvhpc | |
compiler_cc: nvc | |
compiler_cxx: nvc++ | |
compiler_fc: nvfortran | |
python-version: 3.11 | |
cmake_options: -DCMAKE_CUDA_ARCHITECTURES=80 | |
ctest_options: -E cu | |
caching: true | |
- name : linux intel-classic | |
os: ubuntu-24.04 | |
compiler: intel-classic | |
compiler_cc: icc | |
compiler_cxx: icpc | |
compiler_fc: ifort | |
python-version: 3.11 | |
caching: true | |
- name : linux intel-llvm | |
os: ubuntu-24.04 | |
compiler: intel-llvm | |
compiler_cc: icx | |
compiler_cxx: icpx | |
compiler_fc: ifx | |
python-version: 3.11 | |
cmake_options: -DENABLE_LOKI=OFF -DENABLE_SYCL=OFF | |
# cloudsc_driver_loki_mod.idem_stack.F90(138): error #5623: **Internal compiler error: internal abort** | |
# SYCL has some problems with missing symbols | |
caching: true | |
- name : linux gnu-native mpi | |
os: ubuntu-24.04 | |
compiler: gnu-13 | |
compiler_cc: gcc | |
compiler_cxx: g++ | |
compiler_fc: gfortran | |
python-version: 3.11 | |
cmake_options: -DENABLE_MPI=ON | |
build_type: Bit | |
caching: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Environment | |
run: | | |
echo "DEPS_DIR=${{ runner.temp }}/deps" >> $GITHUB_ENV | |
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV | |
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV | |
echo "FC=${{ matrix.compiler_fc }}" >> $GITHUB_ENV | |
if [[ "${{ matrix.os }}" =~ macos ]]; then | |
brew install ninja | |
else | |
sudo apt-get update | |
sudo apt-get install ninja-build | |
if [[ "${{ matrix.name }}" =~ mpi ]]; then | |
sudo apt-get install libopenmpi-dev libhdf5-dev | |
fi | |
if [[ "${{ matrix.name }}" =~ serialbox ]]; then | |
sudo apt-get install boost | |
fi | |
fi | |
printenv | |
- name: Cache Dependencies | |
if: matrix.caching | |
id: deps-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DEPS_DIR }} | |
key: deps-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }} | |
save-always: true | |
# Free up disk space for nvhpc | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
if: contains( matrix.compiler, 'nvhpc' ) | |
continue-on-error: true | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: false | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Install NVHPC compiler | |
if: contains( matrix.compiler, 'nvhpc' ) | |
shell: bash -eux {0} | |
run: | | |
${CLOUDSC_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 24.5 | |
source /opt/nvhpc/env.sh | |
echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH | |
echo "NVHPC_ROOT=${NVHPC_DIR}" >> $GITHUB_ENV | |
echo "NVHPC_CUDA_HOME=${NVHPC_DIR}/cuda/12.4" >> $GITHUB_ENV | |
- name: Install Intel Classic compiler | |
if: contains( matrix.compiler, 'intel-classic' ) | |
run: | | |
${CLOUDSC_TOOLS}/install-intel-classic.sh | |
source /opt/intel/oneapi/setvars.sh | |
printenv >> $GITHUB_ENV | |
echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV | |
- name: Install Intel LLVM compiler | |
if: contains( matrix.compiler, 'intel-llvm' ) | |
run: | | |
${CLOUDSC_TOOLS}/install-intel-llvm.sh | |
source /opt/intel/oneapi/setvars.sh | |
printenv >> $GITHUB_ENV | |
echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV | |
- name: Install HDF5 from source | |
if: ${{ ! contains( matrix.name, 'native' ) }} | |
run: | | |
if [[ -f ${{ env.DEPS_DIR }}/hdf5/lib/libhdf5.settings ]]; then | |
echo "::debug::HDF5 restored from cache" | |
else | |
${CLOUDSC_TOOLS}/install-hdf5.sh --prefix ${{ env.DEPS_DIR }}/hdf5 | |
fi | |
echo "HDF5_ROOT=${{ env.DEPS_DIR }}/hdf5" >> $GITHUB_ENV | |
- name: Build & Test | |
id: build-test | |
uses: ecmwf-actions/build-package@v2 | |
with: | |
self_coverage: false | |
force_build: true | |
cache_suffix: "${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }}" | |
recreate_cache: ${{ matrix.caching == false }} | |
dependencies: | | |
ecmwf/ecbuild | |
ecmwf-ifs/loki@refs/tags/0.3.0 | |
dependency_branch: develop | |
dependency_cmake_options: | | |
ecmwf-ifs/loki: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF" | |
cmake_options: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.cmake_options }}" | |
ctest_options: "${{ matrix.ctest_options }}" | |
# TODO: add eckit, fckit, atlas, fiat, field_api |