Skip to content

Commit

Permalink
Merge pull request wazuh#24664 from wazuh/11334-dev-new-wazuh-engine
Browse files Browse the repository at this point in the history
Wazuh engine feature complete phase 1
  • Loading branch information
Dwordcito authored Jul 26, 2024
2 parents dac6a4e + 86e06cc commit 0e22fa6
Show file tree
Hide file tree
Showing 1,499 changed files with 301,020 additions and 1 deletion.
71 changes: 71 additions & 0 deletions .github/workflows/engine_health_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Engine Health Test

# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the engine base branch and with changes in the src/engine/ directory.
pull_request:
types:
- ready_for_review
- synchronize
paths:
- 'src/engine/**'

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# Ensures only one instance of this workflow is running per PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
BUILD_TYPE: Release
ENGINE_DIR: ${{github.workspace}}/src/engine

jobs:
build:
name: Engine Health Test

# Runs only if the PR status is different to Draft
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Cache CMake and ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
# Install behave
run: |
pip install ${{env.ENGINE_DIR}}/tools/api-communication/
pip install ${{env.ENGINE_DIR}}/test/integration_tests/it-utils/
pip install ${{env.ENGINE_DIR}}/tools/engine-suite/
- name: Configure CMake
# Configure the CMake build system with the specified build type
run: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{env.ENGINE_DIR}} -B ${{env.ENGINE_DIR}}/build

- name: Build
# Build the specified target using CMake
run: cmake --build ${{env.ENGINE_DIR}}/build --config ${{env.BUILD_TYPE}} --target main -j2

- name: Setup environment
# Set Engine Configuration
run: python3 ${{env.ENGINE_DIR}}/test/setupEnvironment.py -e /tmp/actions

- name: Initial state
run: python3 ${{env.ENGINE_DIR}}/test/health_test/initialState.py -e /tmp/actions

- name: Health Test
# Run integration tests using behave
run: python3 ${{env.ENGINE_DIR}}/test/health_test/run.py -e /tmp/actions
70 changes: 70 additions & 0 deletions .github/workflows/engine_helper_functions_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Engine Helper Functions Test

# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the engine base branch and with changes in the src/engine/ directory.
pull_request:
types:
- ready_for_review
- synchronize
paths:
- 'src/engine/**'

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# Ensures only one instance of this workflow is running per PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
BUILD_TYPE: Release
ENGINE_DIR: ${{github.workspace}}/src/engine

jobs:
build:
name: Engine Helper Functions Test

# Runs only if the PR status is different to Draft
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Cache CMake and ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
pip install ${{env.ENGINE_DIR}}/tools/api-communication/
pip install ${{env.ENGINE_DIR}}/test/integration_tests/it-utils/
pip install ${{env.ENGINE_DIR}}/tools/engine-suite/
pip install ${{env.ENGINE_DIR}}/test/helper_tests/engine_helper_test
- name: Configure CMake
# Configure the CMake build system with the specified build type
run: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{env.ENGINE_DIR}} -B ${{env.ENGINE_DIR}}/build

- name: Build
# Build the specified target using CMake
run: cmake --build ${{env.ENGINE_DIR}}/build --config ${{env.BUILD_TYPE}} --target main -j2

- name: Setup environment
# Set Engine Configuration
run: python3 ${{env.ENGINE_DIR}}/test/setupEnvironment.py -e /tmp/actions

- name: Initial state
run: engine-helper-test-initial-state -e /tmp/actions -b ${{env.ENGINE_DIR}}/build/main --mmdb ${{env.ENGINE_DIR}}/test/helper_tests/mmdb/ --conf ${{env.ENGINE_DIR}}/test/helper_tests/configuration_files/general.conf

- name: Helper Functions Test
run: engine-helper-test-generate-runner -e /tmp/actions -b ${{env.ENGINE_DIR}}/build/main -i ${{env.ENGINE_DIR}}/test/helper_tests/helpers_description/ -o /tmp/output/
72 changes: 72 additions & 0 deletions .github/workflows/engine_integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Engine Integration Test

# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the engine base branch and with changes in the src/engine/ directory.
pull_request:
types:
- ready_for_review
- synchronize
paths:
- 'src/engine/**'

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# Ensures only one instance of this workflow is running per PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
BUILD_TYPE: Release
ENGINE_DIR: ${{github.workspace}}/src/engine

jobs:
build:
name: Engine Integration Test

# Runs only if the PR status is different to Draft
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Cache CMake and ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
# Install behave
run: |
pip install ${{env.ENGINE_DIR}}/tools/api-communication/
pip install ${{env.ENGINE_DIR}}/test/integration_tests/it-utils/
pip install ${{env.ENGINE_DIR}}/tools/engine-suite/
pip install behave
- name: Configure CMake
# Configure the CMake build system with the specified build type
run: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{env.ENGINE_DIR}} -B ${{env.ENGINE_DIR}}/build

- name: Build
# Build the specified target using CMake
run: cmake --build ${{env.ENGINE_DIR}}/build --config ${{env.BUILD_TYPE}} --target main -j2

- name: Setup environment
# Set Engine Configuration
run: python3 ${{env.ENGINE_DIR}}/test/setupEnvironment.py -e /tmp/actions

- name: Initial state
run: python3 ${{env.ENGINE_DIR}}/test/integration_tests/initialState.py -e /tmp/actions

- name: Integration Test
# Run integration tests using behave
run: python3 ${{env.ENGINE_DIR}}/test/integration_tests/run.py -e /tmp/actions
53 changes: 53 additions & 0 deletions .github/workflows/engine_unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Engine Unit Test

# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the engine base branch and with changes in the src/engine/ directory.
pull_request:
types:
- ready_for_review
- synchronize
paths:
- 'src/engine/**'

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# Ensures only one instance of this workflow is running per PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
BUILD_TYPE: Release
ENGINE_DIR: ${{github.workspace}}/src/engine

jobs:
build:
name: Engine Unit Test

# Runs only if the PR status is different to Draft
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Cache CMake and ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}

- name: Configure CMake
# Configure the CMake build system with the specified build type
run: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{env.ENGINE_DIR}} -B ${{env.ENGINE_DIR}}/build

- name: Build
# Build the specified target using CMake
run: cmake --build ${{env.ENGINE_DIR}}/build --config ${{env.BUILD_TYPE}} --target all -j2

- name: Unit Test
# Run unit tests using CTest
working-directory: ${{env.ENGINE_DIR}}/build
run: ctest -C ${{env.BUILD_TYPE}} -T test --output-on-failure -j2
4 changes: 4 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
it under the terms of the GNU General Public License (version 2) as
published by the FSF - Free Software Foundation.

Files in src/engine, dedicated to the Wazuh Engine, have a different
copyright and are distributed under the AGPLv3 license. See LICENSE-engine
and COPYING-engine for more details.

In addition, certain source files in this program permit linking with the
OpenSSL library (http://www.openssl.org), which otherwise wouldn't be allowed
under the GPL. For purposes of identifying OpenSSL, most source files giving
Expand Down
50 changes: 50 additions & 0 deletions src/engine/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
...
AccessModifierOffset: '-4'
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignConsecutiveMacros: 'true'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: 'true'
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ColumnLimit: 120
Cpp11BracedListStyle: 'true'
FixNamespaceComments: 'true'
IncludeBlocks: Preserve
IndentCaseLabels: 'true'
IndentWidth: '4'
PointerAlignment: Left
SortIncludes: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
Standard: Auto
TabWidth: '4'
UseTab: Never
---
Language: Proto
DisableFormat: false
Loading

0 comments on commit 0e22fa6

Please sign in to comment.