Skip to content

Commit 00851b5

Browse files
author
Julian LALU
committed
Update coverage
1 parent cace2be commit 00851b5

File tree

6 files changed

+114
-55
lines changed

6 files changed

+114
-55
lines changed

.github/workflows/coverage.yml

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,86 @@ on:
77
jobs:
88
# We deactivate it because LCOV_EXCL_START and LCOV_EXCL_STOP are not
99
# taken into account, same for if (hud::is_constant_evaluated())
10-
11-
coverage_windows_msvc:
10+
# coverage_windows_msvc:
11+
# runs-on: windows-latest
12+
# steps:
13+
# - name: Checkout repository
14+
# uses: actions/checkout@v3
15+
# - name: Set SSH Key
16+
# uses: webfactory/ssh-agent@v0.7.0
17+
# with:
18+
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
19+
# - name: Generate visual Studio solution
20+
# run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Btarget -G "Visual Studio 17 2022" -T host=x64 -A x64 -DCOVERAGE:BOOL=ON
21+
# - name: Build and test
22+
# run: cmake.exe --build target --config Debug
23+
# - name: Upload coverage report to Codecov
24+
# run: |
25+
# $ProgressPreference = 'SilentlyContinue'
26+
# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile .\target\codecov.exe
27+
# .\target\codecov.exe -f target\test\Debug\coverage.windows.msvc.cobertura -t ${{secrets.CODECOV_TOKEN}}
28+
# - name: Upload artifacts
29+
# uses: actions/upload-artifact@v4
30+
# with:
31+
# name: coverage-windows-msvc
32+
# path: |
33+
# target\test\Debug\coverage.msvc.cobertura
34+
35+
coverage_windows_clangcl:
1236
runs-on: windows-latest
1337
steps:
1438
- name: Checkout repository
1539
uses: actions/checkout@v3
16-
- name: Set SSH Key
17-
uses: webfactory/ssh-agent@v0.7.0
18-
with:
19-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
2040
- name: Generate visual Studio solution
21-
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Btarget -G "Visual Studio 17 2022" -T host=x64 -A x64 -DCOVERAGE:BOOL=ON
41+
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin\clang-cl.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin\clang-cl.exe" -Btarget -G "Visual Studio 17 2022" -T ClangCL,host=x64 -A x64 -DCOVERAGE:BOOL=ON
2242
- name: Build and test
23-
run: cmake.exe --build target --config Debug
43+
run: cmake.exe --build target --config Debug -j 16
2444
- name: Upload coverage report to Codecov
2545
run: |
2646
$ProgressPreference = 'SilentlyContinue'
2747
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile .\target\codecov.exe
28-
.\target\codecov.exe -f target\test\Debug\coverage.windows.msvc.cobertura -t ${{secrets.CODECOV_TOKEN}}
48+
.\target\codecov.exe -f target\test\coverage.windows.clang.lcov.info -t ${{secrets.CODECOV_TOKEN}}
2949
- name: Upload artifacts
3050
uses: actions/upload-artifact@v4
3151
with:
32-
name: coverage-windows-msvc
52+
name: coverage-windows-clang
3353
path: |
34-
target\test\Debug\coverage.msvc.cobertura
54+
target\test\coverage.windows.clang.lcov.info
55+
target\test\windows-clang\
3556
36-
coverage_windows_clangcl:
57+
coverage_windows_mingw:
3758
runs-on: windows-latest
3859
steps:
3960
- name: Checkout repository
4061
uses: actions/checkout@v3
41-
- name: Set SSH Key
42-
uses: webfactory/ssh-agent@v0.7.0
43-
with:
44-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
4562
- name: Generate visual Studio solution
46-
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin\clang-cl.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin\clang-cl.exe" -Btarget -G "Visual Studio 17 2022" -T ClangCL,host=x64 -A x64 -DCOVERAGE:BOOL=ON
63+
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH="x86_64-w64-mingw32-gcc.exe" -DCMAKE_CXX_COMPILER:FILEPATH="x86_64-w64-mingw32-g++.exe" -Btarget -G "MinGW Makefiles" -DCOVERAGE:BOOL=ON
4764
- name: Build and test
48-
run: cmake.exe --build target --config Debug
65+
run: cmake.exe --build target --config Debug -j 16
4966
- name: Upload coverage report to Codecov
5067
run: |
5168
$ProgressPreference = 'SilentlyContinue'
5269
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile .\target\codecov.exe
53-
.\target\codecov.exe -f target\test\coverage.windows.clang.lcov.info -t ${{secrets.CODECOV_TOKEN}}
70+
.\target\codecov.exe -f target\test\coverage.windows.mingw.lcov.info -t ${{secrets.CODECOV_TOKEN}}
5471
- name: Upload artifacts
5572
uses: actions/upload-artifact@v4
5673
with:
57-
name: coverage-windows-clangcl
74+
name: coverage-windows-mingw
5875
path: |
59-
target\test\coverage.windows.clang.lcov.info
60-
target\test\windows\
61-
76+
target\test\coverage.windows.mingw.lcov.info
77+
target\test\windows-mingw\
78+
6279
coverage_linux_clang_14:
6380
runs-on: ubuntu-22.04
6481
steps:
6582
- name: Checkout repository
6683
uses: actions/checkout@v3
67-
- name: Set SSH Key
68-
uses: webfactory/ssh-agent@v0.7.0
69-
with:
70-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
7184
- name: Install tools
7285
run: sudo apt-get install llvm -y
7386
- name: Generate Unix Makfiles
7487
run: cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++-14 -Btarget -G "Unix Makefiles" -DCOVERAGE:BOOL=ON
7588
- name: Build and test
76-
run: cmake --build target --config Debug
89+
run: cmake --build target -j 16
7790
- name: Upload coverage report to Codecov
7891
run: |
7992
curl -Os https://uploader.codecov.io/latest/linux/codecov
@@ -92,16 +105,12 @@ jobs:
92105
steps:
93106
- name: Checkout repository
94107
uses: actions/checkout@v3
95-
- name: Set SSH Key
96-
uses: webfactory/ssh-agent@v0.7.0
97-
with:
98-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
99108
- name: Install tools
100109
run: sudo ln -fs /usr/bin/gcov-12 /usr/bin/gcov
101110
- name: Generate Unix Makfiles
102111
run: cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-12 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++-12 -Btarget -G "Unix Makefiles" -DCOVERAGE:BOOL=ON
103112
- name: Build and test
104-
run: cmake --build target --config Debug
113+
run: cmake --build target -j 16
105114
- name: Upload coverage report to Codecov
106115
run: |
107116
curl -Os https://uploader.codecov.io/latest/linux/codecov

