From 0a88724d90a2c68bfe70c6eacde9ec1b9230c680 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Sat, 30 Dec 2023 20:59:37 +0900 Subject: [PATCH 01/28] change github action ubuntu version 18.04 -> latest --- .github/workflows/code-cov.yml | 84 +++++++++++------------ .github/workflows/linux.yml | 121 ++++++++++++++++----------------- 2 files changed, 102 insertions(+), 103 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 06d7ddc..80c6a37 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -3,49 +3,49 @@ name: CodeCov on: [pull_request] jobs: - ubuntu-bionic-llvm-code-cov: - runs-on: ubuntu-18.04 + ubuntu-llvm-code-cov: + runs-on: ubuntu-latest env: - CMAKE_FLAGS: '-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON' + CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" strategy: matrix: - build-type: ['Debug'] - clang-version: ['8'] + build-type: ["Debug"] + clang-version: ["8"] steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting - run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${{matrix.clang-version}} main" - sudo apt-get update - sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake - sudo apt-get install -yq libllvm${{matrix.clang-version}} llvm-${{matrix.clang-version}} llvm-${{matrix.clang-version}}-dev llvm-${{matrix.clang-version}}-runtime - - name: Compiler Setting - run: | - echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV - - name: Clone Repository - uses: actions/checkout@master - with: - submodules: true - - name: CMake build - run: | - cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Generate Coverage Report - run: | - cd build/${{matrix.build-type}} - ./unittest - llvm-profdata-${{matrix.clang-version}} merge -sparse default.profraw -o default.profdata - llvm-cov-${{matrix.clang-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - directory: ./build/${{matrix.build-type}} - files: lcov.info - flags: unittest - fail_ci_if_error: true - verbose: true + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + - name: C++ Setting + run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo add-apt-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${{matrix.clang-version}} main" + sudo apt-get update + sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake + sudo apt-get install -yq libllvm${{matrix.clang-version}} llvm-${{matrix.clang-version}} llvm-${{matrix.clang-version}}-dev llvm-${{matrix.clang-version}}-runtime + - name: Compiler Setting + run: | + echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV + echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV + - name: Clone Repository + uses: actions/checkout@master + with: + submodules: true + - name: CMake build + run: | + cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . + cd build + cmake --build . --config ${{matrix.build-type}} + - name: Generate Coverage Report + run: | + cd build/${{matrix.build-type}} + ./unittest + llvm-profdata-${{matrix.clang-version}} merge -sparse default.profraw -o default.profdata + llvm-cov-${{matrix.clang-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + directory: ./build/${{matrix.build-type}} + files: lcov.info + flags: unittest + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index eeaeecf..903512a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -3,73 +3,72 @@ name: Linux on: [pull_request] jobs: - ubuntu-bionic-gcc: - runs-on: ubuntu-18.04 + ubuntu-gcc: + runs-on: ubuntu-latest env: - CMAKE_FLAGS: '-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON' + CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" strategy: matrix: - build-type: ['Release', 'Debug'] - gcc-version: ['11'] + build-type: ["Release", "Debug"] + gcc-version: ["11"] steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting - run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -yq g++-${{matrix.gcc-version}} gcc-${{matrix.gcc-version}} libc++-dev libc++abi-dev build-essential libstdc++-${{matrix.gcc-version}}-dev cmake - - name: Compiler Setting - run: | - echo "CC=gcc-${{matrix.gcc-version}}" >> $GITHUB_ENV - echo "CXX=g++-${{matrix.gcc-version}}" >> $GITHUB_ENV - - name: Clone Repository - uses: actions/checkout@master - with: - submodules: true - - name: CMake build - run: | - cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Run Test Script - run: | - cd build - ctest . + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + - name: C++ Setting + run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -yq g++-${{matrix.gcc-version}} gcc-${{matrix.gcc-version}} libc++-dev libc++abi-dev build-essential libstdc++-${{matrix.gcc-version}}-dev cmake + - name: Compiler Setting + run: | + echo "CC=gcc-${{matrix.gcc-version}}" >> $GITHUB_ENV + echo "CXX=g++-${{matrix.gcc-version}}" >> $GITHUB_ENV + - name: Clone Repository + uses: actions/checkout@master + with: + submodules: true + - name: CMake build + run: | + cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . + cd build + cmake --build . --config ${{matrix.build-type}} + - name: Run Test Script + run: | + cd build + ctest . - ubuntu-bionic-llvm: - runs-on: ubuntu-18.04 + ubuntu-llvm: + runs-on: ubuntu-latest env: - CMAKE_FLAGS: '-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON' + CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" strategy: matrix: - build-type: ['Release', 'Debug'] - clang-version: ['8'] + build-type: ["Release", "Debug"] + clang-version: ["8"] steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting - run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${{matrix.clang-version}} main" - sudo apt-get update - sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake - - name: Compiler Setting - run: | - echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV - - name: Clone Repository - uses: actions/checkout@master - with: - submodules: true - - name: CMake build - run: | - cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Run Test Script - run: | - cd build - ctest . - + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + - name: C++ Setting + run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo add-apt-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${{matrix.clang-version}} main" + sudo apt-get update + sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake + - name: Compiler Setting + run: | + echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV + echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV + - name: Clone Repository + uses: actions/checkout@master + with: + submodules: true + - name: CMake build + run: | + cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . + cd build + cmake --build . --config ${{matrix.build-type}} + - name: Run Test Script + run: | + cd build + ctest . From bd02d0bc7cc9ab8d6f2b466b75a3af7dae0e3f14 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Sat, 30 Dec 2023 21:23:44 +0900 Subject: [PATCH 02/28] update catch2 2.9.1 -> 3.5.0 --- CMakeLists.txt | 2 +- cppm.toml | 2 +- thirdparty/Catch2/3.5.0/Catch2.cmake.in | 8 ++++++++ thirdparty/Catch2/3.5.0/cppkg.toml | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 thirdparty/Catch2/3.5.0/Catch2.cmake.in create mode 100644 thirdparty/Catch2/3.5.0/cppkg.toml diff --git a/CMakeLists.txt b/CMakeLists.txt index 98d9944..d75fb33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cppm_compiler_option( find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF) find_cppkg(RapidJSON 1.1.1 MODULE rapidjson TYPE lib OPTIONAL OFF) find_cppkg(nlohmann_json 3.10.5 MODULE nlohmann_json::nlohmann_json TYPE lib OPTIONAL OFF) -find_cppkg(Catch2 2.9.1 MODULE Catch2::Catch2 TYPE lib OPTIONAL OFF) +find_cppkg(Catch2 3.5.0 MODULE Catch2::Catch2 TYPE lib OPTIONAL OFF) find_cppkg(toml11 3.7.0 MODULE toml11::toml11 TYPE lib OPTIONAL OFF) find_cppkg(yaml-cpp 0.7.0 MODULE yaml-cpp TYPE lib OPTIONAL OFF) find_cppkg(fmt 8.0.1 MODULE fmt::fmt-header-only TYPE lib OPTIONAL OFF) diff --git a/cppm.toml b/cppm.toml index c47716b..167eca1 100644 --- a/cppm.toml +++ b/cppm.toml @@ -98,7 +98,7 @@ source = ["tests/.*"] nlohmann_json = { version="3.10.5", link="public", optional=true} RapidJSON = { version="1.1.1", link="public", optional=true} benchmark = { version="1.5.2", optional=true} - Catch2 = {version="2.9.1", optional=true} + Catch2 = {version="3.5.0", optional=true} #pybind11 = "2.9.0" #hiredis = "git" #"redis++" = "1.3.2" diff --git a/thirdparty/Catch2/3.5.0/Catch2.cmake.in b/thirdparty/Catch2/3.5.0/Catch2.cmake.in new file mode 100644 index 0000000..0da910d --- /dev/null +++ b/thirdparty/Catch2/3.5.0/Catch2.cmake.in @@ -0,0 +1,8 @@ +# Cppkg Base Dependency Downloader +cmake_minimum_required(VERSION 3.6) +project(Catch2-3.5.0-install) + +set(CPPM_VERSION ${CPPM_VERSION}) +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake) +download_package(Catch2 3.5.0 URL https://github.com/catchorg/Catch2/archive/refs/tags/v3.5.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DCATCH_BUILD_TESTING=OFF) + diff --git a/thirdparty/Catch2/3.5.0/cppkg.toml b/thirdparty/Catch2/3.5.0/cppkg.toml new file mode 100644 index 0000000..31530f9 --- /dev/null +++ b/thirdparty/Catch2/3.5.0/cppkg.toml @@ -0,0 +1,6 @@ +[Catch2] +version = "3.5.0" +description = "modern, C++-native, header-only, test framework for unit-tests" +module = "Catch2::Catch2" +url="https://github.com/catchorg/Catch2/archive/refs/tags/v3.5.0.tar.gz" +flags="-DCATCH_BUILD_TESTING=OFF" \ No newline at end of file From df400d6ad1847a6fb813ed9fda15105fb31a1dfa Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Sun, 31 Dec 2023 13:24:37 +0900 Subject: [PATCH 03/28] fix catch2 include error --- tests/catch_main.cpp | 6 ++---- tests/nlohmann_json.cpp | 10 +++------- tests/rapid_json.cpp | 23 ++++++++++++----------- tests/reflection.cpp | 17 ++++++----------- tests/test_struct.hpp | 26 +++++++++++++------------- tests/toml11.cpp | 4 ++-- tests/yaml_cpp.cpp | 13 ++++++------- 7 files changed, 44 insertions(+), 55 deletions(-) diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index b955482..5b07e14 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -1,7 +1,5 @@ #define CATCH_CONFIG_MAIN -#include +#include -TEST_CASE("1: test (pass)", "[multi-file:1]") { - REQUIRE(1==1); -} +TEST_CASE("1: test (pass)", "[multi-file:1]") { REQUIRE(1 == 1); } diff --git a/tests/nlohmann_json.cpp b/tests/nlohmann_json.cpp index 5d6d722..b78f01a 100644 --- a/tests/nlohmann_json.cpp +++ b/tests/nlohmann_json.cpp @@ -1,9 +1,7 @@ - -#include #include "test_struct.hpp" +#include #include - nlohmann::json json_v = R"({ "str" : "hello", "i": 10, @@ -16,8 +14,6 @@ nlohmann::json json_v = R"({ using namespace serde; TEST_CASE("2: nlohmann json struct (pass)", "[multi-file:2]") { - REQUIRE(json_v.dump() == serialize(deserialize(json_v)).dump()); + REQUIRE(json_v.dump() == + serialize(deserialize(json_v)).dump()); } - - - diff --git a/tests/rapid_json.cpp b/tests/rapid_json.cpp index 0998101..187b4a8 100644 --- a/tests/rapid_json.cpp +++ b/tests/rapid_json.cpp @@ -1,20 +1,20 @@ -#include #include "test_struct.hpp" +#include #include -std::string str(rapidjson::Document& doc) { - using namespace rapidjson; - StringBuffer buffer; - Writer writer(buffer); - doc.Accept(writer); - return buffer.GetString(); +std::string str(rapidjson::Document &doc) { + using namespace rapidjson; + StringBuffer buffer; + Writer writer(buffer); + doc.Accept(writer); + return buffer.GetString(); }; using namespace serde; TEST_CASE("5: toml11 struct (pass)", "[multi-file:5]") { - rapidjson::Document json_v; - json_v.Parse(R"({ + rapidjson::Document json_v; + json_v.Parse(R"({ "str" : "hello", "i": 10, "vec": [ "one", "two", "three"], @@ -22,7 +22,8 @@ TEST_CASE("5: toml11 struct (pass)", "[multi-file:5]") { "sm": { "one" : "tone", "two" : "ttwo"}, "sub" : { "str": "hello" } })"); - rapidjson::Document json_c = serialize(deserialize(json_v)); + rapidjson::Document json_c = + serialize(deserialize(json_v)); - REQUIRE(str(json_v) == str(json_c)); + REQUIRE(str(json_v) == str(json_c)); } diff --git a/tests/reflection.cpp b/tests/reflection.cpp index f8caee8..e7e336e 100644 --- a/tests/reflection.cpp +++ b/tests/reflection.cpp @@ -1,18 +1,13 @@ -#include #include "test_struct.hpp" +#include #include using namespace serde; TEST_CASE("3: reflection struct (pass)", "[multi-file:3]") { - REQUIRE(std::is_same_v, - std::tuple, - std::optional, - std::optional, - std::map, - nested>>); + REQUIRE(std::is_same_v< + to_tuple_t, + std::tuple, + std::optional, std::optional, + std::map, nested>>); } - - diff --git a/tests/test_struct.hpp b/tests/test_struct.hpp index 6945b1a..762c6e0 100644 --- a/tests/test_struct.hpp +++ b/tests/test_struct.hpp @@ -1,25 +1,25 @@ -#include - #pragma once #ifndef __CATCH_TEST_STRUCT_HPP__ #define __CATCH_TEST_STRUCT_HPP__ +#include + struct nested { - DERIVE_SERDE(nested, _SF_(str)) - std::string str; + DERIVE_SERDE(nested, _SF_(str)) + std::string str; }; struct test { - DERIVE_SERDE(test, _SF_(str)_SF_(i)_SF_(vec)_SF_(opt)_SF_(none_opt)_SF_(sm)_SF_(sub)) - std::string str; - int i; - std::vector vec; - std::optional none_opt; - std::optional opt; - std::map sm; - nested sub; + DERIVE_SERDE(test, _SF_(str) _SF_(i) _SF_(vec) _SF_(opt) _SF_(none_opt) + _SF_(sm) _SF_(sub)) + std::string str; + int i; + std::vector vec; + std::optional none_opt; + std::optional opt; + std::map sm; + nested sub; }; #endif - diff --git a/tests/toml11.cpp b/tests/toml11.cpp index acc0f9a..0827f05 100644 --- a/tests/toml11.cpp +++ b/tests/toml11.cpp @@ -1,5 +1,5 @@ -#include #include "test_struct.hpp" +#include #include using namespace serde; @@ -21,5 +21,5 @@ str = "hello" )"_toml; TEST_CASE("4: toml11 struct (pass)", "[multi-file:4]") { - REQUIRE(toml_vl == serialize(deserialize(toml_vl))); + REQUIRE(toml_vl == serialize(deserialize(toml_vl))); } diff --git a/tests/yaml_cpp.cpp b/tests/yaml_cpp.cpp index 3772205..cf76dbd 100644 --- a/tests/yaml_cpp.cpp +++ b/tests/yaml_cpp.cpp @@ -1,8 +1,7 @@ -#include #include "test_struct.hpp" +#include #include - YAML::Node yaml_v = YAML::Load(R"( str: hello i: 10 @@ -21,10 +20,10 @@ opt: hello using namespace serde; TEST_CASE("5: yaml-cpp struct (pass)", "[multi-file:5]") { - std::ostringstream origin; - origin << yaml_v; - std::ostringstream convert; - convert << serialize(deserialize(yaml_v)); + std::ostringstream origin; + origin << yaml_v; + std::ostringstream convert; + convert << serialize(deserialize(yaml_v)); - REQUIRE(origin.str() == convert.str()); + REQUIRE(origin.str() == convert.str()); } From 37296e0b2de4fe3354bde3c77b834d070fdf8345 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Sun, 31 Dec 2023 13:28:22 +0900 Subject: [PATCH 04/28] change github action llvm install script --- .github/workflows/code-cov.yml | 13 +++++++------ .github/workflows/linux.yml | 12 +++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 80c6a37..f15ccfa 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -14,14 +14,15 @@ jobs: steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting + - name: Basic Setting run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${{matrix.clang-version}} main" sudo apt-get update - sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake - sudo apt-get install -yq libllvm${{matrix.clang-version}} llvm-${{matrix.clang-version}} llvm-${{matrix.clang-version}}-dev llvm-${{matrix.clang-version}}-runtime + sudo apt-get install -yq build-essential cmake + - name: Install LLVM + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh ${{matrix.clang-version}} - name: Compiler Setting run: | echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 903512a..ce24aa6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -48,13 +48,15 @@ jobs: steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting + - name: Basic Setting run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${{matrix.clang-version}} main" sudo apt-get update - sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake + sudo apt-get install -yq build-essential cmake + - name: Install LLVM + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh ${{matrix.clang-version}} - name: Compiler Setting run: | echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV From d70219d05b64d24bf6b46544d47d005fcdca3f94 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Sun, 31 Dec 2023 13:31:11 +0900 Subject: [PATCH 05/28] change minimum llvm version 8 -> 9 --- .github/workflows/code-cov.yml | 12 ++++++------ .github/workflows/linux.yml | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index f15ccfa..40d3a13 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: build-type: ["Debug"] - clang-version: ["8"] + llvm-version: ["9"] steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 @@ -22,11 +22,11 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x ./llvm.sh - sudo ./llvm.sh ${{matrix.clang-version}} + sudo ./llvm.sh ${{matrix.llvm-version}} - name: Compiler Setting run: | - echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV + echo "CC=clang-${{matrix.llvm-version}}" >> $GITHUB_ENV + echo "CXX=clang++-${{matrix.llvm-version}}" >> $GITHUB_ENV - name: Clone Repository uses: actions/checkout@master with: @@ -40,8 +40,8 @@ jobs: run: | cd build/${{matrix.build-type}} ./unittest - llvm-profdata-${{matrix.clang-version}} merge -sparse default.profraw -o default.profdata - llvm-cov-${{matrix.clang-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info + llvm-profdata-${{matrix.llvm-version}} merge -sparse default.profraw -o default.profdata + llvm-cov-${{matrix.llvm-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ce24aa6..037b3cb 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -44,7 +44,7 @@ jobs: strategy: matrix: build-type: ["Release", "Debug"] - clang-version: ["8"] + llvm-version: ["9"] steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 @@ -56,11 +56,11 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x ./llvm.sh - sudo ./llvm.sh ${{matrix.clang-version}} + sudo ./llvm.sh ${{matrix.llvm-version}} - name: Compiler Setting run: | - echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV + echo "CC=clang-${{matrix.llvm-version}}" >> $GITHUB_ENV + echo "CXX=clang++-${{matrix.llvm-version}}" >> $GITHUB_ENV - name: Clone Repository uses: actions/checkout@master with: From 8ed8a65915215695d2d44fccf0f7582ebe2687af Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Sun, 31 Dec 2023 20:10:06 +0900 Subject: [PATCH 06/28] yaml-cpp version bugfix --- CMakeLists.txt | 2 +- thirdparty/yaml-cpp/0.7.0/yaml-cpp.cmake.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d75fb33..dba42c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ find_cppkg(RapidJSON 1.1.1 MODULE rapidjson TYPE lib OPTIONAL OFF) find_cppkg(nlohmann_json 3.10.5 MODULE nlohmann_json::nlohmann_json TYPE lib OPTIONAL OFF) find_cppkg(Catch2 3.5.0 MODULE Catch2::Catch2 TYPE lib OPTIONAL OFF) find_cppkg(toml11 3.7.0 MODULE toml11::toml11 TYPE lib OPTIONAL OFF) -find_cppkg(yaml-cpp 0.7.0 MODULE yaml-cpp TYPE lib OPTIONAL OFF) +find_cppkg(yaml-cpp 0.6.3 MODULE yaml-cpp TYPE lib OPTIONAL OFF) find_cppkg(fmt 8.0.1 MODULE fmt::fmt-header-only TYPE lib OPTIONAL OFF) find_cppkg(magic_enum 0.7.3 MODULE magic_enum::magic_enum TYPE lib) find_cppkg(nameof 0.10.0 MODULE nameof::nameof TYPE lib) diff --git a/thirdparty/yaml-cpp/0.7.0/yaml-cpp.cmake.in b/thirdparty/yaml-cpp/0.7.0/yaml-cpp.cmake.in index 35946fd..27eeb4b 100644 --- a/thirdparty/yaml-cpp/0.7.0/yaml-cpp.cmake.in +++ b/thirdparty/yaml-cpp/0.7.0/yaml-cpp.cmake.in @@ -1,8 +1,8 @@ # Cppkg Base Dependency Downloader cmake_minimum_required(VERSION 3.6) -project(yaml-cpp-0.6.3-install) +project(yaml-cpp-0.7.0-install) set(CPPM_VERSION ${CPPM_VERSION}) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake) -download_package(yaml-cpp 0.6.3 URL https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.3.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DYAML_CPP_BUILD_TESTS=OFF) +download_package(yaml-cpp 0.7.0 URL https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.7.0.zip TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DYAML_CPP_BUILD_TESTS=OFF) From cfdd19fe66ade6498f0d873a02d97c10b988d9e2 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 01:39:01 +0900 Subject: [PATCH 07/28] change catch2 module name Catch2::Catch2 -> Catch2::Catch2WithMain --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dba42c1..8519cd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cppm_compiler_option( find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF) find_cppkg(RapidJSON 1.1.1 MODULE rapidjson TYPE lib OPTIONAL OFF) find_cppkg(nlohmann_json 3.10.5 MODULE nlohmann_json::nlohmann_json TYPE lib OPTIONAL OFF) -find_cppkg(Catch2 3.5.0 MODULE Catch2::Catch2 TYPE lib OPTIONAL OFF) +find_cppkg(Catch2 3.5.0 MODULE Catch2::Catch2WithMain TYPE lib OPTIONAL OFF) find_cppkg(toml11 3.7.0 MODULE toml11::toml11 TYPE lib OPTIONAL OFF) find_cppkg(yaml-cpp 0.6.3 MODULE yaml-cpp TYPE lib OPTIONAL OFF) find_cppkg(fmt 8.0.1 MODULE fmt::fmt-header-only TYPE lib OPTIONAL OFF) @@ -94,7 +94,6 @@ if(SERDEPP_BUILD_TESTING) cppm_target_define(unittest BINARY SOURCES tests/rapid_json.cpp - tests/catch_main.cpp tests/yaml_cpp.cpp tests/toml11.cpp tests/reflection.cpp From 8c0c27fd50a85dabef19c2f6b11cc88be4014636 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 03:41:46 +0900 Subject: [PATCH 08/28] update github action --- .github/workflows/code-cov.yml | 17 ++++++----- .github/workflows/linux.yml | 22 +++++++------- .github/workflows/macos.yml | 55 ++++++++++++++++++---------------- .github/workflows/window.yml | 36 ++++++++++++---------- 4 files changed, 69 insertions(+), 61 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 40d3a13..0915236 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -1,6 +1,10 @@ name: CodeCov -on: [pull_request] +on: + push: + branches: + - main + pull_request: jobs: ubuntu-llvm-code-cov: @@ -14,15 +18,12 @@ jobs: steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 - - name: Basic Setting + - name: C++ Setting run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - sudo apt-get install -yq build-essential cmake - - name: Install LLVM - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x ./llvm.sh - sudo ./llvm.sh ${{matrix.llvm-version}} + sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake + sudo apt-get install -yq libllvm${{matrix.clang-version}} llvm-${{matrix.clang-version}} llvm-${{matrix.clang-version}}-dev llvm-${{matrix.clang-version}}-runtime - name: Compiler Setting run: | echo "CC=clang-${{matrix.llvm-version}}" >> $GITHUB_ENV diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 037b3cb..a73c876 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,6 +1,10 @@ name: Linux -on: [pull_request] +on: + push: + branches: + - main + pull_request: jobs: ubuntu-gcc: @@ -44,23 +48,19 @@ jobs: strategy: matrix: build-type: ["Release", "Debug"] - llvm-version: ["9"] + clang-version: ["13", "14", "15"] steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 - - name: Basic Setting + - name: C++ Setting run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - sudo apt-get install -yq build-essential cmake - - name: Install LLVM - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x ./llvm.sh - sudo ./llvm.sh ${{matrix.llvm-version}} + sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake - name: Compiler Setting run: | - echo "CC=clang-${{matrix.llvm-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.llvm-version}}" >> $GITHUB_ENV + echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV + echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV - name: Clone Repository uses: actions/checkout@master with: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index ba2766a..21a8c1e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,36 +1,39 @@ name: MacOS -on: [pull_request] +on: + push: + branches: + - main + pull_request: jobs: macos-clang: runs-on: macos-latest env: - CMAKE_FLAGS: '-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON' + CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" strategy: matrix: - build-type: ['Release', 'Debug'] + build-type: ["Release", "Debug"] steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - - name: Clone Repository - uses: actions/checkout@master - with: - submodules: true - - name: C++ Setting - run: | - brew install llvm cmake - - name: Compiler Setting - run: | - echo "CC=/usr/local/opt/llvm/bin/clang" >> $GITHUB_ENV - echo "CXX=/usr/local/opt/llvm/bin/clang++" >> $GITHUB_ENV - - name: CMake build - run: | - cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Run Test Script - run: | - cd build - ctest . - + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + - name: Clone Repository + uses: actions/checkout@master + with: + submodules: true + - name: C++ Setting + run: | + brew install llvm cmake + - name: Compiler Setting + run: | + echo "CC=/usr/local/opt/llvm/bin/clang" >> $GITHUB_ENV + echo "CXX=/usr/local/opt/llvm/bin/clang++" >> $GITHUB_ENV + - name: CMake build + run: | + cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . + cd build + cmake --build . --config ${{matrix.build-type}} + - name: Run Test Script + run: | + cd build + ctest . diff --git a/.github/workflows/window.yml b/.github/workflows/window.yml index 536e618..0bffb85 100644 --- a/.github/workflows/window.yml +++ b/.github/workflows/window.yml @@ -1,26 +1,30 @@ name: Windows -on: [pull_request] +on: + push: + branches: + - main + pull_request: jobs: windows-msvc: runs-on: windows-2019 env: - CMAKE_FLAGS: '-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON' + CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_BUILD_EXAMPLES=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" strategy: matrix: - build-type: ['Release', 'Debug'] + build-type: ["Release", "Debug"] steps: - - name: Clone Repository - uses: actions/checkout@master - with: - submodules: true - - name: CMake build - run: | - cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}}. - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Run Test Script - run: | - cd build - ctest . + - name: Clone Repository + uses: actions/checkout@master + with: + submodules: true + - name: CMake build + run: | + cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}}. + cd build + cmake --build . --config ${{matrix.build-type}} + - name: Run Test Script + run: | + cd build + ctest . From c52192b6e617df4aa227eb470d3dcd9a7773527f Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 03:55:56 +0900 Subject: [PATCH 09/28] change linux ci --- .github/workflows/linux.yml | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a73c876..47ba4ed 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,21 +14,14 @@ jobs: strategy: matrix: build-type: ["Release", "Debug"] - gcc-version: ["11"] + gcc-version: ["11", "12", "latest"] + container: gcc:${{ matrix.gcc-version }} steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting - run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -yq g++-${{matrix.gcc-version}} gcc-${{matrix.gcc-version}} libc++-dev libc++abi-dev build-essential libstdc++-${{matrix.gcc-version}}-dev cmake - - name: Compiler Setting - run: | - echo "CC=gcc-${{matrix.gcc-version}}" >> $GITHUB_ENV - echo "CXX=g++-${{matrix.gcc-version}}" >> $GITHUB_ENV - - name: Clone Repository - uses: actions/checkout@master + - name: Get latest CMake and ninja + uses: lukka/get-cmake@v3.27.7 + - uses: actions/checkout@v3 with: submodules: true - name: CMake build @@ -48,21 +41,16 @@ jobs: strategy: matrix: build-type: ["Release", "Debug"] - clang-version: ["13", "14", "15"] + clang-version: + ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] + container: silkeh/clang:${{ matrix.compiler }} steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting - run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake - - name: Compiler Setting - run: | - echo "CC=clang-${{matrix.clang-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.clang-version}}" >> $GITHUB_ENV + - name: Get latest CMake + uses: lukka/get-cmake@v3.27.7 - name: Clone Repository - uses: actions/checkout@master + uses: actions/checkout@v3 with: submodules: true - name: CMake build From f4884d5a6a6450718a97e58b9056f3942c57f8ee Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 03:56:56 +0900 Subject: [PATCH 10/28] fix clang ci matrix name --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 47ba4ed..7b15a25 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -43,7 +43,7 @@ jobs: build-type: ["Release", "Debug"] clang-version: ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] - container: silkeh/clang:${{ matrix.compiler }} + container: silkeh/clang:${{ matrix.clang-version }} steps: - name: ccache uses: hendrikmuhs/ccache-action@v1 From 8e83276eb0b68f0a02e3e1bc8830706372890c30 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 03:58:50 +0900 Subject: [PATCH 11/28] remove ccache --- .github/workflows/code-cov.yml | 24 ++++++++---------------- .github/workflows/linux.yml | 4 ---- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 0915236..2265064 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -14,22 +14,14 @@ jobs: strategy: matrix: build-type: ["Debug"] - llvm-version: ["9"] + clang-version: + ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] + container: silkeh/clang:${{ matrix.clang-version }} steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - - name: C++ Setting - run: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -yq clang-${{matrix.clang-version}} libc++-dev libc++abi-dev libstdc++-${{matrix.clang-version}}-dev build-essential cmake - sudo apt-get install -yq libllvm${{matrix.clang-version}} llvm-${{matrix.clang-version}} llvm-${{matrix.clang-version}}-dev llvm-${{matrix.clang-version}}-runtime - - name: Compiler Setting - run: | - echo "CC=clang-${{matrix.llvm-version}}" >> $GITHUB_ENV - echo "CXX=clang++-${{matrix.llvm-version}}" >> $GITHUB_ENV + - name: Get latest CMake + uses: lukka/get-cmake@v3.27.7 - name: Clone Repository - uses: actions/checkout@master + uses: actions/checkout@v3 with: submodules: true - name: CMake build @@ -41,8 +33,8 @@ jobs: run: | cd build/${{matrix.build-type}} ./unittest - llvm-profdata-${{matrix.llvm-version}} merge -sparse default.profraw -o default.profdata - llvm-cov-${{matrix.llvm-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info + llvm-profdata-${{matrix.clang-version}} merge -sparse default.profraw -o default.profdata + llvm-cov-${{matrix.clang-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7b15a25..c7e4cea 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -17,8 +17,6 @@ jobs: gcc-version: ["11", "12", "latest"] container: gcc:${{ matrix.gcc-version }} steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - name: Get latest CMake and ninja uses: lukka/get-cmake@v3.27.7 - uses: actions/checkout@v3 @@ -45,8 +43,6 @@ jobs: ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] container: silkeh/clang:${{ matrix.clang-version }} steps: - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - name: Get latest CMake uses: lukka/get-cmake@v3.27.7 - name: Clone Repository From 6e7dd805d1417111e98d015e1a1369fd366f7f9b Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 04:03:13 +0900 Subject: [PATCH 12/28] add step: git install --- .github/workflows/code-cov.yml | 5 +++-- .github/workflows/linux.yml | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 2265064..d55961b 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -14,12 +14,13 @@ jobs: strategy: matrix: build-type: ["Debug"] - clang-version: - ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] + clang-version: ["latest"] container: silkeh/clang:${{ matrix.clang-version }} steps: - name: Get latest CMake uses: lukka/get-cmake@v3.27.7 + - name: Install git on container + run: apt update && apt install -y git - name: Clone Repository uses: actions/checkout@v3 with: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c7e4cea..539a8ce 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -19,6 +19,8 @@ jobs: steps: - name: Get latest CMake and ninja uses: lukka/get-cmake@v3.27.7 + - name: Install git on container + run: apt update && apt install -y git - uses: actions/checkout@v3 with: submodules: true @@ -45,6 +47,8 @@ jobs: steps: - name: Get latest CMake uses: lukka/get-cmake@v3.27.7 + - name: Install git on container + run: apt update && apt install -y git - name: Clone Repository uses: actions/checkout@v3 with: From 8e1509d03ff43f97acb65906e45ca43ef352933e Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 04:25:51 +0900 Subject: [PATCH 13/28] change code-cov llvm-cov -> lcov --- .github/workflows/code-cov.yml | 32 ++++++++++++++++++-------------- .github/workflows/linux.yml | 19 +++++++------------ CMakeLists.txt | 1 + 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index d55961b..06c6186 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - ubuntu-llvm-code-cov: + ubuntu-gcc-code-cov: runs-on: ubuntu-latest env: CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" @@ -15,32 +15,36 @@ jobs: matrix: build-type: ["Debug"] clang-version: ["latest"] - container: silkeh/clang:${{ matrix.clang-version }} + container: gcc:${{ matrix.gcc-version }} steps: - name: Get latest CMake uses: lukka/get-cmake@v3.27.7 + - name: Install git on container run: apt update && apt install -y git - name: Clone Repository uses: actions/checkout@v3 with: submodules: true + - name: CMake build run: | cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Generate Coverage Report + cmake --build ./build --config ${{matrix.build-type}} + + - name: Run Test Script + working-directory: build + run: ctest -C ${{matrix.build-type}} --output-on-failure + + - name: Prepare Codecov run: | - cd build/${{matrix.build-type}} - ./unittest - llvm-profdata-${{matrix.clang-version}} merge -sparse default.profraw -o default.profdata - llvm-cov-${{matrix.clang-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + sudo apt-get install -y lcov + lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 # capture coverage info + lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out system + lcov --list coverage.info --rc lcov_branch_coverage=1 # debug info + - name: Codecov + uses: codecov/codecov-action@v3.1.1 with: - directory: ./build/${{matrix.build-type}} - files: lcov.info - flags: unittest + files: coverage.info fail_ci_if_error: true verbose: true diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 539a8ce..4747d6a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -27,12 +27,10 @@ jobs: - name: CMake build run: | cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} + cmake --build ./build --config ${{matrix.build-type}} - name: Run Test Script - run: | - cd build - ctest . + working-directory: build + run: ctest -C ${{matrix.build-type}} --output-on-failure ubuntu-llvm: runs-on: ubuntu-latest @@ -41,8 +39,7 @@ jobs: strategy: matrix: build-type: ["Release", "Debug"] - clang-version: - ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] + clang-version: ["8", "9", "10", "11", "12", "13", "latest"] #"14", "15-bullseye", "latest"] container: silkeh/clang:${{ matrix.clang-version }} steps: - name: Get latest CMake @@ -56,9 +53,7 @@ jobs: - name: CMake build run: | cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} + cmake --build ./build --config ${{matrix.build-type}} - name: Run Test Script - run: | - cd build - ctest . + working-directory: build + run: ctest -C ${{matrix.build-type}} --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index 8519cd3..3d652d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ cppm_cxx_standard(17) cppm_compiler_option( DEBUG CLANG "-fprofile-instr-generate -fcoverage-mapping" + GCC "-fprofile-arcs -ftest-coverage" ) find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF) From ad587b5b14f4101d3d626177324571566f425e87 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 04:27:39 +0900 Subject: [PATCH 14/28] fix cov-ci matrix name --- .github/workflows/code-cov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 06c6186..ec316e1 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: build-type: ["Debug"] - clang-version: ["latest"] + gcc-version: ["latest"] container: gcc:${{ matrix.gcc-version }} steps: - name: Get latest CMake From fa101ae124971c3afaed2dac5932bd6fdbc18f92 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 04:31:22 +0900 Subject: [PATCH 15/28] remove sudo --- .github/workflows/code-cov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index ec316e1..acebb6b 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -38,7 +38,7 @@ jobs: - name: Prepare Codecov run: | - sudo apt-get install -y lcov + apt-get install -y lcov lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 # capture coverage info lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out system lcov --list coverage.info --rc lcov_branch_coverage=1 # debug info From c0989a1f95839d10cfcf8321fdb70604f93a4450 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 04:46:04 +0900 Subject: [PATCH 16/28] remove coverage tests/* --- .github/workflows/code-cov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index acebb6b..b99f994 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -41,6 +41,7 @@ jobs: apt-get install -y lcov lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 # capture coverage info lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out system + lcov --remove coverage.info './tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out tests lcov --list coverage.info --rc lcov_branch_coverage=1 # debug info - name: Codecov uses: codecov/codecov-action@v3.1.1 From 50061587f2d1fd391e782ec228efe88e05babdde Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 13:28:48 +0900 Subject: [PATCH 17/28] remove coverage tests/*.cpp --- .github/workflows/code-cov.yml | 2 +- tests/catch_main.cpp | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 tests/catch_main.cpp diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index b99f994..51614d6 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -41,7 +41,7 @@ jobs: apt-get install -y lcov lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 # capture coverage info lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out system - lcov --remove coverage.info './tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out tests + lcov --remove coverage.info '**/tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out tests lcov --list coverage.info --rc lcov_branch_coverage=1 # debug info - name: Codecov uses: codecov/codecov-action@v3.1.1 diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp deleted file mode 100644 index 5b07e14..0000000 --- a/tests/catch_main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#define CATCH_CONFIG_MAIN - -#include - -TEST_CASE("1: test (pass)", "[multi-file:1]") { REQUIRE(1 == 1); } From 5a07289cc11ea35bc9a7c0abde7ef8d75ac0a75b Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 13:42:11 +0900 Subject: [PATCH 18/28] remove coverage thirdparty library --- .github/workflows/code-cov.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 51614d6..60c26cd 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -39,10 +39,11 @@ jobs: - name: Prepare Codecov run: | apt-get install -y lcov - lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 # capture coverage info - lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out system - lcov --remove coverage.info '**/tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out tests - lcov --list coverage.info --rc lcov_branch_coverage=1 # debug info + lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 + lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 + lcov --remove coverage.info '**/tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 + lcov --remove coverage.info '**/.cppm/*' --output-file coverage.info --rc lcov_branch_coverage=1 + lcov --list coverage.info --rc lcov_branch_coverage=1 - name: Codecov uses: codecov/codecov-action@v3.1.1 with: From fd263547089b3ba1f59b9b0185f114609e48c84c Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 15:00:47 +0900 Subject: [PATCH 19/28] update gcc debug compile option for coverage --- .envrc | 1 + CMakeLists.txt | 2 +- flake.nix | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d652d9..314b638 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cppm_cxx_standard(17) cppm_compiler_option( DEBUG CLANG "-fprofile-instr-generate -fcoverage-mapping" - GCC "-fprofile-arcs -ftest-coverage" + GCC "--coverage -fno-inline -fno-inline-small-functions -fno-default-inline" ) find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF) diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ca5719e --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +# in flake.nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let + overlays = []; + pkgs = import nixpkgs { + inherit system overlays; + }; + in + with pkgs; + { + devShells.default = mkShell { + nativeBuildInputs = [ + #llvmPackages_17.stdenv + gcc13Stdenv + ccache + cmake + ninja + lcov + ]; + shellHook = '' + export CC=gcc + export CXX=g++ + ''; + }; + } + ); +} From d7661d73bcc697810bccb9ec3b0536b169c7e33a Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 15:02:15 +0900 Subject: [PATCH 20/28] remove .envrc --- .envrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .envrc diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake From 1159a20146c0b94015b97eb6649aa048f7b30d1b Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 15:12:10 +0900 Subject: [PATCH 21/28] remove flake.nix --- flake.nix | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 flake.nix diff --git a/flake.nix b/flake.nix deleted file mode 100644 index ca5719e..0000000 --- a/flake.nix +++ /dev/null @@ -1,34 +0,0 @@ -# in flake.nix -{ - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem - (system: - let - overlays = []; - pkgs = import nixpkgs { - inherit system overlays; - }; - in - with pkgs; - { - devShells.default = mkShell { - nativeBuildInputs = [ - #llvmPackages_17.stdenv - gcc13Stdenv - ccache - cmake - ninja - lcov - ]; - shellHook = '' - export CC=gcc - export CXX=g++ - ''; - }; - } - ); -} From cf274a01aa00e9f4caec11225f82777c5cb96a1a Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 16:17:26 +0900 Subject: [PATCH 22/28] add annotations maybe-unused in example reflection.cpp --- examples/reflection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/reflection.cpp b/examples/reflection.cpp index 7749c89..a753ff3 100644 --- a/examples/reflection.cpp +++ b/examples/reflection.cpp @@ -29,8 +29,8 @@ int main(int argc, char* argv[]) { member_b_info = 3.14; auto member_d_info = info.member_info<3>(a); - std::string_view member_d_name = member_d_info.name(); - std::vector& member_d = member_d_info.value(); + [[maybe_unused]] std::string_view member_d_name = member_d_info.name(); + [[maybe_unused]] std::vector& member_d = member_d_info.value(); auto names = info.member_names(); for(auto& name : names.members()) { From e8b29a9e95d074dce22ca05b8467b105129272db Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 16:18:04 +0900 Subject: [PATCH 23/28] add test throw unknown_adaptor exception --- CMakeLists.txt | 1 + include/serdepp/serializer.hpp | 15 ++++++--------- tests/serializer.cpp | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 tests/serializer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 314b638..7f4e3a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,7 @@ if(SERDEPP_BUILD_TESTING) cppm_target_define(unittest BINARY SOURCES + tests/serializer.cpp tests/rapid_json.cpp tests/yaml_cpp.cpp tests/toml11.cpp diff --git a/include/serdepp/serializer.hpp b/include/serdepp/serializer.hpp index 2e984af..07e76ed 100644 --- a/include/serdepp/serializer.hpp +++ b/include/serdepp/serializer.hpp @@ -42,28 +42,28 @@ namespace serde throw serde::unimplemented_error("serde_adaptor<" + std::string(nameof::nameof_short_type()) +">::is_null(adaptor, key)"); - return adaptor.contains(key); + return false; } inline constexpr static size_t size(Adaptor& adaptor) { throw serde::unimplemented_error("serde_adaptor<" + std::string(nameof::nameof_short_type()) +">::size(adaptor, key)"); - return adaptor.size(); + return 0; } inline constexpr static bool is_struct(Adaptor& adaptor) { throw serde::unimplemented_error("serde_adaptor<" + std::string(nameof::nameof_short_type()) +">::is_struct(adaptor, key)"); - return true; + return false; } - inline constexpr static Adaptor parse_file(Adaptor& adaptor) { + inline constexpr static Adaptor parse_file(const std::string& path) { throw serde::unimplemented_error("serde_adaptor<" + std::string(nameof::nameof_short_type()) +">::parse_file(adaptor, key)"); - return true; + return Adaptor{}; } }; @@ -74,10 +74,7 @@ namespace serde }; namespace detail { - struct dummy_adaptor{ - bool contains(std::string_view key) { return true; } - size_t size() { return 1; } - }; + struct dummy_adaptor{}; }; template <> struct serde_adaptor_helper diff --git a/tests/serializer.cpp b/tests/serializer.cpp new file mode 100644 index 0000000..ac5c31a --- /dev/null +++ b/tests/serializer.cpp @@ -0,0 +1,17 @@ +#include "serdepp/exception.hpp" +#include "serdepp/serializer.hpp" +#include "test_struct.hpp" +#include +#include + +struct unknown_adapter {}; + +TEST_CASE("5: unknown adapter with exception (pass)", "[multi-file:5]") { + auto adapter = unknown_adapter{}; + using helper_t = serde::derive_serde_adaptor_helper; + REQUIRE_THROWS_AS(helper_t::is_null(adapter, "hello"), serde::unimplemented_error); + REQUIRE_THROWS_AS(helper_t::size(adapter), serde::unimplemented_error); + REQUIRE_THROWS_AS(helper_t::is_struct(adapter), serde::unimplemented_error); + REQUIRE_THROWS_AS(helper_t::parse_file(std::string("path")), serde::unimplemented_error); +} + From ac48088863c81b08d642cca288bb4df76b5bcdaa Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 16:35:55 +0900 Subject: [PATCH 24/28] remove empty block --- include/serdepp/serializer.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/serdepp/serializer.hpp b/include/serdepp/serializer.hpp index 07e76ed..22e0e3f 100644 --- a/include/serdepp/serializer.hpp +++ b/include/serdepp/serializer.hpp @@ -69,8 +69,8 @@ namespace serde template struct serde_adaptor { - static void from(S& s, std::string_view key, T& data){} - static void into(S& s, std::string_view key, const T& data){} + static void from(S& s, std::string_view key, T& data); + static void into(S &s, std::string_view key, const T &data); }; namespace detail { From 9b7d40ba5c2bf92cb8a993ce0c2cf181f75bda89 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 16:36:11 +0900 Subject: [PATCH 25/28] add test reflection struct -> tuple --- tests/reflection.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/reflection.cpp b/tests/reflection.cpp index e7e336e..08fcfa7 100644 --- a/tests/reflection.cpp +++ b/tests/reflection.cpp @@ -10,4 +10,8 @@ TEST_CASE("3: reflection struct (pass)", "[multi-file:3]") { std::tuple, std::optional, std::optional, std::map, nested>>); + REQUIRE(serde::type_info.size == 7); + REQUIRE(serde::tuple_size_v == 7); + REQUIRE(std::is_same_v>>); } From 26bc07ba7c2ca5899c31e5c1a2897a4887958ca4 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 17:14:40 +0900 Subject: [PATCH 26/28] change coverage-bin gcov -> llvm-cov --- .github/workflows/code-cov.yml | 14 ++++++++------ CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 60c26cd..f2a8ed8 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -7,15 +7,15 @@ on: pull_request: jobs: - ubuntu-gcc-code-cov: + ubuntu-code-cov: runs-on: ubuntu-latest env: CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" strategy: matrix: build-type: ["Debug"] - gcc-version: ["latest"] - container: gcc:${{ matrix.gcc-version }} + compiler-version: ["latest"] + container: silkeh/clang:${{ matrix.compiler-version }} steps: - name: Get latest CMake uses: lukka/get-cmake@v3.27.7 @@ -33,13 +33,15 @@ jobs: cmake --build ./build --config ${{matrix.build-type}} - name: Run Test Script - working-directory: build - run: ctest -C ${{matrix.build-type}} --output-on-failure + working-directory: build/${{matrix.build-type}} + run: | + ./unittest + llvm-profdata merge -sparse default.profraw -o default.profdata + llvm-cov export ./unittest --instr-profile default.profdata -format=lcov >> coverage.info - name: Prepare Codecov run: | apt-get install -y lcov - lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 lcov --remove coverage.info '**/tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 lcov --remove coverage.info '**/.cppm/*' --output-file coverage.info --rc lcov_branch_coverage=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f4e3a2..f4aee40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ cppm_setting() cppm_cxx_standard(17) cppm_compiler_option( DEBUG - CLANG "-fprofile-instr-generate -fcoverage-mapping" + CLANG "-fprofile-instr-generate -fcoverage-mapping --coverage" GCC "--coverage -fno-inline -fno-inline-small-functions -fno-default-inline" ) From aaf16dfa4ec97f927d5c0aa06f2b8f6112824a89 Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 17:21:13 +0900 Subject: [PATCH 27/28] cp coverage.info to project root --- .github/workflows/code-cov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index f2a8ed8..6d4031d 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -38,6 +38,7 @@ jobs: ./unittest llvm-profdata merge -sparse default.profraw -o default.profdata llvm-cov export ./unittest --instr-profile default.profdata -format=lcov >> coverage.info + cp coverage.info ../../ - name: Prepare Codecov run: | From 70dc991434493dd61d239bf8ab309620bf2d8d7f Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 18:05:53 +0900 Subject: [PATCH 28/28] update cppm.toml and remove gcc debug flags --- CMakeLists.txt | 1 - cppm.toml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4aee40..d2e53ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ cppm_cxx_standard(17) cppm_compiler_option( DEBUG CLANG "-fprofile-instr-generate -fcoverage-mapping --coverage" - GCC "--coverage -fno-inline -fno-inline-small-functions -fno-default-inline" ) find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF) diff --git a/cppm.toml b/cppm.toml index 167eca1..70ff3c4 100644 --- a/cppm.toml +++ b/cppm.toml @@ -8,7 +8,7 @@ # include=["cmake/Lua.cmake"] [profile.dev.compiler] - clang = "-fprofile-instr-generate -fcoverage-mapping" + clang = "-fprofile-instr-generate -fcoverage-mapping --coverage" [lib] name = "serdepp" @@ -93,7 +93,7 @@ source = ["tests/.*"] nameof = { version="0.10.0", link="public"} magic_enum = { version= "0.7.3", link="public"} fmt = {version="8.0.1", link="public", optional=true} - yaml-cpp = { version="0.7.0", link="public", optional=true} + yaml-cpp = { version="0.6.3", link="public", optional=true} toml11 = { version="3.7.0", link="public", optional=true} nlohmann_json = { version="3.10.5", link="public", optional=true} RapidJSON = { version="1.1.1", link="public", optional=true}