@@ -26,10 +26,10 @@ jobs:
26
26
fail-fast : false
27
27
matrix :
28
28
include :
29
- - {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12, doc: OFF}
30
- - {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15, doc: ON}
31
- - {os: macos-12, cc: gcc-12, cxx: g++-12, doc: OFF}
32
- - {os: macos-12, cc: clang, cxx: clang++, doc: OFF}
29
+ - {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12, doc: OFF, cov: ON }
30
+ - {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15, doc: ON, cov: OFF }
31
+ - {os: macos-12, cc: gcc-12, cxx: g++-12, doc: OFF, cov: OFF }
32
+ - {os: macos-12, cc: clang, cxx: clang++, doc: OFF, cov: OFF }
33
33
34
34
runs-on : ${{ matrix.os }}
35
35
79
79
python3-sphinx
80
80
python3-nbsphinx
81
81
82
+ - name : Install gcovr for test coverage
83
+ if : matrix.cov == 'ON'
84
+ run : |
85
+ python3 -m venv --system-site-packages $HOME/.venv/my_python
86
+ source $HOME/.venv/my_python/bin/activate
87
+ pip install gcovr
88
+ echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
89
+ echo "PATH=$PATH" >> $GITHUB_ENV
90
+
82
91
- name : Install homebrew dependencies
83
92
if : matrix.os == 'macos-12'
84
93
run : |
@@ -123,7 +132,8 @@ jobs:
123
132
mv tmp_basic_array.hpp basic_array.hpp
124
133
mv tmp_basic_array_view.hpp basic_array_view.hpp
125
134
126
- - name : Build nda
135
+ - name : Build nda without test coverage
136
+ if : matrix.cov == 'OFF'
127
137
env :
128
138
CC : ${{ matrix.cc }}
129
139
CXX : ${{ matrix.cxx }}
@@ -132,6 +142,17 @@ jobs:
132
142
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/install -DBuild_Documentation=${{ matrix.doc }} -DPythonSupport=ON
133
143
make -j2 || make -j1 VERBOSE=1
134
144
145
+ - name : Build nda with test coverage
146
+ if : matrix.cov == 'ON'
147
+ env :
148
+ CC : ${{ matrix.cc }}
149
+ CXX : ${{ matrix.cxx }}
150
+ LIBRARY_PATH : /usr/local/opt/llvm/lib
151
+ CXXFLAGS : " ${{ env.CXXFLAGS }} --coverage"
152
+ run : |
153
+ mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/install -DPythonSupport=OFF -DCMAKE_BUILD_TYPE=Debug
154
+ make -j2 || make -j1 VERBOSE=1
155
+
135
156
- name : Test nda
136
157
env :
137
158
DYLD_FALLBACK_LIBRARY_PATH : /usr/local/opt/llvm/lib
@@ -140,6 +161,13 @@ jobs:
140
161
cd build
141
162
ctest -j2 --output-on-failure
142
163
164
+ - name : Generate test coverage HTML output
165
+ if : matrix.cov == 'ON'
166
+ run : |
167
+ cd build
168
+ mkdir coverage
169
+ gcovr --gcov-executable "gcov-12" --root ../c++ --html-details -o coverage/coverage.html .
170
+
143
171
- name : ccache statistics
144
172
if : always()
145
173
run : ccache -sv
@@ -157,3 +185,11 @@ jobs:
157
185
folder : build/doc/html
158
186
branch : github.io
159
187
target-folder : docs/unstable
188
+
189
+ - name : Deploy test coverage
190
+ if : matrix.cov == 'ON' && github.ref == 'refs/heads/unstable'
191
+ uses : JamesIves/github-pages-deploy-action@v4
192
+ with :
193
+ folder : build/coverage
194
+ branch : github.io
195
+ target-folder : docs/coverage
0 commit comments