.github/workflows/windows_mingw_64.yml renamed to .github/workflows/windows_mingw_x86_64.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,25 @@ jobs:
1515
C:/msys64/usr/bin/pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain --noconfirm
1616
$env:Path += ";C:\msys64\ucrt64\bin"
1717
- name: Generate
18-
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH="gcc.exe" -DCMAKE_CXX_COMPILER:FILEPATH="g++.exe" -Btarget -G "MinGW Makefiles"
18+
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH="x86_64-w64-mingw32-gcc.exe" -DCMAKE_CXX_COMPILER:FILEPATH="x86_64-w64-mingw32-g++.exe" -Btarget -G "MinGW Makefiles"
1919
- name: Build
20-
run: cmake --build target -- -j 8
20+
run: cmake --build target -- -j 16
2121
- name: Test
22-
run: ctest --test-dir target -j8 -C Release -T test --output-on-failure
23-
# No test report for the moment
24-
# - name: Test Report
25-
# uses: dorny/test-reporter@v1
26-
# if: success() || failure()
27-
# with:
28-
# name: Windows CityHash Test Report
29-
# path: target/test/test_*_report.xml
30-
# reporter: java-junit
22+
run: ctest --test-dir target -j16 -C Release -T test --output-on-failure
23+
- name: Test Report
24+
uses: dorny/test-reporter@v1
25+
if: success() || failure()
26+
with:
27+
name: Windows CityHash Test Report
28+
path: target/test/test_*_report.xml
29+
reporter: java-junit
3130
- name: Release
3231
run: |
33-
mkdir -p release
34-
cp -R target/test/test_core.exe release
35-
cp -R target/src/*.a release
36-
cp -R interface/core release/core
32+
xcopy target\test\Release release\ /s /y
33+
xcopy target\src\Release release\ /s /y
34+
xcopy src\core release\core\ /s /y
3735
- name: Upload artifacts
3836
uses: actions/upload-artifact@v4
3937
with:
40-
name: windows_mingw_64
38+
name: windows_mingw_x86_64
4139
path: release\**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
| | |
1919
| --- | --- |
20-
| Windows build and test | [![msvc_2022_x86-64](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_msvc_2022_x86-64.yml?label=MSVC%202022%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_msvc_2022_x86-64.yml) [![clang-cl_2022_x86-64](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_clang_cl_2022_x86-64.yml?label=Clang-cl%202022%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_clang_cl_2022_x86-64.yml) [![mingw_64](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_mingw_64.yml?label=MinGW%2064&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_mingw_64.yml) [![wasm](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_wasm.yml?label=WebAssembly&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_wasm.yml) |
20+
| Windows build and test | [![msvc_2022_x86-64](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_msvc_2022_x86-64.yml?label=MSVC%202022%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_msvc_2022_x86-64.yml) [![clang-cl_2022_x86-64](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_clang_cl_2022_x86-64.yml?label=Clang-cl%202022%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_clang_cl_2022_x86-64.yml) [![mingw_64](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_mingw_x86_64.yml?label=MinGW%2064&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_mingw_x86_64.yml) [![wasm](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_wasm.yml?label=WebAssembly&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/windows_wasm.yml) |
2121
| Ubuntu build and test | [![clang_14_x86-64](https://img.shields.io/github/actions/workflow/status/hud-software/core/ubuntu_clang14_x86-64.yml?label=Clang%2014%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/ubuntu_clang14_x86-64.yml) [![gcc_12_x86-64](https://img.shields.io/github/actions/workflow/status/hud-software/core/ubuntu_gcc12_x86-64.yml?label=GCC%2012%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/ubuntu_gcc12_x86-64.yml) |
2222
| Sanitizer | [![MSVC](https://img.shields.io/github/actions/workflow/status/hud-software/core/windows_msvc_2022_x86-64.yml?label=MSVC%202022%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/sanitizer_msvc.yml) [![GCC](https://img.shields.io/github/actions/workflow/status/hud-software/core/sanitizer_gcc12.yml?label=GCC%2012%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/sanitizer_gcc12.yml) [![Clang](https://img.shields.io/github/actions/workflow/status/hud-software/core/sanitizer_clang14.yml?label=Clang%2014%20x86-64&logo=C%2B%2B&logoColor=lightgrey&style=flat-square)](https://github.com/HUD-Software/core/actions/workflows/sanitizer_clang14.yml) |
2323
| Coverage | [![codecov](https://img.shields.io/codecov/c/github/hud-software/core?label=Codecov&logo=Codecov&logoColor=lightgrey&style=flat-square)](https://app.codecov.io/gh/HUD-Software/core) |

coverage.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ string(
3333
)
3434

3535
function(enable_coverage project_name lib_name)
36-
if(MSVC)
36+
if(MSVC OR MINGW)
3737
include(${CMAKE_SOURCE_DIR}/coverage_windows.cmake)
3838
enable_windows_coverage(${project_name} ${lib_name})
3939
elseif(UNIX)

coverage_unix.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ function(enable_unix_coverage project_name lib_name)
8080
..
8181
)
8282
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
83-
8483
message("Enable GCC coverage")
8584
target_compile_options(${project_name} PRIVATE --coverage)
8685
target_link_options(${project_name} PRIVATE --coverage)

coverage_windows.cmake

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ if(NOT WIN32)
33
message(FATAL_ERROR "Windows coverage.cmake should not be used if not Windows OS")
44
endif()
55

6+
message("Enable GCC coverage")
7+
68
function(enable_windows_coverage project_name lib_name)
79
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
810
message("Enable MSCV coverage with Clang-cl")
@@ -17,7 +19,7 @@ function(enable_windows_coverage project_name lib_name)
1719
add_custom_command(
1820
TARGET ${project_name} POST_BUILD
1921
COMMAND echo Download Grcov...
20-
COMMAND Powershell.exe Invoke-WebRequest -Uri https://github.com/mozilla/grcov/releases/download/v0.8.13/grcov-x86_64-pc-windows-msvc.zip -OutFile ./grcov-x86_64-pc-windows-msvc.zip
22+
COMMAND Powershell.exe Invoke-WebRequest -Uri https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-pc-windows-msvc.zip -OutFile ./grcov-x86_64-pc-windows-msvc.zip
2123
COMMAND Powershell.exe Expand-Archive -Path ./grcov-x86_64-pc-windows-msvc.zip -DestinationPath . -F
2224
)
2325

@@ -60,7 +62,7 @@ function(enable_windows_coverage project_name lib_name)
6062
--excl-br-start "^.*LCOV_EXCL_START.*"
6163
--excl-br-stop "^.*LCOV_EXCL_STOP.*"
6264
--excl-br-line "\"(\\s*^.*GTEST_TEST\\.*)|(^.*LCOV_EXCL_BR_LINE.*)\""
63-
-o windows
65+
-o windows.clang
6466
..
6567
)
6668

@@ -107,7 +109,58 @@ function(enable_windows_coverage project_name lib_name)
107109
)
108110
elseif(MINGW)
109111
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
110-
message(STATUS "Compilateur MinGW (GCC) détecté")
112+
message("Enable GCC coverage")
113+
target_compile_options(${project_name} PRIVATE --coverage)
114+
target_link_options(${project_name} PRIVATE --coverage)
115+
target_compile_options(${lib_name} PRIVATE --coverage)
116+
117+
add_custom_command(
118+
TARGET ${project_name} POST_BUILD
119+
COMMAND echo Download Grcov...
120+
COMMAND Powershell.exe Invoke-WebRequest -Uri https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-pc-windows-msvc.zip -OutFile ./grcov-x86_64-pc-windows-msvc.zip
121+
COMMAND Powershell.exe Expand-Archive -Path ./grcov-x86_64-pc-windows-msvc.zip -DestinationPath . -F
122+
)
123+
124+
add_custom_command(
125+
TARGET ${project_name} POST_BUILD
126+
COMMAND echo Start coverage...
127+
COMMAND ./${project_name}
128+
)
129+
130+
add_custom_command(
131+
TARGET ${project_name} POST_BUILD
132+
COMMAND echo Generate HTML report...
133+
COMMAND ./grcov -t html -b . -s ./../../
134+
--llvm-path /usr/bin/
135+
#--branch
136+
--keep-only "src/*"
137+
--keep-only "interface/*"
138+
--excl-start "^.*LCOV_EXCL_START.*"
139+
--excl-stop "^.*LCOV_EXCL_STOP.*"
140+
--excl-line "\"(\\s*^.*GTEST_TEST\\.*)|(^.*LCOV_EXCL_LINE.*)\""
141+
--excl-br-start "^.*LCOV_EXCL_START.*"
142+
--excl-br-stop "^.*LCOV_EXCL_STOP.*"
143+
--excl-br-line "\"(\\s*^.*GTEST_TEST\\.*)|(^.*LCOV_EXCL_BR_LINE.*)\""
144+
-o windows.mingw
145+
..
146+
)
147+
add_custom_command(
148+
TARGET ${project_name} POST_BUILD
149+
COMMAND echo Generate LCOV report...
150+
COMMAND ./grcov -t lcov -b . -s ./../../
151+
--llvm-path /usr/bin/
152+
#--branch
153+
--keep-only "src/*"
154+
--keep-only "interface/*"
155+
--excl-start "^.*LCOV_EXCL_START.*"
156+
--excl-stop "^.*LCOV_EXCL_STOP.*"
157+
--excl-line "\"(\\s*^.*GTEST_TEST\\.*)|(^.*LCOV_EXCL_LINE.*)\""
158+
--excl-br-start "^.*LCOV_EXCL_START.*"
159+
--excl-br-stop "^.*LCOV_EXCL_STOP.*"
160+
--excl-br-line "\"(\\s*^.*GTEST_TEST\\.*)|(^.*LCOV_EXCL_BR_LINE.*)\""
161+
-o coverage.windows.mingw.lcov.info
162+
..
163+
)
111164
else()
112165
message(FATAL_ERROR "Unsupported compiler for MinGW")
113166
endif()

0 commit comments

Comments
 (0)