Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/tests-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,84 @@ jobs:
path: ${{matrix.image}}_${{matrix.backend}}.tar
retention-days: 1

coverage-test:
if: github.ref_name != 'main'
strategy:
fail-fast: false
matrix:
image: ['latest']
backend:
- name: 'cpu'
c_compiler: 'gcc'
cxx_compiler: 'g++'
cxx_version: ['17']
cmake_build_type: ['Debug']
runs-on: ubuntu-latest
needs: [docker-build, id_repo]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with: {tool-cache: true, large-packages: false}
- name: Checkout built branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Collect image artifact
if: needs.id_repo.outputs.in_base_repo == 'false'
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: |
${{matrix.image}}_${{matrix.backend.name}}-artifact
- name: Load image artifact into docker
if: needs.id_repo.outputs.in_base_repo == 'false'
run: |
docker load < ${{matrix.image}}_${{matrix.backend.name}}.tar
rm ${{matrix.image}}_${{matrix.backend.name}}.tar
- name: Coverage test
run: |
cat<<-'EOF' > run.sh
set -xe
git config --global --add safe.directory '*'

export CMAKE_BUILD_PARALLEL_LEVEL=4
export CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}}

export CC=${{matrix.backend.c_compiler}}
export CXX=${{matrix.backend.cxx_compiler}}

cmake \
-D CMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-D CMAKE_CXX_FLAGS="--coverage -fprofile-update=atomic" \
-D DDC_BUILD_BENCHMARKS=OFF \
-D DDC_BUILD_EXAMPLES=OFF \
-D Kokkos_ENABLE_DEPRECATED_CODE_4=OFF \
-D Kokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-B build

cmake --build build
ctest --test-dir build

gcovr \
--exclude-throw-branches \
--filter include/ddc \
--lcov coverage.lcov \
--merge-mode-functions=merge-use-line-0 \
build
EOF

docker run \
--user 0 \
--workdir ${{github.workspace}} \
--volume ${{github.workspace}}:${{github.workspace}} \
ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend.name}}:${GITHUB_SHA:0:7} \
bash run.sh
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
with:
files: coverage.lcov
disable_search: true
token: ${{secrets.CODECOV_TOKEN}}

test:
if: github.ref_name != 'main'
strategy:
Expand Down
13 changes: 13 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (C) The DDC development team, see COPYRIGHT.md file
#
# SPDX-License-Identifier: MIT

---
coverage:
status:
project:
default:
target: auto # auto compares coverage to the previous base commit
patch:
default:
target: 100%
3 changes: 3 additions & 0 deletions docker/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ RUN chmod +x /bin/bash_run \
liblapacke-dev \
libhwloc-dev \
pkg-config \
pipx \
&& python3 -m pipx install gcovr \
&& python3 -m pipx ensurepath \
# Installing cmake < 3.28 to workaround issue with Kokkos
&& wget https://github.com/Kitware/CMake/releases/download/v3.27.9/cmake-3.27.9-linux-x86_64.tar.gz \
&& tar -xvf cmake-3.27.9-linux-x86_64.tar.gz --directory /opt \
Expand Down
Loading