Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage report to CI #1378

Merged
merged 1 commit into from
Mar 14, 2023
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
27 changes: 17 additions & 10 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,23 @@ jobs:
- name: Ensure Python dependencies
run: |
pip install torch~=1.13 --extra-index-url https://download.pytorch.org/whl/cpu &&\
pip install --user -r tools/python_api/requirements_dev.txt
pip install --user -r tools/python_api/requirements_dev.txt -f https://data.pyg.org/whl/torch-1.13.0+cpu.html

- name: Build
run: CC=gcc CXX=g++ make release NUM_THREADS=32

- name: Test
run: CC=gcc CXX=g++ make test NUM_THREADS=32
- name: Test with coverage
run: CC=gcc CXX=g++ make lcov NUM_THREADS=32

- name: Python test
run: CC=gcc CXX=g++ make pytest NUM_THREADS=32
run: CC=clang-14 CXX=clang++-14 make pytest NUM_THREADS=32

- name: Generate coverage report
run: |
lcov -c -d ./ --no-external -o cover.info &&\
lcov --remove cover.info $(< .github/workflows/lcov_exclude) -o cover.info

- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
file: cover.info

gcc-build-test-with-asan:
name: gcc build & test with asan
Expand All @@ -40,7 +47,7 @@ jobs:
- name: Ensure Python dependencies
run: |
pip install torch~=1.13 --extra-index-url https://download.pytorch.org/whl/cpu &&\
pip install --user -r tools/python_api/requirements_dev.txt
pip install --user -r tools/python_api/requirements_dev.txt -f https://data.pyg.org/whl/torch-1.13.0+cpu.html

- name: Build debug
run: CC=gcc CXX=g++ make alldebug NUM_THREADS=32
Expand Down Expand Up @@ -70,7 +77,7 @@ jobs:
- name: Ensure python dependencies
run: |
pip install torch~=1.13 --extra-index-url https://download.pytorch.org/whl/cpu &&\
pip install --user -r tools/python_api/requirements_dev.txt
pip install --user -r tools/python_api/requirements_dev.txt -f https://data.pyg.org/whl/torch-1.13.0+cpu.html

- name: Build
run: CC=clang-14 CXX=clang++-14 make release NUM_THREADS=32
Expand Down Expand Up @@ -103,7 +110,7 @@ jobs:
- name: Ensure Python dependencies
run: |
pip install torch~=1.13 --extra-index-url https://download.pytorch.org/whl/cpu &&\
pip install --user -r tools/python_api/requirements_dev.txt
pip install --user -r tools/python_api/requirements_dev.txt -f https://data.pyg.org/whl/torch-1.13.0+cpu.html

- name: Build
run: make benchmark NUM_THREADS=30
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lcov_exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*/third_party/*
*/_deps/*
*/test/*
*/external/*
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ endif()
option(BUILD_TESTS "Build C++ and Python tests." FALSE)
option(BUILD_BENCHMARK "Build benchmarks." FALSE)

option(BUILD_LCOV "Build coverage report." FALSE)
if(${BUILD_LCOV})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif()

function(link_threads LIBRARY)
if (CMAKE_VERSION VERSION_LESS "3.1")
target_link_libraries(${LIBRARY} pthread)
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ test: arrow
cd $(ROOT_DIR)/build/release/test && \
ctest

lcov: arrow
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE -DBUILD_LCOV=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)
cd $(ROOT_DIR)/build/release/test && \
ctest

pytest: arrow
$(MAKE) release
cd $(ROOT_DIR)/tools/python_api/test && \
Expand Down
2 changes: 1 addition & 1 deletion scripts/dockerized-ci-tests-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get update && apt-get install -y g++ gcc clang-14 python3-dev python3-pip python-is-python3 cmake nodejs jq curl apt-transport-https gnupg sudo git clang-format-11 ca-certificates lsb-release wget
RUN apt-get update && apt-get install -y g++ gcc clang-14 python3-dev python3-pip python-is-python3 cmake nodejs jq curl apt-transport-https gnupg sudo git clang-format-11 ca-certificates lsb-release wget lcov

RUN useradd --create-home runner
USER runner
Expand Down