Skip to content

Commit

Permalink
feat: adds a smoke test pipeline for specific component
Browse files Browse the repository at this point in the history
  • Loading branch information
lchico committed Sep 5, 2024
1 parent 251fc83 commit bb4edbf
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 25 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build_component_and_run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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:
compile:
runs-on: ubuntu-latest

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
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
2 changes: 1 addition & 1 deletion src/agent/agent_info/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
8 changes: 8 additions & 0 deletions src/agent/agent_info/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "wazuh-agent-mvp",
"version": "5.0.0",
"dependencies": [
"boost-uuid",
"sqlitecpp"
]
}
3 changes: 2 additions & 1 deletion src/agent/communicator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
12 changes: 12 additions & 0 deletions src/agent/communicator/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "wazuh-agent-mvp",
"version": "5.0.0",
"dependencies": [
"boost-asio",
"gtest",
"boost-beast",
"jwt-cpp",
"nlohmann-json",
"openssl"
]
}
2 changes: 1 addition & 1 deletion src/agent/multitype_queue/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
11 changes: 11 additions & 0 deletions src/agent/multitype_queue/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "wazuh-agent-mvp",
"version": "5.0.0",
"dependencies": [
"boost-asio",
"gtest",
"fmt",
"nlohmann-json",
"sqlitecpp"
]
}
48 changes: 26 additions & 22 deletions src/agent/sqlite_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
11 changes: 11 additions & 0 deletions src/agent/sqlite_manager/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "wazuh-agent-mvp",
"version": "5.0.0",
"dependencies": [
"boost-asio",
"gtest",
"fmt",
"nlohmann-json",
"sqlitecpp"
]
}

0 comments on commit bb4edbf

Please sign in to comment.