diff --git a/.github/workflows/build_component_and_run_tests.yml b/.github/workflows/build_component_and_run_tests.yml new file mode 100644 index 0000000000..d0cb2f7451 --- /dev/null +++ b/.github/workflows/build_component_and_run_tests.yml @@ -0,0 +1,55 @@ +run-name: Components - Build ${{ inputs.components }} +name: Build and Run Tests + +on: + workflow_dispatch: + inputs: + source_reference: + description: | + Branch from wazuh/wazuh-agent repository to use. + required: true + components: + description: 'Select agent components/s to tested' + required: true + type: choice + - agent_info + - communicator + - configuration_parser + - multitype_queue + - sqlite_manager + + workflow_call: + inputs: + source_reference: + type: string + required: true + components: + type: string + required: true + +jobs: + Build-component-and-test: + runs-on: ubuntu-latest + timeout-minutes: 10 + name: Build ${{ inputs.components }} + + steps: + - name: Checkout wazuh/wazuh-agent repository + uses: actions/checkout@v4 + with: + repository: wazuh/wazuh-agent + ref: ${{ inputs.source_reference }} + + - name: Build component + run: | + ls + git submodule update --init --recursive + cd src/agent/${{ inputs.components }} + mkdir build && cd build + cmake .. -DBUILD_TESTS=ON + make + + - name: Run the tests + run: | + cd src/agent/${{ inputs.components }}/build && ctest -V + diff --git a/src/agent/agent_info/CMakeLists.txt b/src/agent/agent_info/CMakeLists.txt index 203ad0dea1..16166f1954 100644 --- a/src/agent/agent_info/CMakeLists.txt +++ b/src/agent/agent_info/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.22) set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../../vcpkg/scripts/buildsystems/vcpkg.cmake") -set(VCPKG_MANIFEST_DIR ${CMAKE_SOURCE_DIR}/../../) +set(VCPKG_MANIFEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/) project(AgentInfo) diff --git a/src/agent/agent_info/vcpkg.json b/src/agent/agent_info/vcpkg.json new file mode 100644 index 0000000000..a514a305c2 --- /dev/null +++ b/src/agent/agent_info/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "wazuh-agent-mvp", + "version": "5.0.0", + "dependencies": [ + "boost-uuid", + "sqlitecpp" + ] +} diff --git a/src/agent/communicator/CMakeLists.txt b/src/agent/communicator/CMakeLists.txt index e08eb39d5f..24abf6e399 100644 --- a/src/agent/communicator/CMakeLists.txt +++ b/src/agent/communicator/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.22) set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../../vcpkg/scripts/buildsystems/vcpkg.cmake") -set(VCPKG_MANIFEST_DIR ${CMAKE_SOURCE_DIR}/../../) +set(VCPKG_MANIFEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/) + project(Communicator) diff --git a/src/agent/communicator/vcpkg.json b/src/agent/communicator/vcpkg.json new file mode 100644 index 0000000000..46c7716823 --- /dev/null +++ b/src/agent/communicator/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "wazuh-agent-mvp", + "version": "5.0.0", + "dependencies": [ + "boost-asio", + "gtest", + "boost-beast", + "jwt-cpp", + "nlohmann-json", + "openssl" + ] +} diff --git a/src/agent/multitype_queue/CMakeLists.txt b/src/agent/multitype_queue/CMakeLists.txt index d6eb396be8..1526a3aa85 100644 --- a/src/agent/multitype_queue/CMakeLists.txt +++ b/src/agent/multitype_queue/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.22) set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../../vcpkg/scripts/buildsystems/vcpkg.cmake") -set(VCPKG_MANIFEST_DIR ${CMAKE_SOURCE_DIR}/../../) +set(VCPKG_MANIFEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/) project(MultiTypeQueue LANGUAGES CXX) diff --git a/src/agent/multitype_queue/vcpkg.json b/src/agent/multitype_queue/vcpkg.json new file mode 100644 index 0000000000..b5dcfe1647 --- /dev/null +++ b/src/agent/multitype_queue/vcpkg.json @@ -0,0 +1,11 @@ +{ + "name": "wazuh-agent-mvp", + "version": "5.0.0", + "dependencies": [ + "boost-asio", + "gtest", + "fmt", + "nlohmann-json", + "sqlitecpp" + ] +} diff --git a/src/agent/sqlite_manager/CMakeLists.txt b/src/agent/sqlite_manager/CMakeLists.txt index 91c031e92e..64937a3d31 100644 --- a/src/agent/sqlite_manager/CMakeLists.txt +++ b/src/agent/sqlite_manager/CMakeLists.txt @@ -1,22 +1,26 @@ -cmake_minimum_required(VERSION 3.22) - -set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../../vcpkg/scripts/buildsystems/vcpkg.cmake") -set(VCPKG_MANIFEST_DIR ${CMAKE_SOURCE_DIR}/../../) - -project(SQLiteManager) - -include(../../cmake/CommonSettings.cmake) -set_common_settings() - -find_package(fmt REQUIRED) -find_package(SQLiteCpp REQUIRED) - -add_library(SQLiteManager src/sqlite_manager.cpp) -configure_target(SQLiteManager) -target_include_directories(SQLiteManager PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${SQLiteCpp_INCLUDE_DIRS}) -target_link_libraries(SQLiteManager PUBLIC SQLiteCpp PRIVATE fmt::fmt) - -if(BUILD_TESTS) - enable_testing() - add_subdirectory(tests) -endif() +cmake_minimum_required(VERSION 3.22) + +set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../../vcpkg/scripts/buildsystems/vcpkg.cmake") +set(VCPKG_MANIFEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/) + +project(SQLiteManager) + +include(../../cmake/CommonSettings.cmake) +set_common_settings() + + +find_package(fmt REQUIRED) +find_package(SQLiteCpp REQUIRED) + +add_library(SQLiteManager src/sqlite_manager.cpp) + +include(../../cmake/ConfigureTarget.cmake) +configure_target(SQLiteManager) + +target_include_directories(SQLiteManager PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${SQLiteCpp_INCLUDE_DIRS}) +target_link_libraries(SQLiteManager PUBLIC SQLiteCpp PRIVATE fmt::fmt) + +if(BUILD_TESTS) + enable_testing() + add_subdirectory(tests) +endif() diff --git a/src/agent/sqlite_manager/vcpkg.json b/src/agent/sqlite_manager/vcpkg.json new file mode 100644 index 0000000000..3601b5eb39 --- /dev/null +++ b/src/agent/sqlite_manager/vcpkg.json @@ -0,0 +1,11 @@ +{ + "name": "wazuh-agent-mvp", + "version": "5.0.0", + "dependencies": [ + "boost-asio", + "gtest", + "fmt", + "nlohmann-json", + "sqlitecpp" + ] +}