YTC (a Yaml Template Class example) is an yaml-cpp example project. The main goal of this project is to show a possible strategy to convert user data types using yaml-cpp.
This project build with following tools:
- C++ version:
C++17 - C++ compiler: Gcc, Clang and Apple Clang
- Source: multiple files
- Package manager: Conan
- Build system: CMake
- Libraries: STL,
yaml-cpp - Code coverage report:
lcov - Testing framework: Google Tests
- CI: GitHub Actions
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
To build YTC you need the following requirements:
- A C++ compiler such as Gcc >= 7.0.0, Clang >= 5.0.0 or Apple Clang >= 10.0.0
- CMake 3.11 or later
- Conan decentralized package manager with a client-server architecture
To enable test coverage reports you need the following requirements:
lcovgenhtml
For project dependencies list see conanfile.txt bundled with this project.
If you're using Ubuntu, you can install the required packages this way:
sudo apt install gcc cmake build-essentialOn macOS you most likely have a compiler so you'll need only cmake:
brew install cmakePlease note that specific versions of libraries and programs at the time of reading this guide may vary. The following dependencies is recommended install using pip:
conan
They can be installed using pip as follows:
pip install -r requirements.txtFirst you'll need clone the project and fetch its modules:
git clone https://github.com/sergeyklay/ytc cd ytcThen build project as follows:
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug cmake --build buildTests expect YTC_TESTS_ROOT environment variable to use fixtures. This variable should point to the tests directory root. Set this variable and run the tests as follows:
export YTC_TESTS_ROOT=$(pwd)/tests cmake --build build --target checkFollow these steps:
- Configure with code coverage instrumentation enabled
-DCODE_COVERAGE=ON - Build project
- Execute the tests to generate the coverage data
- Generate and customize reports as follows:
# Create lcov report lcov --directory build --capture --output-file ./build/coverage.info # Filter out extra files lcov \ --remove ./build/coverage.info \ '/usr/*' \ "${HOME}"'/.conan/*' \ '*/tests/*' \ --output-file ./build/coverage.info # Output coverage data for debugging (Optional) lcov --list ./build/coverage.info # Create a directory to store HTML report mkdir ./build/coverage # Generate HTML report genhtml ./build/coverage.info --output-directory ./build/coverageThis project is licensed under the MIT License - see the LICENSE file for details.