From 325e8ab8ab9d2d321d7a2451e10ddfd7479a8b1e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 27 May 2020 13:22:14 +0200 Subject: [PATCH] :wrench: explicitly switch on tests in CI --- .circleci/config.yml | 10 ++-------- .github/workflows/macos.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 2 +- .travis.yml | 6 +----- README.md | 2 +- appveyor.yml | 2 +- test/CMakeLists.txt | 1 + 8 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 794b21d3..91ceaf7f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,12 +10,9 @@ jobs: - run: name: Install required tools command: 'apt-get update && apt-get install -y gcc g++ git cmake' - - run: - name: Show versions - command: 'g++ --version ; uname -a; cmake --version' - run: name: Run CMake - command: 'mkdir build ; cd build ; cmake ..' + command: 'mkdir build ; cd build ; cmake .. -DJSON_BuildTests=On' - run: name: Compile command: 'cmake --build build' @@ -33,12 +30,9 @@ jobs: - run: name: Install required tools command: 'pacman -Sy --noconfirm base base-devel gcc git cmake' - - run: - name: Show versions - command: 'g++ --version ; uname -a; cmake --version' - run: name: Run CMake - command: 'mkdir build ; cd build ; cmake ..' + command: 'mkdir build ; cd build ; cmake .. -DJSON_BuildTests=On' - run: name: Compile command: 'cmake --build build' diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4444f72b..5b178ad0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: cmake - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On - name: build run: cmake --build build --parallel 10 - name: test diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6ee33cfa..2eefc1c3 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: cmake - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On - name: build run: cmake --build build --parallel 10 - name: test diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f4b07c89..476b21df 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: cmake - run: cmake -S . -B build -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE=Debug + run: cmake -S . -B build -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On - name: build run: cmake --build build --parallel 10 - name: test diff --git a/.travis.yml b/.travis.yml index 3aea08ea..20c44b2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -321,13 +321,9 @@ script: # by default, use the single-header version - if [[ "${MULTIPLE_HEADERS}" == "" ]]; then export MULTIPLE_HEADERS=OFF; fi - # show OS/compiler version - - uname -a - - $CXX --version - # compile and execute unit tests - mkdir -p build && cd build - - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -GNinja && cmake --build . --config Release + - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -GNinja && cmake --build . --config Release -DJSON_BuildTests=On - ctest -C Release --timeout 2700 -V -j - cd .. diff --git a/README.md b/README.md index c536339e..55f79146 100644 --- a/README.md +++ b/README.md @@ -1501,7 +1501,7 @@ To compile and run the tests, you need to execute ```sh $ mkdir build $ cd build -$ cmake .. +$ cmake .. -DJSON_BuildTests=On $ cmake --build . $ ctest --output-on-failure ``` diff --git a/appveyor.yml b/appveyor.yml index 9c380dcd..73788956 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -112,7 +112,7 @@ before_build: # for with_win_header build, inject the inclusion of Windows.h to the single-header library - ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" } - ps: if ($env:name -Eq "with_win_header") { "#include `n" + (Get-Content $header_path | Out-String) | Set-Content $header_path } - - if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin") else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin") + - if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On) else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On) build_script: - cmake --build . --config "%configuration%" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 838cce53..3864923e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -183,6 +183,7 @@ add_dependencies(json_unit download_test_data) ############################################################################# # Test the generated build configs ############################################################################# + add_subdirectory(cmake_import) add_subdirectory(cmake_import_minver) add_subdirectory(cmake_add_subdirectory)