From c9e66df00c20be2177150883b548d9edc4cf9729 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 8 Feb 2021 21:00:37 +0100 Subject: [PATCH] :construction_worker: add CI steps for disabled exceptions and implicit conversions --- .circleci/config.yml | 56 ----------------------------- .github/workflows/ubuntu.yml | 20 +++++++++++ .travis.yml | 68 +----------------------------------- README.md | 4 +-- cmake/ci.cmake | 28 +++++++++++++++ test/src/UBSAN.supp | 1 - 6 files changed, 50 insertions(+), 127 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 test/src/UBSAN.supp diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 82e509840..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2 -jobs: - build_stable: - docker: - - image: debian:stretch - - steps: - - checkout - - - run: - name: Install required tools - command: 'apt-get update && apt-get install -y gcc g++ git cmake' - - run: - name: Run CMake - command: 'mkdir build ; cd build ; cmake .. -DJSON_BuildTests=On' - - run: - name: Compile - command: 'cmake --build build' - - run: - name: Execute test suite - command: 'cd build ; ctest --output-on-failure -j 2' - - build_bleeding_edge: - docker: - - image: archlinux - - steps: - - checkout - - - run: - name: Install required tools - command: 'pacman -Sy --noconfirm base base-devel gcc git cmake' - - run: - name: Run CMake - command: 'mkdir build ; cd build ; cmake .. -DJSON_BuildTests=On' - - run: - name: Compile - command: 'cmake --build build' - - run: - name: Execute test suite - command: 'cd build ; ctest --output-on-failure -j 2' - -workflows: - version: 2 - build_and_test_all: - jobs: - - build_stable: - filters: - branches: - ignore: - gh-pages - - build_bleeding_edge: - filters: - branches: - ignore: - gh-pages diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index f3fcab4bd..10ce098a7 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -108,6 +108,26 @@ jobs: - name: build run: cmake --build build --target ci_clang_tidy + ci_test_noexceptions: + runs-on: ubuntu-latest + container: nlohmann/json-ci:latest + steps: + - uses: actions/checkout@v2 + - name: cmake + run: cmake -S . -B build -DJSON_CI=On + - name: build + run: cmake --build build --target ci_test_noexceptions + + ci_test_noimplicitconversions: + runs-on: ubuntu-latest + container: nlohmann/json-ci:latest + steps: + - uses: actions/checkout@v2 + - name: cmake + run: cmake -S . -B build -DJSON_CI=On + - name: build + run: cmake --build build --target ci_test_noimplicitconversions + ci_test_clang_sanitizer: runs-on: ubuntu-latest container: nlohmann/json-ci:latest diff --git a/.travis.yml b/.travis.yml index f48ee1fd6..eaf45169b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,55 +17,6 @@ group: edge matrix: include: - # Valgrind - - os: linux - compiler: gcc - env: - - COMPILER=g++-4.9 - - CMAKE_OPTIONS=-DJSON_Valgrind=ON - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9', 'valgrind', 'ninja-build'] - - # clang sanitizer - - os: linux - compiler: clang - env: - - COMPILER=clang++-7 - - CMAKE_OPTIONS=-DJSON_Sanitizer=ON - - UBSAN_OPTIONS=print_stacktrace=1,suppressions=$(pwd)/test/src/UBSAN.supp - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-7'] - packages: ['g++-6', 'clang-7', 'ninja-build'] - before_script: - - export PATH=$PATH:/usr/lib/llvm-7/bin - - # cppcheck - - os: linux - compiler: gcc - env: - - COMPILER=g++-4.9 - - SPECIAL=cppcheck - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9', 'cppcheck', 'ninja-build'] - after_success: - - make cppcheck - - # no exceptions - - os: linux - compiler: gcc - env: - - COMPILER=g++-4.9 - - CMAKE_OPTIONS=-DJSON_NoExceptions=ON - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9', 'ninja-build'] - # check amalgamation - os: linux compiler: gcc @@ -133,11 +84,6 @@ matrix: - os: osx osx_image: xcode12 - - os: osx - osx_image: xcode12 - env: - - IMPLICIT_CONVERSIONS=OFF - # Linux / GCC - os: linux @@ -196,16 +142,6 @@ matrix: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-9', 'ninja-build'] - - os: linux - compiler: gcc - env: - - COMPILER=g++-9 - - IMPLICIT_CONVERSIONS=OFF - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9', 'ninja-build'] - - os: linux compiler: gcc env: @@ -318,15 +254,13 @@ script: - if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi # by default, use the single-header version - if [[ "${MULTIPLE_HEADERS}" == "" ]]; then export MULTIPLE_HEADERS=OFF; fi - # by default, use implicit conversions - - if [[ "${IMPLICIT_CONVERSIONS}" == "" ]]; then export IMPLICIT_CONVERSIONS=ON; fi # append CXX_STANDARD to CMAKE_OPTIONS if required - CMAKE_OPTIONS+=${CXX_STANDARD:+ -DCMAKE_CXX_STANDARD=$CXX_STANDARD -DCMAKE_CXX_STANDARD_REQUIRED=ON} # compile and execute unit tests - mkdir -p build && cd build - - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DJSON_ImplicitConversions=${IMPLICIT_CONVERSIONS} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release + - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release - ctest -C Release --timeout 2700 -V -j - cd .. diff --git a/README.md b/README.md index 391d07ede..71bda436c 100644 --- a/README.md +++ b/README.md @@ -1228,7 +1228,7 @@ Please note: - Unsupported versions of GCC and Clang are rejected by `#error` directives. This can be switched off by defining `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`. Note that you can expect no support in this case. -The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/nlohmann/json), [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [GitHub Actions](https://github.com/nlohmann/json/actions), and [CircleCI](https://circleci.com/gh/nlohmann/json): +The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/nlohmann/json), [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), and [GitHub Actions](https://github.com/nlohmann/json/actions): | Compiler | Operating System | CI Provider | |-------------------------------------------------------------------|--------------------|----------------| @@ -1251,14 +1251,12 @@ The following compilers are currently used in continuous integration at [Travis] | GCC 4.8.5 (Ubuntu 4.8.5-4ubuntu8\~14.04.2) | Ubuntu 14.04.5 LTS | Travis | | GCC 4.9.4 (Ubuntu 4.9.4-2ubuntu1\~14.04.1) | Ubuntu 14.04.5 LTS | Travis | | GCC 5.5.0 (Ubuntu 5.5.0-12ubuntu1\~14.04) | Ubuntu 14.04.5 LTS | Travis | -| GCC 6.3.0 (Debian 6.3.0-18+deb9u1) | Debian 9 | Circle CI | | GCC 6.5.0 (Ubuntu 6.5.0-2ubuntu1\~14.04.1) | Ubuntu 14.04.5 LTS | Travis | | GCC 7.3.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) | Windows-6.3.9600 | AppVeyor | | GCC 7.5.0 (Ubuntu 7.5.0-3ubuntu1\~14.04.1) | Ubuntu 14.04.5 LTS | Travis | | GCC 7.5.0 (Ubuntu 7.5.0-3ubuntu1\~18.04) | Ubuntu 18.04.4 LTS | GitHub Actions | | GCC 8.4.0 (Ubuntu 8.4.0-1ubuntu1\~14.04) | Ubuntu 14.04.5 LTS | Travis | | GCC 9.3.0 (Ubuntu 9.3.0-11ubuntu0\~14.04) | Ubuntu 14.04.5 LTS | Travis | -| GCC 10.1.0 (Arch Linux latest) | Arch Linux | Circle CI | | MSVC 19.0.24241.7 (Build Engine version 14.0.25420.1) | Windows-6.3.9600 | AppVeyor | | MSVC 19.16.27035.0 (15.9.21+g9802d43bc3 for .NET Framework) | Windows-10.0.14393 | AppVeyor | | MSVC 19.25.28614.0 (Build Engine version 16.5.0+d4cbfca49 for .NET Framework) | Windows-10.0.17763 | AppVeyor | diff --git a/cmake/ci.cmake b/cmake/ci.cmake index dfad0c22a..84296fd45 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -415,6 +415,34 @@ foreach(CXX_STANDARD 11 14 17 20) ) endforeach() +############################################################################### +# Disable exceptions. +############################################################################### + +add_custom_target(ci_test_noexceptions + COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND} + -DCMAKE_BUILD_TYPE=Debug -GNinja + -DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON -DCMAKE_CXX_FLAGS=-DJSON_NOEXCEPTION -DDOCTEST_TEST_FILTER=--no-throw + -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_noexceptions + COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_noexceptions + COMMAND cd ${PROJECT_BINARY_DIR}/build_noexceptions && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure + COMMENT "Compile and test with with exceptions switched off" +) + +############################################################################### +# Disable implicit conversions. +############################################################################### + +add_custom_target(ci_test_noimplicitconversions + COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND} + -DCMAKE_BUILD_TYPE=Debug -GNinja + -DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON -DJSON_ImplicitConversions=ON + -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_noimplicitconversions + COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_noimplicitconversions + COMMAND cd ${PROJECT_BINARY_DIR}/build_noimplicitconversions && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure + COMMENT "Compile and test with with implicit conversions switched off" +) + ############################################################################### # Coverage. ############################################################################### diff --git a/test/src/UBSAN.supp b/test/src/UBSAN.supp deleted file mode 100644 index b19f04369..000000000 --- a/test/src/UBSAN.supp +++ /dev/null @@ -1 +0,0 @@ -unsigned-integer-overflow:stl_bvector.h