Skip to content

Feature/mpi

Feature/mpi #72

name: linux-gnu-cmake
on:
push:
branches:
- master
- main
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
pull_request:
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
jobs:
linux-tests:
timeout-minutes: 30
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
fcompiler: gfortran-12
ccompiler: gcc-12
gcov: gcov-12
spack_compiler: gcc@=12.3.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: coverage
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
gcov: gcov-9
spack_compiler: gcc@=9.5.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-10
ccompiler: gcc-10
gcov: gcov-10
spack_compiler: gcc@=10.5.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-11
ccompiler: gcc-11
gcov: gcov-11
spack_compiler: gcc@=11.4.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: debug
memcheck: false
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: Set up Spack
uses: spack/setup-spack@v2
- name: Install dependencies in spack environment
run: |
spack -e ./share/spack-env/ mirror set --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
spack -e ./share/spack-env/ compiler find
spack -e ./share/spack-env/ external find --not-buildable
spack -e ./share/spack-env/ config add packages:feq-parse:require:["'%${{ matrix.spack_compiler }}'"]
spack -e ./share/spack-env/ config add packages:hdf5:require:["'%${{ matrix.spack_compiler }}'"]
spack -e ./share/spack-env/ config add packages:openmpi:require:["'%${{ matrix.spack_compiler }}'"]
spack -e ./share/spack-env/ concretize -f
spack -e ./share/spack-env/ install --no-check-signature
- name: Build with Cmake
shell: spack-bash {0}
run: |
spack env activate ./share/spack-env/
mkdir build
cd build
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} \
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DSELF_MPIEXEC_NUMPROCS=2 \
../
make VERBOSE=1
- name: Initialize coverage counters
if: ${{ matrix.build_type == 'coverage' }}
run: |
sudo apt-get update -y && sudo apt-get install lcov
lcov --capture \
--initial \
--directory ./build/src/ \
--gcov=${{ matrix.gcov }} \
--output-file /home/runner/work/initial.info
- name: Run ctests
run: |
export WORKSPACE=/home/runner/work/SELF/SELF/
ctest --verbose \
--output-on-failure \
--test-dir ./build/
- name: Create coverage report
if: ${{ matrix.build_type == 'coverage' }}
run: |
lcov --capture \
--directory ./build/src/ \
--gcov=${{ matrix.gcov }} \
--output-file /home/runner/work/ctest-capture.info
lcov --add-tracefile /home/runner/work/initial.info \
--add-tracefile /home/runner/work/ctest-capture.info \
--gcov=${{ matrix.gcov }} \
--output-file /home/runner/work/coverage.info
- name: codecov
if: ${{ matrix.build_type == 'coverage' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: /home/runner/work/coverage.info
flags: github-serial-ctests
- name: Run memory checks with Valgrind (only Linux and GNU compilers)
if: ${{ matrix.memcheck }}
run: |
sudo apt-get install -y valgrind
for f in $(find ./build/test/ -executable -type f)
do
echo $f
valgrind --undef-value-errors=no --error-exitcode=1 -s $f -A
done
- name: Push packages and update index
run: |
spack -e ./share/spack-env/ mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
spack -e ./share/spack-env/ buildcache push --base-image ${{ matrix.spack_os }} --update-index local-buildcache
if: ${{ !cancelled() }}