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

Add workflow to build Agent #79

Merged
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
31 changes: 22 additions & 9 deletions .github/actions/compile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ inputs:
runs:
using: "composite"
steps:
- name: Compile
- name: Generate CMake project
run: |
SRC_FOLDER=$(pwd)/src

VERSION=$(cat src/VERSION)
echo $VERSION
REVISION=$(cat src/REVISION)
echo $REVISION
SRC_FOLDER=$(pwd)/${{ inputs.path }}

cd ${{ inputs.path }}
mkdir -p build && cd build
cmake -DSRC_FOLDER=${SRC_FOLDER} -DVERSION="$VERSION" -DREVISION="$REVISION" .. && make -j2
cmake ${SRC_FOLDER} -DBUILD_TESTS=1 -G "Unix Makefiles"
echo "CMake project generated in $(pwd)"
shell: bash

- name: Compile
run: |
cd build
if [ ! -f CMakeCache.txt ]; then
echo "CMake cache not found in $(pwd). Aborting."
exit 1
fi
cmake --build .
shell: bash

- name: Run Tests
continue-on-error: true
run: |
set +e
cd build
ctest || echo "Tests failed, but continuing"
shell: bash
27 changes: 27 additions & 0 deletions .github/workflows/compile_and_run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Compile and Run Tests

on:
push:
branches:
- '**'
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
compile:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Run Compile Action
uses: ./.github/actions/compile
with:
path: src/
6 changes: 3 additions & 3 deletions src/agent/agent_queue/tests/queue_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ TEST_F(QueueTest, PushMultipleGetMultipleWithModule)
int i = 0;
for (auto singleMessage : messagesReceived)
{
EXPECT_EQ("content " + std::to_string(++i), singleMessage.data.at("data"));
EXPECT_EQ("content " + std::to_string(++i), singleMessage.data.at("data").get<std::string>());
}

EXPECT_EQ(0, queue.storedItems(MessageType::STATELESS, "fakemodule"));
Expand All @@ -471,8 +471,8 @@ TEST_F(QueueTest, PushSinglesleGetMultipleWithModule)
for (auto singleMessage : messagesReceived)
{
auto val = ++i;
EXPECT_EQ("content-" + std::to_string(val), singleMessage.data.at("data"));
EXPECT_EQ("module-" + std::to_string(val), singleMessage.data.at("module"));
EXPECT_EQ("content-" + std::to_string(val), singleMessage.data.at("data").get<std::string>());
EXPECT_EQ("module-" + std::to_string(val), singleMessage.data.at("module").get<std::string>());
}

auto messageReceivedContent1 = queue.getNextN(MessageType::STATELESS, 10, "module-1");
Expand Down
2 changes: 1 addition & 1 deletion src/agent/agent_queue/tests/sqlitestorage_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TEST_F(SQLiteStorageTest, RetrieveMultipleMessagesWithModule)
int i = 0;
for (auto singleMessage : retrievedMessages)
{
EXPECT_EQ("value" + std::to_string(++i), singleMessage.at("data").at("key"));
EXPECT_EQ("value" + std::to_string(++i), singleMessage.at("data").at("key").get<std::string>());
}
}

Expand Down
Loading