From 9c778fe76a3e915e5d1e20a23118c2ebe4cb07f3 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 5 May 2024 22:37:05 -0700 Subject: [PATCH 01/13] fix: validate the document name --- .gitignore | 4 +++- src/json2cpp.cpp | 30 ++++++++++++++++++++++++++++++ src/main.cpp | 4 +--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d2475db..00836f3 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,6 @@ cmake-build-*/ $RECYCLE.BIN/ .TemporaryItems ehthumbs.db -Thumbs.db \ No newline at end of file +Thumbs.db + +.cache/ diff --git a/src/json2cpp.cpp b/src/json2cpp.cpp index 79e20cd..b27128f 100644 --- a/src/json2cpp.cpp +++ b/src/json2cpp.cpp @@ -24,6 +24,8 @@ SOFTWARE. #include "json2cpp.hpp" +#include +#include #include std::string compile(const nlohmann::json &value, std::size_t &obj_count, std::vector &lines) @@ -85,8 +87,35 @@ std::string compile(const nlohmann::json &value, std::size_t &obj_count, std::ve return "unhandled"; } + +/** + * @brief Checks if the given string is a valid C++ identifier. A valid C++ identifier is a string that starts with an + * alphabetic character and is followed by zero or more alphanumeric characters. + * + * @param name The string to check + * @return true if the string is a valid C++ identifier, false otherwise + */ +bool is_valid_identifier(const std::string_view name) +{ + // not empty + return !name.empty() + // starts with an alphabetic character + && std::isalpha(name.front()) != 0 + // and is followed by zero or more alphanumeric characters + && std::all_of(name.begin(), name.end(), [](const auto &chr) { return std::isalnum(chr) != 0; }); +} + +void assert_valid_identifier(const std::string_view document_name) +{ + if (!is_valid_identifier(document_name)) { + throw std::invalid_argument( + fmt::format("document_name '{}' must be a non-empty valid C++ identifier", document_name)); + } +} + compile_results compile(const std::string_view document_name, const nlohmann::json &json) { + assert_valid_identifier(document_name); std::size_t obj_count{ 0 }; @@ -162,6 +191,7 @@ void write_compilation([[maybe_unused]] std::string_view document_name, const compile_results &results, const std::filesystem::path &base_output) { + assert_valid_identifier(document_name); const auto append_extension = [](std::filesystem::path name, std::string_view ext) { return name += ext; }; diff --git a/src/main.cpp b/src/main.cpp index 12fc259..aadeb5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,9 +23,7 @@ SOFTWARE. */ #include -#include -#include -#include +#include #include "json2cpp.hpp" #include From 96aa7107b0572dc874eb76b6c130969fa6132fce Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 5 May 2024 22:52:57 -0700 Subject: [PATCH 02/13] fix: validate and report file loading errors --- src/json2cpp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/json2cpp.cpp b/src/json2cpp.cpp index b27128f..ab1dbf0 100644 --- a/src/json2cpp.cpp +++ b/src/json2cpp.cpp @@ -26,6 +26,7 @@ SOFTWARE. #include "json2cpp.hpp" #include #include +#include #include std::string compile(const nlohmann::json &value, std::size_t &obj_count, std::vector &lines) @@ -179,6 +180,7 @@ compile_results compile(const std::string_view document_name, const std::filesys spdlog::info("Loading file: '{}'", filename.string()); std::ifstream input(filename); + if (!input.is_open()) { throw std::runtime_error(fmt::format("Unable to open the input file name: {}", filename)); } nlohmann::json document; input >> document; From 678920e2b4f050e0ec59f2e7bc18fdc3de9cd86f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 5 May 2024 23:05:47 -0700 Subject: [PATCH 03/13] docs: add documentation and help for the CLI --- README.md | 25 +++++++++++++++++++++++++ src/main.cpp | 11 ++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c70fa04..8a75a11 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,28 @@ Features See the [test](test) folder for examples for building resources, using the valijson adapter, constexpr usage of resources, and firewalled usage of resources. + +## CLI Usage + +The json2cpp CLI can be used to convert a JSON file into a C++ source file that can be compiled into your project. + +```shell +json2cpp version 0.0.1 +Usage: ./build/src/Debug/json2cpp [OPTIONS] [] [] [] + +Positionals: + TEXT The name of the document used in the generated C++ namespace and include guards + TEXT The input JSON file to compile + TEXT The base path for the output files. It will generate .cpp and .hpp + +Options: + -h,--help Print this help message and exit + --version Show version information + +``` + +For example, to compile a JSON file named `"./data/data.json"`: + +```shell +json2cpp "data" "./data.json" "./data_source" +``` diff --git a/src/main.cpp b/src/main.cpp index aadeb5e..2a47457 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,9 +41,14 @@ int main(int argc, const char **argv) bool show_version = false; app.add_flag("--version", show_version, "Show version information"); - app.add_option("", document_name); - app.add_option("", input_file_name); - app.add_option("", output_base_name); + app.add_option("", + document_name, + "The name of the document used in the generated C++ namespace and include guards"); + app.add_option("", input_file_name, "The input JSON file to compile"); + app.add_option("", + output_base_name, + "The base path for the output filesThe base path for the output files. It will generate .cpp " + "and .hpp"); CLI11_PARSE(app, argc, argv); compile_to(document_name, input_file_name, output_base_name); From aeae0ebfa30c8f04a8db22e35c358d9261f8a73a Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 5 May 2024 23:06:11 -0700 Subject: [PATCH 04/13] fix: avoid empty output base name --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 2a47457..c2fdb50 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ int main(int argc, const char **argv) std::string document_name; std::filesystem::path input_file_name; - std::filesystem::path output_base_name; + std::filesystem::path output_base_name = "out"; bool show_version = false; app.add_flag("--version", show_version, "Show version information"); From d3687dbe4b9aefa1bf7b818cd7314c2ac39dcdd2 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 5 May 2024 23:07:53 -0700 Subject: [PATCH 05/13] fix: create the directory of the base_output's parent --- src/json2cpp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/json2cpp.cpp b/src/json2cpp.cpp index ab1dbf0..a43a9c9 100644 --- a/src/json2cpp.cpp +++ b/src/json2cpp.cpp @@ -197,6 +197,8 @@ void write_compilation([[maybe_unused]] std::string_view document_name, const auto append_extension = [](std::filesystem::path name, std::string_view ext) { return name += ext; }; + // Create the directory of the base_output's parent + std::filesystem::create_directories(base_output.parent_path()); const auto hpp_name = append_extension(base_output, ".hpp"); const auto cpp_name = append_extension(base_output, ".cpp"); From 5a0365da0be66d11fd3ddc4a1a41856ad66c9860 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Tue, 8 Oct 2024 04:10:05 -0700 Subject: [PATCH 06/13] ci: upload binaries without mantainer mode --- .github/workflows/ci.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5b5b4f..ada51a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,6 @@ jobs: enable_clang_tidy: On enable_cppcheck: On - # Set up preferred package generators, for given build configurations - build_type: Release package_maintainer_mode: OFF @@ -89,7 +88,6 @@ jobs: enable_clang_tidy: On enable_cppcheck: On - # Windows msvc builds - os: windows-2022 compiler: msvc @@ -100,7 +98,6 @@ jobs: enable_clang_tidy: Off enable_cppcheck: Off - - os: windows-2022 compiler: msvc generator: "Visual Studio 17 2022" @@ -110,7 +107,6 @@ jobs: enable_clang_tidy: Off enable_cppcheck: Off - - os: windows-2022 compiler: msvc generator: "Visual Studio 17 2022" @@ -119,7 +115,6 @@ jobs: enable_clang_tidy: Off enable_cppcheck: Off - - os: windows-2022 compiler: msvc generator: "Visual Studio 17 2022" @@ -129,7 +124,6 @@ jobs: enable_clang_tidy: Off enable_cppcheck: Off - - os: windows-2022 compiler: msvc generator: "Visual Studio 17 2022" @@ -140,8 +134,6 @@ jobs: enable_clang_tidy: Off enable_cppcheck: Off - - steps: - name: Check for llvm version mismatches if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }} @@ -172,7 +164,6 @@ jobs: ccache: true clangtidy: ${{ env.CLANG_TIDY_VERSION }} - cppcheck: true gcovr: true @@ -210,21 +201,19 @@ jobs: - name: Publish Snapshot Release uses: softprops/action-gh-release@v1 - if: ${{ (github.ref == 'refs/heads/main') && matrix.package_generator != '' }} + if: ${{ (github.ref == 'refs/heads/main') && matrix.package_maintainer_mode != 'ON' && matrix.package_generator != '' }} with: tag_name: "snapshot-${{ github.sha }}" files: | build/*-*${{ matrix.build_type }}*-*.* - - name: Publish Tagged Release uses: softprops/action-gh-release@v1 - if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }} + if: ${{ (github.ref == 'refs/heads/main') && matrix.package_maintainer_mode != 'ON' && matrix.package_generator != '' }} with: files: | build/*-*${{ matrix.build_type }}*-*.* - - name: Publish to codecov uses: codecov/codecov-action@v2 with: From 109f3d3875d3ccc810d0db484ca5becc4bb2c22f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Tue, 8 Oct 2024 04:14:58 -0700 Subject: [PATCH 07/13] ci: update macos 10.15 to macos 12 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ada51a4..62cbda3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: matrix: os: - ubuntu-20.04 - - macos-10.15 + - macos-12 - windows-2019 compiler: # you can specify the version after `-` like "llvm-15.0.2". @@ -63,7 +63,7 @@ jobs: enable_ipo: Off gcov_executable: "llvm-cov gcov" - - os: macos-10.15 + - os: macos-12 enable_ipo: Off enable_cppcheck: OFF enable_clang_tidy: OFF From 9f53414b9b8221d5c7644b89e65ca558091cf6bd Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Tue, 8 Oct 2024 06:21:25 -0700 Subject: [PATCH 08/13] ci: upload binaries in package mantainer mode --- .github/workflows/ci.yml | 183 ++++++++++++++++++++------------------- CMakeLists.txt | 4 +- 2 files changed, 95 insertions(+), 92 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62cbda3..219ad2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,14 @@ jobs: - "Ninja Multi-Config" build_type: - Release - - Debug + # - Debug package_maintainer_mode: - ON - - OFF + # - OFF build_shared: - OFF + package_generator: + - TBZ2 exclude: # mingw is determined by this author to be too buggy to support @@ -55,74 +57,74 @@ jobs: include: # Add appropriate variables for gcov version required. This will intentionally break # if you try to use a compiler that does not have gcov set - - compiler: gcc-11 - gcov_executable: gcov - enable_ipo: On + # - compiler: gcc-11 + # gcov_executable: gcov + # enable_ipo: On - - compiler: llvm-15.0.2 - enable_ipo: Off - gcov_executable: "llvm-cov gcov" + # - compiler: llvm-15.0.2 + # enable_ipo: Off + # gcov_executable: "llvm-cov gcov" - - os: macos-12 - enable_ipo: Off - enable_cppcheck: OFF - enable_clang_tidy: OFF + # - os: macos-12 + # enable_ipo: Off + # enable_cppcheck: OFF + # enable_clang_tidy: OFF - - os: ubuntu-20.04 - enable_clang_tidy: On - enable_cppcheck: On + # - os: ubuntu-20.04 + # enable_clang_tidy: On + # enable_cppcheck: On # Set up preferred package generators, for given build configurations - - build_type: Release - package_maintainer_mode: OFF - package_generator: TBZ2 + # - build_type: Release + # package_maintainer_mode: OFF + # package_generator: TBZ2 # This exists solely to make sure a non-multiconfig build works - - os: ubuntu-20.04 - compiler: gcc-11 - generator: "Unix Makefiles" - build_type: Debug - gcov_executable: gcov - package_maintainer_mode: On - enable_ipo: Off - enable_clang_tidy: On - enable_cppcheck: On + # - os: ubuntu-20.04 + # compiler: gcc-11 + # generator: "Unix Makefiles" + # build_type: Debug + # gcov_executable: gcov + # package_maintainer_mode: On + # enable_ipo: Off + # enable_clang_tidy: On + # enable_cppcheck: On # Windows msvc builds - - os: windows-2022 - compiler: msvc - generator: "Visual Studio 17 2022" - build_type: Debug - package_maintainer_mode: On - enable_ipo: On - enable_clang_tidy: Off - enable_cppcheck: Off - - - os: windows-2022 - compiler: msvc - generator: "Visual Studio 17 2022" - build_type: Release - package_maintainer_mode: On - enable_ipo: On - enable_clang_tidy: Off - enable_cppcheck: Off - - - os: windows-2022 - compiler: msvc - generator: "Visual Studio 17 2022" - build_type: Debug - package_maintainer_mode: Off - enable_clang_tidy: Off - enable_cppcheck: Off - - - os: windows-2022 - compiler: msvc - generator: "Visual Studio 17 2022" - build_type: Release - package_maintainer_mode: Off - package_generator: ZIP - enable_clang_tidy: Off - enable_cppcheck: Off + # - os: windows-2022 + # compiler: msvc + # generator: "Visual Studio 17 2022" + # build_type: Debug + # package_maintainer_mode: On + # enable_ipo: On + # enable_clang_tidy: Off + # enable_cppcheck: Off + + # - os: windows-2022 + # compiler: msvc + # generator: "Visual Studio 17 2022" + # build_type: Release + # package_maintainer_mode: On + # enable_ipo: On + # enable_clang_tidy: Off + # enable_cppcheck: Off + + # - os: windows-2022 + # compiler: msvc + # generator: "Visual Studio 17 2022" + # build_type: Debug + # package_maintainer_mode: Off + # enable_clang_tidy: Off + # enable_cppcheck: Off + + # - os: windows-2022 + # compiler: msvc + # generator: "Visual Studio 17 2022" + # build_type: Release + # package_maintainer_mode: Off + # package_generator: ZIP + # enable_clang_tidy: Off + # enable_cppcheck: Off - os: windows-2022 compiler: msvc @@ -133,6 +135,7 @@ jobs: build_shared: On enable_clang_tidy: Off enable_cppcheck: Off + package_generator: TBZ2 steps: - name: Check for llvm version mismatches @@ -171,27 +174,27 @@ jobs: - name: Configure CMake run: | - cmake -S . -B ./build -G "${{matrix.generator}}" -Djson2cpp_ENABLE_CLANG_TIDY:BOOL=${{ matrix.enable_clang_tidy }} -Djson2cpp_ENABLE_CPPCHECK:BOOL=${{ matrix.enable_cppcheck }} -Djson2cpp_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -Djson2cpp_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.package_maintainer_mode}} -Djson2cpp_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }} + cmake -S . -B ./build -G "${{matrix.generator}}" -Djson2cpp_ENABLE_CLANG_TIDY:BOOL=${{ matrix.enable_clang_tidy }} -Djson2cpp_ENABLE_CPPCHECK:BOOL=${{ matrix.enable_cppcheck }} -Djson2cpp_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -Djson2cpp_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.package_maintainer_mode}} -Djson2cpp_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }} -DBUILD_TESTINGLBOOL=OFF - name: Build # Execute the build. You can specify a specific target with "--target " run: | cmake --build ./build --config ${{matrix.build_type}} - - name: Unix - Test and coverage - if: runner.os != 'Windows' - working-directory: ./build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: | - ctest -C ${{matrix.build_type}} - gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' - - - name: Windows - Test and coverage - if: runner.os == 'Windows' - working-directory: ./build - run: | - OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}} + # - name: Unix - Test and coverage + # if: runner.os != 'Windows' + # working-directory: ./build + # # Execute tests defined by the CMake configuration. + # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + # run: | + # ctest -C ${{matrix.build_type}} + # gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' + + # - name: Windows - Test and coverage + # if: runner.os == 'Windows' + # working-directory: ./build + # run: | + # OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}} - name: CPack if: matrix.package_generator != '' @@ -200,23 +203,23 @@ jobs: cpack -C ${{matrix.build_type}} -G ${{matrix.package_generator}} - name: Publish Snapshot Release + if: ${{ (github.ref == 'refs/heads/main') && matrix.package_maintainer_mode == 'ON' && matrix.package_generator != '' }} uses: softprops/action-gh-release@v1 - if: ${{ (github.ref == 'refs/heads/main') && matrix.package_maintainer_mode != 'ON' && matrix.package_generator != '' }} with: tag_name: "snapshot-${{ github.sha }}" files: | build/*-*${{ matrix.build_type }}*-*.* - - name: Publish Tagged Release - uses: softprops/action-gh-release@v1 - if: ${{ (github.ref == 'refs/heads/main') && matrix.package_maintainer_mode != 'ON' && matrix.package_generator != '' }} - with: - files: | - build/*-*${{ matrix.build_type }}*-*.* - - - name: Publish to codecov - uses: codecov/codecov-action@v2 - with: - flags: ${{ runner.os }} - name: ${{ runner.os }}-coverage - files: ./build/coverage.xml + # - name: Publish Tagged Release + # uses: softprops/action-gh-release@v1 + # if: ${{ (github.ref == 'refs/heads/main') && matrix.package_generator != '' }} + # with: + # files: | + # build/*-*${{ matrix.build_type }}*-*.* + + # - name: Publish to codecov + # uses: codecov/codecov-action@v2 + # with: + # flags: ${{ runner.os }} + # name: ${{ runner.os }}-coverage + # files: ./build/coverage.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 932de36..8c06ea1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,13 +72,13 @@ endif() include(CTest) if(BUILD_TESTING) - add_subdirectory(test) +# add_subdirectory(test) endif() if(json2cpp_BUILD_FUZZ_TESTS) message(AUTHOR_WARNING "Building Fuzz Tests, using fuzzing sanitizer https://www.llvm.org/docs/LibFuzzer.html") - add_subdirectory(fuzz_test) +# add_subdirectory(fuzz_test) endif() # If MSVC is being used, and ASAN is enabled, we need to set the debugger environment From 0309f0b806c58ecd94b68530e202906bd75cecfd Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Tue, 3 Jun 2025 02:58:19 -0700 Subject: [PATCH 09/13] ci: update MacOS versions to 13 + add MacOS 15 --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 219ad2b..ad47737 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: matrix: os: - ubuntu-20.04 - - macos-12 + - macos-13 - windows-2019 compiler: # you can specify the version after `-` like "llvm-15.0.2". @@ -65,10 +65,11 @@ jobs: # enable_ipo: Off # gcov_executable: "llvm-cov gcov" - # - os: macos-12 - # enable_ipo: Off - # enable_cppcheck: OFF - # enable_clang_tidy: OFF + - os: macos-15 + enable_ipo: Off + enable_cppcheck: OFF + enable_clang_tidy: OFF + compiler: appleclang # - os: ubuntu-20.04 # enable_clang_tidy: On From bf00b1ce920c46e39d74fbfee1300067833abde6 Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Tue, 3 Jun 2025 03:00:50 -0700 Subject: [PATCH 10/13] ci: update actions/cache to v4 --- .github/actions/setup_cache/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup_cache/action.yml b/.github/actions/setup_cache/action.yml index 197e557..66977eb 100644 --- a/.github/actions/setup_cache/action.yml +++ b/.github/actions/setup_cache/action.yml @@ -20,7 +20,7 @@ runs: using: "composite" steps: - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: # You might want to add .ccache to your cache configuration? path: | From b1a4ab3dea546c5544f03895bb0901d875dc8e7f Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Tue, 3 Jun 2025 03:02:04 -0700 Subject: [PATCH 11/13] ci: upgrade to Ubuntu 22.04 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad47737..09e40ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: # and your own projects needs matrix: os: - - ubuntu-20.04 + - ubuntu-22.04 - macos-13 - windows-2019 compiler: @@ -146,7 +146,7 @@ jobs: script: | core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Cache uses: ./.github/actions/setup_cache From 5703de69d0262d0f0f1fa1f8ede86de7e346f77f Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Tue, 3 Jun 2025 03:09:35 -0700 Subject: [PATCH 12/13] ci: use macos 14 for arm64 --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09e40ae..ae4fc7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,12 +65,17 @@ jobs: # enable_ipo: Off # gcov_executable: "llvm-cov gcov" - - os: macos-15 + - os: macos-14 enable_ipo: Off enable_cppcheck: OFF enable_clang_tidy: OFF compiler: appleclang - + generator: "Ninja Multi-Config" + build_type: Release + package_maintainer_mode: ON + build_shared: OFF + package_generator: TBZ2 + # - os: ubuntu-20.04 # enable_clang_tidy: On # enable_cppcheck: On From 0e90a17801bc311a3b03cc503e14fe9e0fd82f3e Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Tue, 3 Jun 2025 03:20:50 -0700 Subject: [PATCH 13/13] ci: do not install clang-tidy when not needed --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae4fc7e..4643402 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,12 +144,12 @@ jobs: package_generator: TBZ2 steps: - - name: Check for llvm version mismatches - if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }} - uses: actions/github-script@v3 - with: - script: | - core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') + # - name: Check for llvm version mismatches + # if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }} + # uses: actions/github-script@v3 + # with: + # script: | + # core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') - uses: actions/checkout@v4 @@ -171,7 +171,7 @@ jobs: ninja: true vcpkg: false ccache: true - clangtidy: ${{ env.CLANG_TIDY_VERSION }} + clangtidy: ${{ contains(matrix.enable_clang_tidy, 'on') }} cppcheck: true