From a8df5da3f8daaa3d3932055fc25aed08b81bd990 Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Sat, 11 Jun 2022 09:28:37 +0200 Subject: [PATCH] CI: Add single-header build --- .github/workflows/ubuntu.yml | 10 ++++++++++ cmake/ci.cmake | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c24332628..440710427 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -43,6 +43,16 @@ jobs: - name: build run: cmake --build build --target ${{ matrix.target }} + ci_test_single_header: + runs-on: ubuntu-latest + container: ghcr.io/nlohmann/json-ci:v2.4.0 + steps: + - uses: actions/checkout@v3 + - name: cmake + run: cmake -S . -B build -DJSON_CI=On + - name: build + run: cmake --build build --target ci_test_single_header + ci_cmake_options: runs-on: ubuntu-latest container: ghcr.io/nlohmann/json-ci:v2.4.0 diff --git a/cmake/ci.cmake b/cmake/ci.cmake index fb705a687..d8d71d9b7 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -581,6 +581,20 @@ add_custom_target(ci_test_amalgamation COMMENT "Check amalgamation and indentation" ) +############################################################################### +# Build and test using the amalgamated header +############################################################################### + +add_custom_target(ci_test_single_header + COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND} + -DCMAKE_BUILD_TYPE=Debug -GNinja + -DJSON_BuildTests=ON -DJSON_MultipleHeader=OFF -DJSON_FastTests=ON + -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_single_header + COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_single_header + COMMAND cd ${PROJECT_BINARY_DIR}/build_single_header && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure + COMMENT "Compile and test single-header version" +) + ############################################################################### # Valgrind. ###############################################################################