Fix CI (#4871)
* 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 parent
d33ecd3f3b
commit
30d27df61c
11 files changed
+64
-62
No files matched your search
@@ -161,8 +161,6 @@ jobs:
|
|||||||
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', 'latest']
|
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', 'latest']
|
||||||
container: silkeh/clang:${{ matrix.compiler }}
|
container: silkeh/clang:${{ matrix.compiler }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install unzip and git
|
|
||||||
run: apt-get update ; apt-get install -y unzip git
|
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Get latest CMake and ninja
|
- name: Get latest CMake and ninja
|
||||||
uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.02
|
uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.02
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mingw:
|
mingw:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2022
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
architecture: [x64, x86]
|
architecture: [x64, x86]
|
||||||
@@ -40,24 +40,14 @@ jobs:
|
|||||||
msvc:
|
msvc:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
runs_on: [windows-2019, windows-2022]
|
|
||||||
build_type: [Debug, Release]
|
build_type: [Debug, Release]
|
||||||
architecture: [Win32, x64]
|
architecture: [Win32, x64]
|
||||||
std_version: [default, latest]
|
std_version: [default, latest]
|
||||||
|
|
||||||
runs-on: ${{ matrix.runs_on }}
|
runs-on: windows-2022
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Set generator
|
|
||||||
id: generator
|
|
||||||
run: |
|
|
||||||
if [ "${{ matrix.runs_on }}" = "windows-2019" ]; then
|
|
||||||
echo "generator=Visual Studio 16 2019" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "generator=Visual Studio 17 2022" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
- name: Set extra CXX_FLAGS for latest std_version
|
- name: Set extra CXX_FLAGS for latest std_version
|
||||||
id: cxxflags
|
id: cxxflags
|
||||||
run: |
|
run: |
|
||||||
@@ -68,11 +58,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: Run CMake (Release)
|
- name: Run CMake (Release)
|
||||||
run: cmake -S . -B build -G "$env:generator" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="$env:flags"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="$env:flags"
|
||||||
if: matrix.build_type == 'Release'
|
if: matrix.build_type == 'Release'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- name: Run CMake (Debug)
|
- name: Run CMake (Debug)
|
||||||
run: cmake -S . -B build -G "$env:generator" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="$env:flags"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="$env:flags"
|
||||||
if: matrix.build_type == 'Debug'
|
if: matrix.build_type == 'Debug'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -80,34 +70,34 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
||||||
|
|
||||||
clang:
|
# clang:
|
||||||
runs-on: windows-2019
|
# runs-on: windows-2025
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
version: [11, 12, 13, 14, 15]
|
# version: [11, 12, 13, 14, 15]
|
||||||
|
#
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Install Clang
|
# - name: Install Clang
|
||||||
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
# run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
||||||
- name: Run CMake
|
# - name: Run CMake
|
||||||
run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
# run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
||||||
- name: Build
|
# - name: Build
|
||||||
run: cmake --build build --parallel 10
|
# run: cmake --build build --parallel 10
|
||||||
- name: Test
|
# - name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
# run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
||||||
|
#
|
||||||
clang-cl-12:
|
# clang-cl-12:
|
||||||
runs-on: windows-2019
|
# runs-on: windows-2025
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
architecture: [Win32, x64]
|
# architecture: [Win32, x64]
|
||||||
|
#
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Run CMake
|
# - name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
# run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
||||||
- name: Build
|
# - name: Build
|
||||||
run: cmake --build build --config Debug --parallel 10
|
# run: cmake --build build --config Debug --parallel 10
|
||||||
- name: Test
|
# - name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
# run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
# -Wno-padded We do not care about padding warnings.
|
# -Wno-padded We do not care about padding warnings.
|
||||||
# -Wno-covered-switch-default All switches list all cases and a default case.
|
# -Wno-covered-switch-default All switches list all cases and a default case.
|
||||||
# -Wno-unsafe-buffer-usage Otherwise Doctest would not compile.
|
# -Wno-unsafe-buffer-usage Otherwise Doctest would not compile.
|
||||||
|
# -Wno-missing-noreturn We found no way to silence this warning otherwise, see PR #4871
|
||||||
|
|
||||||
set(CLANG_CXXFLAGS
|
set(CLANG_CXXFLAGS
|
||||||
-Werror
|
-Werror
|
||||||
@@ -17,4 +18,5 @@ set(CLANG_CXXFLAGS
|
|||||||
-Wno-padded
|
-Wno-padded
|
||||||
-Wno-covered-switch-default
|
-Wno-covered-switch-default
|
||||||
-Wno-unsafe-buffer-usage
|
-Wno-unsafe-buffer-usage
|
||||||
|
-Wno-missing-noreturn
|
||||||
)
|
)
|
||||||
@@ -1,21 +1,33 @@
|
|||||||
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
|
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
|
||||||
set(JSON_TEST_DATA_VERSION 3.1.0)
|
set(JSON_TEST_DATA_VERSION 3.1.0)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
# if variable is set, use test data from given directory rather than downloading them
|
# if variable is set, use test data from given directory rather than downloading them
|
||||||
if(JSON_TestDataDirectory)
|
if(JSON_TestDataDirectory)
|
||||||
message(STATUS "Using test data in ${JSON_TestDataDirectory}.")
|
message(STATUS "Using test data in ${JSON_TestDataDirectory}.")
|
||||||
add_custom_target(download_test_data)
|
add_custom_target(download_test_data)
|
||||||
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n")
|
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n")
|
||||||
else()
|
else()
|
||||||
find_package(Git)
|
# create a header with the path to the downloaded test data
|
||||||
|
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/test_files\"\n")
|
||||||
|
|
||||||
|
# download test data from GitHub release
|
||||||
|
ExternalProject_Add(download_test_data_project
|
||||||
|
URL "${JSON_TEST_DATA_URL}/archive/refs/tags/v${JSON_TEST_DATA_VERSION}.zip"
|
||||||
|
SOURCE_DIR "${CMAKE_BINARY_DIR}/test_files"
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
LOG_DOWNLOAD TRUE
|
||||||
|
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||||
|
EXCLUDE_FROM_ALL TRUE
|
||||||
|
)
|
||||||
|
|
||||||
# target to download test data
|
# target to download test data
|
||||||
add_custom_target(download_test_data
|
add_custom_target(download_test_data
|
||||||
COMMAND test -d json_test_data || ${GIT_EXECUTABLE} clone -c advice.detachedHead=false --branch v${JSON_TEST_DATA_VERSION} ${JSON_TEST_DATA_URL}.git --quiet --depth 1
|
DEPENDS download_test_data_project
|
||||||
COMMENT "Downloading test data from ${JSON_TEST_DATA_URL} (v${JSON_TEST_DATA_VERSION})"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
||||||
)
|
)
|
||||||
# create a header with the path to the downloaded test data
|
|
||||||
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/json_test_data\"\n")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# determine the operating system (for debug and support purposes)
|
# determine the operating system (for debug and support purposes)
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ template<typename T>
|
|||||||
struct is_iterator_of_multibyte
|
struct is_iterator_of_multibyte
|
||||||
{
|
{
|
||||||
using value_type = typename std::iterator_traits<T>::value_type;
|
using value_type = typename std::iterator_traits<T>::value_type;
|
||||||
enum
|
enum // NOLINT(cppcoreguidelines-use-enum-class)
|
||||||
{
|
{
|
||||||
value = sizeof(value_type) > 1
|
value = sizeof(value_type) > 1
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ struct is_ordered_map
|
|||||||
template <typename C> static one test( decltype(&C::capacity) ) ;
|
template <typename C> static one test( decltype(&C::capacity) ) ;
|
||||||
template <typename C> static two test(...);
|
template <typename C> static two test(...);
|
||||||
|
|
||||||
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-use-enum-class)
|
||||||
};
|
};
|
||||||
|
|
||||||
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
|
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
|
||||||
|
|||||||
@@ -4198,7 +4198,7 @@ struct is_ordered_map
|
|||||||
template <typename C> static one test( decltype(&C::capacity) ) ;
|
template <typename C> static one test( decltype(&C::capacity) ) ;
|
||||||
template <typename C> static two test(...);
|
template <typename C> static two test(...);
|
||||||
|
|
||||||
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-use-enum-class)
|
||||||
};
|
};
|
||||||
|
|
||||||
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
|
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
|
||||||
@@ -6895,7 +6895,7 @@ template<typename T>
|
|||||||
struct is_iterator_of_multibyte
|
struct is_iterator_of_multibyte
|
||||||
{
|
{
|
||||||
using value_type = typename std::iterator_traits<T>::value_type;
|
using value_type = typename std::iterator_traits<T>::value_type;
|
||||||
enum
|
enum // NOLINT(cppcoreguidelines-use-enum-class)
|
||||||
{
|
{
|
||||||
value = sizeof(value_type) > 1
|
value = sizeof(value_type) > 1
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1352,7 +1352,7 @@ TEST_CASE("value conversion")
|
|||||||
#ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION
|
#ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION
|
||||||
SECTION("get an enum")
|
SECTION("get an enum")
|
||||||
{
|
{
|
||||||
enum c_enum { value_1, value_2 };
|
enum c_enum { value_1, value_2 }; // NOLINT(cppcoreguidelines-use-enum-class)
|
||||||
enum class cpp_enum { value_1, value_2 };
|
enum class cpp_enum { value_1, value_2 };
|
||||||
|
|
||||||
CHECK(json(value_1).get<c_enum>() == value_1);
|
CHECK(json(value_1).get<c_enum>() == value_1);
|
||||||
@@ -1601,7 +1601,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(cards,
|
|||||||
{cards::karo, "karo"}
|
{cards::karo, "karo"}
|
||||||
})
|
})
|
||||||
|
|
||||||
enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value)
|
enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value,cppcoreguidelines-use-enum-class)
|
||||||
{
|
{
|
||||||
TS_STOPPED,
|
TS_STOPPED,
|
||||||
TS_RUNNING,
|
TS_RUNNING,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ using nlohmann::json;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum test {};
|
enum test {}; // NOLINT(cppcoreguidelines-use-enum-class)
|
||||||
|
|
||||||
struct pod {};
|
struct pod {};
|
||||||
struct pod_bis {};
|
struct pod_bis {};
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ TEST_CASE("regression tests 1")
|
|||||||
#ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION
|
#ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION
|
||||||
SECTION("pull request #71 - handle enum type")
|
SECTION("pull request #71 - handle enum type")
|
||||||
{
|
{
|
||||||
enum { t = 0, u = 102};
|
enum { t = 0, u = 102}; // NOLINT(cppcoreguidelines-use-enum-class)
|
||||||
json j = json::array();
|
json j = json::array();
|
||||||
j.push_back(t);
|
j.push_back(t);
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ struct for_3204_foo
|
|||||||
|
|
||||||
struct for_3204_bar
|
struct for_3204_bar
|
||||||
{
|
{
|
||||||
enum constructed_from_t
|
enum constructed_from_t // NOLINT(cppcoreguidelines-use-enum-class)
|
||||||
{
|
{
|
||||||
constructed_from_none = 0,
|
constructed_from_none = 0,
|
||||||
constructed_from_foo = 1,
|
constructed_from_foo = 1,
|
||||||
|
|||||||
Reference in new issue
Block a user