Fix CI issues (#3906)

Co-authored-by: barcode <barcode@example.com>
This commit is contained in:
Raphael Grimm 2023-01-31 19:23:37 +01:00 committed by GitHub
parent da6b908c4f
commit 233d233439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 18 deletions

View File

@ -1,13 +1,8 @@
kind: pipeline arm_container:
name: test-on-arm64 image: gcc:latest
platform: check_task:
arch: arm64 check_script:
steps:
- name: build
image: gcc
commands:
- wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz - wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz
- tar xfz cmake-3.20.2.tar.gz - tar xfz cmake-3.20.2.tar.gz
- cd cmake-3.20.2 - cd cmake-3.20.2

View File

@ -146,6 +146,9 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Get latest CMake and ninja - name: Get latest CMake and ninja
uses: lukka/get-cmake@latest uses: lukka/get-cmake@latest
- name: Set env FORCE_STDCPPFS_FLAG for clang 7 / 8 / 9 / 10
run: echo "JSON_FORCED_GLOBAL_COMPILE_OPTIONS=-DJSON_HAS_FILESYSTEM=0;-DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" >> "$GITHUB_ENV"
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }}
- name: Run CMake - name: Run CMake
run: cmake -S . -B build -DJSON_CI=On run: cmake -S . -B build -DJSON_CI=On
- name: Build - name: Build

View File

@ -1140,7 +1140,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. - 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 [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [Drone CI](https://cloud.drone.io/nlohmann/json), and [GitHub Actions](https://github.com/nlohmann/json/actions): The following compilers are currently used in continuous integration at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [Cirrus CI](https://cirrus-ci.com/github/nlohmann/json), and [GitHub Actions](https://github.com/nlohmann/json/actions):
| Compiler | Operating System | CI Provider | | Compiler | Operating System | CI Provider |
|--------------------------------------------------------------------------------------------------------|--------------------|----------------| |--------------------------------------------------------------------------------------------------------|--------------------|----------------|
@ -1190,7 +1190,7 @@ The following compilers are currently used in continuous integration at [AppVeyo
| GCC 8.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 8.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 9.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 9.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 10.4.0 | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 10.4.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 11.1.0 | Ubuntu (aarch64) | Drone CI | | GCC 11.1.0 | Ubuntu (aarch64) | Cirrus CI |
| GCC 11.3.0 | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 11.3.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 12.2.0 | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 12.2.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 13.0.0 20220605 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 13.0.0 20220605 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions |

View File

@ -901,12 +901,7 @@ add_custom_target(ci_cmake_flags
foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14) foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14)
find_program(COMPILER_TOOL NAMES ${COMPILER}) find_program(COMPILER_TOOL NAMES ${COMPILER})
if (COMPILER_TOOL) if (COMPILER_TOOL)
if ("${COMPILER}" STREQUAL "clang++-9") unset(ADDITIONAL_FLAGS)
# fix for https://github.com/nlohmann/json/pull/3101#issuecomment-998788786 / https://stackoverflow.com/a/64051725/266378
set(ADDITIONAL_FLAGS "-DCMAKE_CXX_FLAGS=--gcc-toolchain=/root/gcc/9")
else()
unset(ADDITIONAL_FLAGS)
endif()
add_custom_target(ci_test_compiler_${COMPILER} add_custom_target(ci_test_compiler_${COMPILER}
COMMAND CXX=${COMPILER} ${CMAKE_COMMAND} COMMAND CXX=${COMPILER} ${CMAKE_COMMAND}

View File

@ -6,6 +6,15 @@ option(JSON_FastTests "Skip expensive/slow tests." OFF)
set(JSON_32bitTest AUTO CACHE STRING "Enable the 32bit unit test (ON/OFF/AUTO/ONLY).") set(JSON_32bitTest AUTO CACHE STRING "Enable the 32bit unit test (ON/OFF/AUTO/ONLY).")
set(JSON_TestStandards "" CACHE STRING "The list of standards to test explicitly.") set(JSON_TestStandards "" CACHE STRING "The list of standards to test explicitly.")
# using an env var, since this will also affect targets executing cmake (such as "ci_test_compiler_default")
set(JSON_FORCED_GLOBAL_COMPILE_OPTIONS $ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS})
if (NOT "" STREQUAL "$ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS}")
add_compile_options($ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS})
endif()
if (NOT "" STREQUAL "$ENV{JSON_FORCED_GLOBAL_LINK_OPTIONS}")
add_link_options($ENV{JSON_FORCED_GLOBAL_LINK_OPTIONS})
endif()
include(test) include(test)
############################################################################# #############################################################################

View File

@ -37,7 +37,9 @@ using ordered_json = nlohmann::ordered_json;
#endif #endif
#ifdef JSON_HAS_CPP_20 #ifdef JSON_HAS_CPP_20
#include <span> #if __has_include(<span>)
#include <span>
#endif
#endif #endif
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair // NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
@ -664,6 +666,7 @@ TEST_CASE("regression tests 2")
} }
#ifdef JSON_HAS_CPP_20 #ifdef JSON_HAS_CPP_20
#if __has_include(<span>)
SECTION("issue #2546 - parsing containers of std::byte") SECTION("issue #2546 - parsing containers of std::byte")
{ {
const char DATA[] = R"("Hello, world!")"; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) const char DATA[] = R"("Hello, world!")"; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
@ -671,6 +674,7 @@ TEST_CASE("regression tests 2")
const json j = json::parse(s); const json j = json::parse(s);
CHECK(j.dump() == "\"Hello, world!\""); CHECK(j.dump() == "\"Hello, world!\"");
} }
#endif
#endif #endif
SECTION("issue #2574 - Deserialization to std::array, std::pair, and std::tuple with non-default constructable types fails") SECTION("issue #2574 - Deserialization to std::array, std::pair, and std::tuple with non-default constructable types fails")