Skip to content

Commit

Permalink
add codecov CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Dec 12, 2021
1 parent a9834a4 commit ea51db5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,42 @@ jobs:
sed -i 's/\(-forward-unknown-to-host-compiler\|--generate-code=arch=[^ ]\+\|--expt-extended-lambda\|--expt-relaxed-constexpr\|--use_fast_math\)//g' compile_commands.json # remove NVCC specific flags which clang cannot handle
run-clang-tidy-12 -header-filter='^((?!/thirdparty/).)*$' -extra-arg=--no-cuda-version-check -extra-arg=-nocudalib
coverage:
runs-on: ubuntu-latest
env:
CXX: g++
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: apt install boost and lcov
run: |
sudo apt install libboost-all-dev lcov
- name: vcpkg install dependencies
run: |
vcpkg install catch2 fmt
- name: cmake
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLLAMA_ENABLE_COVERAGE_FOR_TESTS=ON -DLLAMA_BUILD_EXAMPLES=OFF -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: build tests
run: |
cmake --build build -j $THREADS
- name: run tests
run: |
build/tests
- name: generate coverage report
run: |
lcov --capture --directory build --output-file coverage.info
#lcov --remove coverage.info '/usr/*' --output-file coverage.info
#lcov --list coverage.info
- name: upload coverage report
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov
amalgamation:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ if (BUILD_TESTING)
option(LLAMA_ENABLE_COVERAGE_FOR_TESTS "Enables code coverage for tests" OFF)
if (LLAMA_ENABLE_COVERAGE_FOR_TESTS)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(tests INTERFACE --coverage)
target_link_options(tests INTERFACE --coverage)
target_compile_options(tests PRIVATE --coverage)
target_link_options(tests PRIVATE --coverage)
endif()
endif()
endif()
Expand Down

0 comments on commit ea51db5

Please sign in to comment.