From ed8831543cb14b0a84cef3c5ffdac46522f61015 Mon Sep 17 00:00:00 2001 From: nagajaideep <160611865+nagajaideep@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:54:45 +0530 Subject: [PATCH] Update CI workflow for C++ coverage generation and testing (#571) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update CI workflow for C++ coverage generation and testing * Avoid mkdir error in CI workflow by using -p * Update CI workflow to include coverage flags Review-1 * Added lcov to environment.yml under myst_nb * Apply coverage flag in build and adjust C++ testing * added installation lcov * Update .github/workflows/ci.yml * Apply suggestions from code review --------- Co-authored-by: ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) --- .github/workflows/ci.yml | 17 +++++++++++++++-- environment.yml | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b416eb02d..77e81bac5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,15 +33,28 @@ 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: | - python scripts/build/install.py - + CXXFLAGS=--coverage CFLAGS=--coverage python scripts/build/install.py +# coverage tests - name: Run tests run: | python -m pytest --doctest-modules --cov=./ --cov-report=xml -s + - name: Capture Coverage Data with lcov + run: | + lcov --capture --directory . --output-file coverage.info --no-external + + - name: Generate HTML Coverage Report with genhtml + run: | + genhtml coverage.info --output-directory coverage_report + - name: Upload Coverage uses: codecov/codecov-action@v3 with: diff --git a/environment.yml b/environment.yml index ca80a2b9a..ba0dc8c1b 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