Skip to content

Commit

Permalink
init gcov
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenoTan committed Apr 23, 2022
1 parent d20c0e8 commit aca6da1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/gcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Minimal Installation

on: # yamllint disable-line rule:truthy
push:
branches:
- master
pull_request:

jobs:

import:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
torch-version: [1.11.0]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install PyTorch ${{ matrix.torch-version }}+cpu
run: |
pip install torch==${{ matrix.torch-version}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Configure
run: |
Torch_DIR=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'` cmake -S . -B build -DWITH_COV=ON -DCMAKE_BUILD_TYPE=Debug
- name: Build
run: |
cmake --build build --config Debug
- name: Test
run: |
cd build
ctest -C Debug --output-on-failure --verbose
cd ..
- name: Gcov
run: |
pip install gcovr
gcovr -r pyg_lib/csrc --xml cov.xml
- name: Upload coverage
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false
files: cov.xml
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ set(PYG_VERSION 0.0.0)
option(WITH_CUDA "Enable CUDA support" OFF)
option(USE_PYTHON "Link to Python when building" ON)
option(BUILD_TEST "Enable testing" ON)
option(WITH_COV "Enable coverage" OFF)

if(WITH_CUDA)
enable_language(CUDA)
add_definitions(-DWITH_CUDA)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr")
endif()

if(WITH_COV)
set(CMAKE_CXX_FLAGS --coverage)
endif()

if (USE_PYTHON)
add_definitions(-DUSE_PYTHON)
find_package(Python3 REQUIRED COMPONENTS Development)
Expand Down

0 comments on commit aca6da1

Please sign in to comment.