Workflow wip...

This commit is contained in:
Steffen Schuemann 2021-07-04 15:34:16 +02:00
parent 19f301992b
commit d94d8de098
3 changed files with 45 additions and 5 deletions

View File

@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
config:
- name: "Ubuntu latest GCC 9.3"
- name: "Ubuntu 20.04 GCC 9.3"
os: ubuntu-20.04
build_type: Release
packages: ninja-build
@ -18,6 +18,14 @@ jobs:
cc: gcc
cxx: g++
- name: "Ubuntu 20.04 GCC 9.3 coverage"
os: ubuntu-20.04
build_type: Debug
packages: ninja-build lcov
generator: Ninja
cc: gcc
cxx: g++
- name: "Ubuntu 18.04 GCC 8.4"
os: ubuntu-18.04
build_type: Release
@ -26,6 +34,14 @@ jobs:
cc: gcc-8
cxx: g++-8
- name: "Ubuntu 18.04 GCC 7.5"
os: ubuntu-18.04
build_type: Release
packages: ninja-build
generator: Ninja
cc: gcc-7
cxx: g++-7
- name: "Windows MSVC 2019"
os: windows-latest
build_type: Release
@ -52,8 +68,12 @@ jobs:
- name: Install dependencies on Ubuntu
if: startsWith(matrix.config.os, 'ubuntu')
shell: bash
run: |
sudo apt install ${{ matrix.config.packages }}
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
gem install coveralls-lcov
fi
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
@ -74,11 +94,24 @@ jobs:
cmake --version
mkdir build
mkdir install
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_INSTALL_PREFIX:PATH=install
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=Debug -DGHC_COVERAGE=ON -DCMAKE_INSTALL_PREFIX:PATH=install
else
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_INSTALL_PREFIX:PATH=install
fi
- name: Build project
shell: bash
run: cmake --build build --config ${{ matrix.config.build_type }}
run: |
cmake --build build --config ${{ matrix.config.build_type }}
- name: Run tests
run: cd build && ctest -C ${{ matrix.config.build_type }}
run: |
cd build && ctest -C ${{ matrix.config.build_type }}
- name: Collect coverage info
run: |
cd build
lcov --compat-libtool --directory . --capture --output-file coverage_output.info
lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info
sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info

View File

@ -52,7 +52,8 @@ macro(AddTestExecutableWithStdCpp cppStd)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()

View File

@ -13,6 +13,12 @@ if(GHC_COVERAGE)
target_compile_options(filesystem_test PUBLIC --coverage)
endif()
target_link_libraries(filesystem_test PUBLIC ghc_filesystem --coverage)
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
endif()
if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp)
endif()
else()
message("Generating test runner for normal test...")
add_executable(filesystem_test filesystem_test.cpp catch.hpp)