From 31496f4b69b71e73ebad14c0443bd0a91c717e16 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 5 Aug 2022 14:15:13 +0200 Subject: [PATCH] :construction: add CI check for the API documentation --- .github/workflows/ubuntu.yml | 5 ++++- cmake/ci.cmake | 8 +++++++- docs/mkdocs/scripts/check_structure.py | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c3e225873..eff653cc4 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -151,9 +151,12 @@ jobs: ci_test_documentation: runs-on: ubuntu-latest + strategy: + matrix: + target: [ci_test_examples, ci_test_api_documentation] steps: - uses: actions/checkout@v3 - name: Run CMake run: cmake -S . -B build -DJSON_CI=On - name: Build - run: cmake --build build --target ci_test_documentation + run: cmake --build build --target ${{ matrix.target }} diff --git a/cmake/ci.cmake b/cmake/ci.cmake index 22cf09093..ee8d64af9 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -953,12 +953,18 @@ add_custom_target(ci_icpc # test documentation ############################################################################### -add_custom_target(ci_test_documentation +add_custom_target(ci_test_examples COMMAND make CXX="${GCC_TOOL}" check_output_portable -j8 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs COMMENT "Check that all examples compile and create the desired output" ) +add_custom_target(ci_test_api_documentation + COMMAND ${Python3_EXECUTABLE} scripts/check_structure.py + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs/mkdocs + COMMENT "Lint the API documentation" +) + ############################################################################### # Clean up all generated files. ############################################################################### diff --git a/docs/mkdocs/scripts/check_structure.py b/docs/mkdocs/scripts/check_structure.py index 76589ce47..643482af2 100755 --- a/docs/mkdocs/scripts/check_structure.py +++ b/docs/mkdocs/scripts/check_structure.py @@ -3,6 +3,7 @@ import glob import os.path import re +import sys warnings = 0 @@ -173,3 +174,6 @@ if __name__ == '__main__': check_structure() check_examples() print(120 * '-') + + if warnings > 0: + sys.exit(1)