1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00

add workflow to publish documentation

This commit is contained in:
Lars Melchior 2020-06-03 14:19:25 +02:00
parent 6df5e095c9
commit 2842f07b53
4 changed files with 39 additions and 6 deletions

27
.github/workflows/documentation.yaml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Documentation
on:
push:
tags:
- '*'
jobs:
build:
name: Build and publish documentation
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install doxygen
run: brew install doxygen
- name: Build
run: |
cmake -Hdocumentation -Bbuild
cmake --build build --target GenerateDocs
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/doxygen/html

View file

@ -123,6 +123,12 @@ See [here](https://github.com/TheLartians/StaticTypeInfo) for an example header-
Simply remove the standalone / documentation directory and according github workflow file.
> Can I build the standalone and tests at the same time?
To keep the template modular, projects have been separated into their own CMake modules.
However it's easy to create a new directory, say `all`, that uses CPM.cmake to add both the standalone and the tests (as well as any other subprojects).
It's not recommended to include the standalone or tests from the main CMakeLists, as it will make the project mode difficult to be used as a library.
> I see you are using `GLOB` to add source files in CMakeLists.txt. Isn't that evil?
Glob is considered bad because any changes to the source file structure [might not be automatically caught](https://cmake.org/cmake/help/latest/command/file.html#filesystem) by CMake's builders and you will need to manually invoke CMake on changes.

View file

@ -8,7 +8,7 @@ namespace greeter {
enum class LanguageCode { EN, DE, ES, FR };
/**
* A class for greeting in multiple languages
* A class for saying hello in multiple languages
*/
class Greeter {
std::string name;

View file

@ -4,10 +4,10 @@
TEST_CASE("Greeter") {
using namespace greeter;
Greeter greeter("World");
Greeter greeter("Tests");
CHECK(greeter.greet(LanguageCode::EN) == "Hello, World!");
CHECK(greeter.greet(LanguageCode::DE) == "Hallo World!");
CHECK(greeter.greet(LanguageCode::ES) == "¡Hola World!");
CHECK(greeter.greet(LanguageCode::FR) == "Bonjour World!");
CHECK(greeter.greet(LanguageCode::EN) == "Hello, Tests!");
CHECK(greeter.greet(LanguageCode::DE) == "Hallo Tests!");
CHECK(greeter.greet(LanguageCode::ES) == "¡Hola Tests!");
CHECK(greeter.greet(LanguageCode::FR) == "Bonjour Tests!");
}