Skip to content

Commit d94d8de

Browse files
committed
Workflow wip...
1 parent 19f3019 commit d94d8de

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

.github/workflows/build_cmake.yml

+37-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
config:
13-
- name: "Ubuntu latest GCC 9.3"
13+
- name: "Ubuntu 20.04 GCC 9.3"
1414
os: ubuntu-20.04
1515
build_type: Release
1616
packages: ninja-build
1717
generator: Ninja
1818
cc: gcc
1919
cxx: g++
2020

21+
- name: "Ubuntu 20.04 GCC 9.3 coverage"
22+
os: ubuntu-20.04
23+
build_type: Debug
24+
packages: ninja-build lcov
25+
generator: Ninja
26+
cc: gcc
27+
cxx: g++
28+
2129
- name: "Ubuntu 18.04 GCC 8.4"
2230
os: ubuntu-18.04
2331
build_type: Release
@@ -26,6 +34,14 @@ jobs:
2634
cc: gcc-8
2735
cxx: g++-8
2836

37+
- name: "Ubuntu 18.04 GCC 7.5"
38+
os: ubuntu-18.04
39+
build_type: Release
40+
packages: ninja-build
41+
generator: Ninja
42+
cc: gcc-7
43+
cxx: g++-7
44+
2945
- name: "Windows MSVC 2019"
3046
os: windows-latest
3147
build_type: Release
@@ -52,8 +68,12 @@ jobs:
5268
5369
- name: Install dependencies on Ubuntu
5470
if: startsWith(matrix.config.os, 'ubuntu')
71+
shell: bash
5572
run: |
5673
sudo apt install ${{ matrix.config.packages }}
74+
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
75+
gem install coveralls-lcov
76+
fi
5777
5878
- name: Install dependencies on windows
5979
if: startsWith(matrix.config.os, 'windows')
@@ -74,11 +94,24 @@ jobs:
7494
cmake --version
7595
mkdir build
7696
mkdir install
77-
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_INSTALL_PREFIX:PATH=install
97+
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
98+
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=Debug -DGHC_COVERAGE=ON -DCMAKE_INSTALL_PREFIX:PATH=install
99+
else
100+
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_INSTALL_PREFIX:PATH=install
101+
fi
78102
79103
- name: Build project
80104
shell: bash
81-
run: cmake --build build --config ${{ matrix.config.build_type }}
105+
run: |
106+
cmake --build build --config ${{ matrix.config.build_type }}
82107
83108
- name: Run tests
84-
run: cd build && ctest -C ${{ matrix.config.build_type }}
109+
run: |
110+
cd build && ctest -C ${{ matrix.config.build_type }}
111+
112+
- name: Collect coverage info
113+
run: |
114+
cd build
115+
lcov --compat-libtool --directory . --capture --output-file coverage_output.info
116+
lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info
117+
sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info

cmake/GhcHelper.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ macro(AddTestExecutableWithStdCpp cppStd)
5252
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
5353
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
5454
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
55-
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
55+
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
56+
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
5657
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
5758
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)
5859
endif()

test/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ if(GHC_COVERAGE)
1313
target_compile_options(filesystem_test PUBLIC --coverage)
1414
endif()
1515
target_link_libraries(filesystem_test PUBLIC ghc_filesystem --coverage)
16+
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
17+
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
18+
endif()
19+
if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
20+
AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp)
21+
endif()
1622
else()
1723
message("Generating test runner for normal test...")
1824
add_executable(filesystem_test filesystem_test.cpp catch.hpp)

0 commit comments

Comments
 (0)