Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exclude PGM C API from default build targets #22

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ concurrency:

jobs:
clang-tidy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
build-option: [ debug, release ]
Expand All @@ -51,10 +51,10 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang-15 clang-tidy-15
sudo ln -s /usr/bin/clang-15 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-15 /usr/local/bin/clang++
sudo ln -s /usr/bin/clang-tidy-15 /usr/local/bin/clang-tidy
sudo apt-get install -y ninja-build clang-18 clang-tidy-18
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo ln -s /usr/bin/clang-tidy-18 /usr/local/bin/clang-tidy

- name: Enable brew
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
path: ./wheelhouse/*.tar.gz

build-cpp-test-linux:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
build-option: [ debug, release ]
Expand All @@ -86,11 +86,11 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-12 g++-12 clang-15
sudo ln -s /usr/bin/clang-15 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-15 /usr/local/bin/clang++
sudo ln -s /usr/bin/gcc-12 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-12 /usr/local/bin/g++
sudo apt-get install -y ninja-build gcc-13 g++-13 clang-18
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
sudo ln -s /usr/bin/gcc-13 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-13 /usr/local/bin/g++

- name: Enable brew
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew
LLVM_COV: llvm-cov-15
LLVM_COV: llvm-cov-18
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -38,9 +38,9 @@ jobs:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang-15 lcov gcovr
sudo ln -s /usr/bin/clang-15 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-15 /usr/local/bin/clang++
sudo apt-get install -y ninja-build clang-18 lcov gcovr
sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++
- name: Enable brew
run: |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
Expand Down
5 changes: 4 additions & 1 deletion deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
#
# SPDX-License-Identifier: MPL-2.0

set_directory_properties(PROPERTIES
SYSTEM TRUE
EXCLUDE_FROM_ALL TRUE
)
add_subdirectory("power-grid-model")

2 changes: 1 addition & 1 deletion deps/power-grid-model
Submodule power-grid-model updated 194 files
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ typedef struct PGM_IO_Handle PGM_IO_Handle;

// NOLINTEND(modernize-use-using)

// NOLINTBEGIN(performance-enum-size)

/**
* @brief Enumeration of error codes.
*
Expand All @@ -105,6 +107,8 @@ enum PGM_IO_ExperimentalFeatures {
PGM_IO_experimental_features_enabled = 1, /**< enable experimental features */
};

// NOLINTEND(performance-enum-size)

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#define PGM_IO_DLL_EXPORTS

#include "power_grid_model_io_native_c/handle.h"
#include "power_grid_model_io_native_c/basics.h"

#include "handle.hpp"

#include <algorithm>
#include "handle.hpp" // NOLINT(misc-include-cleaner)

