From cea030c3e60b4608ed01d5d61b5a7c8280dff123 Mon Sep 17 00:00:00 2001 From: Nagajaideep Date: Sun, 1 Dec 2024 23:22:48 +0530 Subject: [PATCH 1/8] Update CI workflow for C++ coverage generation and testing --- .github/workflows/ci.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b416eb02..b044c58b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,29 @@ jobs: - name: Build package run: | python scripts/build/install.py - + + - name: Build C++ Code with Coverage + run: | + mkdir build + cd build + cmake -DCMAKE_CXX_FLAGS="--coverage" .. + make + + - name: Run C++ Tests + run: | + cd build + ./test_binary + # Capture and Generating Coverage Report with lcov + - name: Capture Coverage Data with lcov + run: | + cd build + lcov --capture --directory . --output-file coverage.info + + - name: Generate HTML Coverage Report with genhtml + run: | + cd build + genhtml coverage.info --output-directory coverage_report + - name: Run tests run: | python -m pytest --doctest-modules --cov=./ --cov-report=xml -s From b68eca0a28d7ff0abb7c8fd2689b1961f39e2abf Mon Sep 17 00:00:00 2001 From: Nagajaideep Date: Sun, 1 Dec 2024 23:35:34 +0530 Subject: [PATCH 2/8] Avoid mkdir error in CI workflow by using -p --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b044c58b..c26983af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Build C++ Code with Coverage run: | - mkdir build + mkdir -p build cd build cmake -DCMAKE_CXX_FLAGS="--coverage" .. make From 1cc5673cc217bafacf90cc79fbfcdc8d95810073 Mon Sep 17 00:00:00 2001 From: Nagajaideep Date: Mon, 2 Dec 2024 19:18:11 +0530 Subject: [PATCH 3/8] Update CI workflow to include coverage flags Review-1 --- .github/workflows/ci.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c26983af..28d855a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,15 +36,8 @@ jobs: - name: Build package run: | - python scripts/build/install.py - - - name: Build C++ Code with Coverage - run: | - mkdir -p build - cd build - cmake -DCMAKE_CXX_FLAGS="--coverage" .. - make - + CXXFLAGS=--coverage CFLAGS=--coverage python scripts/build/install.py + - name: Run C++ Tests run: | cd build From 54fc160b2bb1ec2dc15efc3f7ff590fa744694fd Mon Sep 17 00:00:00 2001 From: Nagajaideep Date: Mon, 2 Dec 2024 19:29:33 +0530 Subject: [PATCH 4/8] Added lcov to environment.yml under myst_nb --- environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment.yml b/environment.yml index ca80a2b9..ba0dc8c1 100644 --- a/environment.yml +++ b/environment.yml @@ -11,3 +11,4 @@ dependencies: - sphinx==5.0 - sphinx-readable-theme==1.3.0 - myst_nb==0.17.2 + - lcov From a12ae30522f5da87a871dc0c92b3dcc2befa3504 Mon Sep 17 00:00:00 2001 From: Nagajaideep Date: Wed, 4 Dec 2024 21:14:08 +0530 Subject: [PATCH 5/8] Apply coverage flag in build and adjust C++ testing --- .github/workflows/ci.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28d855a7..743527cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,12 +37,11 @@ jobs: - name: Build package run: | CXXFLAGS=--coverage CFLAGS=--coverage python scripts/build/install.py - - - name: Run C++ Tests +# coverage tests + - name: Run tests run: | - cd build - ./test_binary - # Capture and Generating Coverage Report with lcov + python -m pytest --doctest-modules --cov=./ --cov-report=xml -s + - name: Capture Coverage Data with lcov run: | cd build @@ -52,10 +51,6 @@ jobs: run: | cd build genhtml coverage.info --output-directory coverage_report - - - name: Run tests - run: | - python -m pytest --doctest-modules --cov=./ --cov-report=xml -s - name: Upload Coverage uses: codecov/codecov-action@v3 From 89a0adc2a2be10f5b222ac4f2e9665f7716b3f6b Mon Sep 17 00:00:00 2001 From: Nagajaideep Date: Fri, 6 Dec 2024 20:56:26 +0530 Subject: [PATCH 6/8] added installation lcov --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 743527cf..d5a542b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,11 @@ jobs: run: | pip install -r requirements.txt pip install -r docs/requirements.txt + + - name: Install lcov + run: | + sudo apt-get update + sudo apt-get install -y lcov - name: Build package run: | @@ -45,6 +50,8 @@ jobs: - name: Capture Coverage Data with lcov run: | cd build + sudo apt-get update + sudo apt-get install -y lcov lcov --capture --directory . --output-file coverage.info - name: Generate HTML Coverage Report with genhtml From 7037b7b4fd139992a006fc19a7d4eadb30d8679d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A8=97=E0=A8=97=E0=A8=A8=E0=A8=A6=E0=A9=80=E0=A8=AA=20?= =?UTF-8?q?=E0=A8=B8=E0=A8=BF=E0=A9=B0=E0=A8=98=20=28Gagandeep=20Singh=29?= Date: Fri, 6 Dec 2024 21:18:04 +0530 Subject: [PATCH 7/8] Update .github/workflows/ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5a542b7..41ae0d90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: cd build sudo apt-get update sudo apt-get install -y lcov - lcov --capture --directory . --output-file coverage.info + lcov --capture --directory . --output-file coverage.info --no-external - name: Generate HTML Coverage Report with genhtml run: | From 74d7956cd3ea4a1c26b83b9a7884a3cbbca0722c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A8=97=E0=A8=97=E0=A8=A8=E0=A8=A6=E0=A9=80=E0=A8=AA=20?= =?UTF-8?q?=E0=A8=B8=E0=A8=BF=E0=A9=B0=E0=A8=98=20=28Gagandeep=20Singh=29?= Date: Fri, 6 Dec 2024 21:38:32 +0530 Subject: [PATCH 8/8] Apply suggestions from code review --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41ae0d90..77e81bac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,14 +49,10 @@ jobs: - name: Capture Coverage Data with lcov run: | - cd build - sudo apt-get update - sudo apt-get install -y lcov lcov --capture --directory . --output-file coverage.info --no-external - name: Generate HTML Coverage Report with genhtml run: | - cd build genhtml coverage.info --output-directory coverage_report - name: Upload Coverage