Skip to content

Commit

Permalink
[ghactions] Generate and deploy test coverage information
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoemi09 committed Jul 30, 2024
1 parent e35a2ea commit e1400e6
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
fail-fast: false
matrix:
include:
- {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12, doc: OFF}
- {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15, doc: ON}
- {os: macos-12, cc: gcc-12, cxx: g++-12, doc: OFF}
- {os: macos-12, cc: clang, cxx: clang++, doc: OFF}
- {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12, doc: OFF, cov: ON}
- {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15, doc: ON, cov: OFF}
- {os: macos-12, cc: gcc-12, cxx: g++-12, doc: OFF, cov: OFF}
- {os: macos-12, cc: clang, cxx: clang++, doc: OFF, cov: OFF}

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

Expand Down Expand Up @@ -79,6 +79,15 @@ jobs:
python3-sphinx
python3-nbsphinx
- name: Install gcovr for test coverage
if: matrix.cov == 'ON'
run: |
python3 -m venv --system-site-packages $HOME/.venv/my_python
source $HOME/.venv/my_python/bin/activate
pip install gcovr
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Install homebrew dependencies
if: matrix.os == 'macos-12'
run: |
Expand Down Expand Up @@ -123,7 +132,8 @@ jobs:
mv tmp_basic_array.hpp basic_array.hpp
mv tmp_basic_array_view.hpp basic_array_view.hpp
- name: Build nda
- name: Build nda without test coverage
if: matrix.cov == 'OFF'
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
Expand All @@ -132,6 +142,17 @@ jobs:
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/install -DBuild_Documentation=${{ matrix.doc }} -DPythonSupport=ON
make -j2 || make -j1 VERBOSE=1
- name: Build nda with test coverage
if: matrix.cov == 'ON'
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
LIBRARY_PATH: /usr/local/opt/llvm/lib
CXXFLAGS: "${{ env.CXXFLAGS }} --coverage"
run: |
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/install -DPythonSupport=OFF -DCMAKE_BUILD_TYPE=Debug
make -j2 || make -j1 VERBOSE=1
- name: Test nda
env:
DYLD_FALLBACK_LIBRARY_PATH: /usr/local/opt/llvm/lib
Expand All @@ -140,6 +161,13 @@ jobs:
cd build
ctest -j2 --output-on-failure
- name: Generate test coverage HTML output
if: matrix.cov == 'ON'
run: |
cd build
mkdir coverage
gcovr --gcov-executable "gcov-12" --root ../c++ --html-details -o coverage/coverage.html .
- name: ccache statistics
if: always()
run: ccache -sv
Expand All @@ -157,3 +185,11 @@ jobs:
folder: build/doc/html
branch: github.io
target-folder: docs/unstable

- name: Deploy test coverage
if: matrix.cov == 'ON' && github.ref == 'refs/heads/unstable'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/coverage
branch: github.io
target-folder: docs/coverage

0 comments on commit e1400e6

Please sign in to comment.