namespace {
using namespace power_grid_model_io_native;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <power_grid_model_io_native_c/basics.h>
#include <power_grid_model_io_native_c/pgm_vnf_converter.h>

#include <power_grid_model/auxiliary/dataset.hpp>
#include <power_grid_model/common/exception.hpp>

namespace pgm_io = power_grid_model_io_native;
Expand Down
7 changes: 4 additions & 3 deletions tests/c_api_tests/test_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
//
// SPDX-License-Identifier: MPL-2.0

// NOLINTBEGIN(misc-include-cleaner)

#include "c_api_cpp_handle.hpp"
#include "power_grid_model_io_native_c.h"

#include <doctest/doctest.h>

#include <memory>

namespace power_grid_model_io_native {

TEST_CASE("C API") {
Expand All @@ -19,3 +18,5 @@ TEST_CASE("C API") {
}

} // namespace power_grid_model_io_native

// NOLINTEND(misc-include-cleaner)
21 changes: 10 additions & 11 deletions tests/c_api_tests/test_c_api_pgm_vnf_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
//
// SPDX-License-Identifier: MPL-2.0

#

#include <power_grid_model_io_native_c/basics.h>
#include <power_grid_model_io_native_c/handle.h>
#include <power_grid_model_io_native_c/pgm_vnf_converter.h>

#include <power_grid_model/common/exception.hpp>

#include <cstring>
#include <doctest/doctest.h>

#include <ostream> // NOLINT(misc-include-cleaner) // Windows Clang-Tidy issue
#include <string_view>

namespace power_grid_model_io_native {

using enum PGM_IO_ExperimentalFeatures;
Expand All @@ -22,7 +20,7 @@ TEST_CASE("Test PGM_IO_create_vnf_converter") {

SUBCASE("Test PGM_IO_create_vnf_converter without experimental feature flag") {
PGM_IO_Handle* handle = PGM_IO_create_handle();
auto converter = PGM_IO_create_pgm_vnf_converter(handle, "", experimental_feature_flag);
auto* converter = PGM_IO_create_pgm_vnf_converter(handle, "", experimental_feature_flag);
CHECK(PGM_IO_error_code(handle) == PGM_IO_regular_error);
PGM_IO_destroy_pgm_vnf_converter(converter);
PGM_IO_destroy_handle(handle);
Expand All @@ -31,7 +29,7 @@ TEST_CASE("Test PGM_IO_create_vnf_converter") {
SUBCASE("Test PGM_IO_create_vnf_converter with experimental feature flag") {
PGM_IO_Handle* handle = PGM_IO_create_handle();
experimental_feature_flag = PGM_IO_experimental_features_enabled;
auto converter = PGM_IO_create_pgm_vnf_converter(handle, "", experimental_feature_flag);
auto* converter = PGM_IO_create_pgm_vnf_converter(handle, "", experimental_feature_flag);
CHECK(converter != nullptr);
PGM_IO_destroy_pgm_vnf_converter(converter);
PGM_IO_destroy_handle(handle);
Expand All @@ -40,13 +38,14 @@ TEST_CASE("Test PGM_IO_create_vnf_converter") {

TEST_CASE("Test PGM_IO_get_vnf_input_data") {
PGM_IO_Handle* handle = PGM_IO_create_handle();
PGM_IO_ExperimentalFeatures experimental_feature_flag = PGM_IO_experimental_features_enabled;
PGM_IO_ExperimentalFeatures const experimental_feature_flag = PGM_IO_experimental_features_enabled;

auto converter = PGM_IO_create_pgm_vnf_converter(handle, "", experimental_feature_flag);
auto* converter = PGM_IO_create_pgm_vnf_converter(handle, "", experimental_feature_flag);
CHECK(converter != nullptr);

auto json_result = PGM_IO_pgm_vnf_converter_get_input_data(handle, converter);
std::string_view json_string = R"({"version":"1.0","type":"input","is_batch":false,"attributes":{},"data":{}})";
auto const* const json_result = PGM_IO_pgm_vnf_converter_get_input_data(handle, converter);
std::string_view const json_string =
R"({"version":"1.0","type":"input","is_batch":false,"attributes":{},"data":{}})";
CHECK(json_string == json_result);

PGM_IO_destroy_pgm_vnf_converter(converter);
Expand Down
2 changes: 1 addition & 1 deletion tests/c_api_tests/test_entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN

#include <doctest/doctest.h>
#include <doctest/doctest.h> // NOLINT(misc-include-cleaner)
2 changes: 1 addition & 1 deletion tests/cpp_unit_tests/test_entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN

#include <doctest/doctest.h>
#include <doctest/doctest.h> // NOLINT(misc-include-cleaner)
21 changes: 13 additions & 8 deletions tests/cpp_unit_tests/test_pgm_vnf_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@
#include <power_grid_model_io_native/pgm_vnf_converter/pgm_vnf_converter.hpp>

#include <power_grid_model/auxiliary/dataset.hpp>
#include <power_grid_model/auxiliary/meta_data.hpp>
#include <power_grid_model/auxiliary/meta_gen/gen_getters.hpp>
#include <power_grid_model/auxiliary/meta_data_gen.hpp>
#include <power_grid_model/common/exception.hpp>
#include <power_grid_model/component/node.hpp>
#include <power_grid_model/container.hpp>

#include <cstring>
#include <doctest/doctest.h>

#include <ostream> // NOLINT(misc-include-cleaner) // Windows Clang-Tidy issue
#include <string>
#include <string_view>

namespace power_grid_model_io_native {

using enum ExperimentalFeatures;

std::string_view json_string = R"({"version":"1.0","type":"input","is_batch":false,"attributes":{},"data":{}})";
std::string_view const json_string = R"({"version":"1.0","type":"input","is_batch":false,"attributes":{},"data":{}})";

TEST_CASE("Test converter constructor") {
SUBCASE("Without experimental features") {
Expand All @@ -42,13 +47,13 @@ TEST_CASE("Test convert_input") {
}

TEST_CASE("Test create_const_dataset_from_container is callable") {
power_grid_model::Container<power_grid_model::Node> container;
power_grid_model::Container<power_grid_model::Node> const container{};
constexpr const auto& meta_data = power_grid_model::meta_data::meta_data_gen::meta_data;
CHECK_NOTHROW(create_const_dataset_from_container(container, meta_data));
}

TEST_CASE("Test serialize_data") {
power_grid_model::Container<power_grid_model::Node> container;
power_grid_model::Container<power_grid_model::Node> const container{};
constexpr const auto& meta_data = power_grid_model::meta_data::meta_data_gen::meta_data;
power_grid_model::ConstDataset const const_dataset = create_const_dataset_from_container(container, meta_data);
CHECK_NOTHROW(serialize_data(const_dataset));
Expand All @@ -58,7 +63,7 @@ TEST_CASE("Test serialize_data") {

TEST_CASE("Test setter/getter of file_buffer") {
auto converter = PgmVnfConverter("", experimental_features_enabled);
std::string_view value = "123";
std::string_view const value = "123";
converter.set_file_buffer(value);
auto file_buff = converter.get_file_buffer();
CHECK(file_buff == value);
Expand All @@ -72,7 +77,7 @@ TEST_CASE("Test setter/getter of deserialized_data") {

auto converter = PgmVnfConverter("", experimental_features_enabled);
converter.set_deserialized_dataset(&writable_dataset);
auto writable_dataset_after_getter = converter.get_deserialized_dataset();
auto* const writable_dataset_after_getter = converter.get_deserialized_dataset();
CHECK(&writable_dataset == writable_dataset_after_getter);
}

Expand Down
Loading