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. ###############################################################################