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

CI/CD: Add build GitHub Actions workflows #52

Closed
wants to merge 7 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BasedOnStyle: Microsoft
Language: Cpp
InsertNewlineAtEOF: true
77 changes: 77 additions & 0 deletions .github/workflows/build-on-change-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build framework on Linux

on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- master
- develop # can be removed on master merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**

# execute on every push made targeting the branches bellow
push:
branches:
- master
- develop # can be removed on master merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**

jobs:
build-linux:
runs-on: ubuntu-22.04
environment: Build
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: |
echo Installing dev_essentials...
git clone https://github.com/cariad-tech/dev_essential.git
cd dev_essentials

echo Installing google test...
USERNAME=$whoami
cmake -H. -B"/home/$USERNAME/dev_essential/build" \
-G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/home/$USERNAME/dev_essential/install" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build "/home/USERNAME/dev_essential/build" \
--target install \
--config RelWithDebInfo
git clone https://github.com/google/googletest.git -b release-1.10.0
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install

echo Installing Qt...
sudo apt update
sudo apt install \
qtbase5-dev \
libqt5xmlpatterns5-dev \
libxerces-c-dev \
pkg-config

echo Dependencies installed.
shell: bash

- name: Build framework
run: |
echo Building framework...
USERNAME=$whoami
cmake -G "Unix Makefiles" -B./build -S . -DCMAKE_INSTALL_PREFIX="/home/$USERNAME/qc-build" \
-DENABLE_FUNCTIONAL_TESTS=ON -DXERCES_ROOT="/usr" \
-DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \
-DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/" \
-Ddev_essential_DIR="/home/danivex/dev_essential/install/lib/cmake/dev_essential"
cmake --build ./build --target install --config Release -j4
cmake --install ./build
echo Done.
shell: bash
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)

add_definitions( -DDEV_ESSENTIAL_DISABLE_MAKE_RESULT_CHECK_RESERVED_ZERO=1 -DDEV_ESSENTIAL_DISABLE_DEPRECATED_WARNINGS=1)

file(STRINGS version QC4OPENX_VERSION LIMIT_COUNT 1)
project(qc4openx VERSION ${QC4OPENX_VERSION})

Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ install(
xosc_examples
DESTINATION
examples
)
)
37 changes: 19 additions & 18 deletions examples/checker_bundle_example/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

#include "main.h"

#include "common/result_format/cChecker.h"
#include "common/result_format/cCheckerBundle.h"
#include "common/result_format/cParameterContainer.h"
#include "common/result_format/cResultContainer.h"
#include "common/result_format/c_checker.h"
#include "common/result_format/c_checker_bundle.h"
#include "common/result_format/c_parameter_container.h"
#include "common/result_format/c_result_container.h"

#include "common/config_format/cConfiguration.h"
#include "common/config_format/cConfigurationCheckerBundle.h"
#include "common/config_format/c_configuration.h"
#include "common/config_format/c_configuration_checker_bundle.h"

// Main Programm
int main(int argc, char* argv[])
int main(int argc, char *argv[])
{
std::string strToolpath = argv[0];

Expand Down Expand Up @@ -70,11 +70,12 @@ int main(int argc, char* argv[])
inputParams.Overwrite(configuration.GetParams());

// We search for parameters applied to our configuration.
cConfigurationCheckerBundle* checkerBundleConfig = configuration.GetCheckerBundleByName(CHECKER_BUNDLE_NAME);
cConfigurationCheckerBundle *checkerBundleConfig = configuration.GetCheckerBundleByName(CHECKER_BUNDLE_NAME);
if (nullptr != checkerBundleConfig)
inputParams.Overwrite(checkerBundleConfig->GetParams());
else
std::cerr << "No configuration for module '" << CHECKER_BUNDLE_NAME << "' found. Start with default params." << std::endl;
std::cerr << "No configuration for module '" << CHECKER_BUNDLE_NAME << "' found. Start with default params."
<< std::endl;
}
else if (StringEndsWith(ToLower(strFilepath), "--defaultconfig"))
{
Expand All @@ -96,7 +97,7 @@ int main(int argc, char* argv[])
return 0;
}

void ShowHelp(const std::string& toolPath)
void ShowHelp(const std::string &toolPath)
{
std::string applicationName = toolPath;
std::string applicationNameWithoutExt = toolPath;
Expand All @@ -106,27 +107,27 @@ void ShowHelp(const std::string& toolPath)
std::cout << "\n\nUsage of " << applicationNameWithoutExt << ":" << std::endl;
std::cout << "\nRun the application with xodr file: \n" << applicationName << " sample.xodr" << std::endl;
std::cout << "\nRun the application with dbqa configuration: \n" << applicationName << " config.xml" << std::endl;
std::cout << "\nRun the application and write empty report as default configuration: \n" << applicationName << " --defaultconfig" << std::endl;
std::cout << "\nRun the application and write empty report as default configuration: \n"
<< applicationName << " --defaultconfig" << std::endl;
std::cout << "\n\n";
}

void RunChecks(const cParameterContainer& inputParams)
void RunChecks(const cParameterContainer &inputParams)
{
// Now we define a result container which contains our results.
cResultContainer pResultContainer;

// Lets go on with the checker bundle. A bundle contains 0 or more checks.
cCheckerBundle* pExampleCheckerBundle = new cCheckerBundle(CHECKER_BUNDLE_NAME);
cCheckerBundle *pExampleCheckerBundle = new cCheckerBundle(CHECKER_BUNDLE_NAME);

// Add the checkerBundle to our results. You can do it later as well.
pResultContainer.AddCheckerBundle(pExampleCheckerBundle);

// Create a checker with a factory in the checker bundle
cChecker* pExampeChecker = pExampleCheckerBundle->CreateChecker("exampleChecker", "This is a description");
cChecker *pExampeChecker = pExampleCheckerBundle->CreateChecker("exampleChecker", "This is a description");

// Lets add now an issue
pExampeChecker->AddIssue(new cIssue("This is an information from the demo usecase",
INFO_LVL));
pExampeChecker->AddIssue(new cIssue("This is an information from the demo usecase", INFO_LVL));

// Lets add a summary for the checker bundle
unsigned int issueCount = pExampleCheckerBundle->GetIssueCount();
Expand All @@ -146,7 +147,7 @@ void RunChecks(const cParameterContainer& inputParams)
void WriteEmptyReport()
{
cResultContainer emptyReport;
cCheckerBundle* pCheckerBundle = new cCheckerBundle(CHECKER_BUNDLE_NAME);
cCheckerBundle *pCheckerBundle = new cCheckerBundle(CHECKER_BUNDLE_NAME);

emptyReport.AddCheckerBundle(pCheckerBundle);

Expand All @@ -164,4 +165,4 @@ void WriteEmptyReport()
emptyReport.WriteResults(ssReportFile.str());

std::cout << "Finished." << std::endl;
}
}
36 changes: 18 additions & 18 deletions examples/checker_bundle_example/src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
class cParameterContainer;

/**
* Main function for application
*
* @param [in] argc Number of arguments in shell
* @param [in] argv Pointer to arguments
*
* @return The standard return value
*/
int main(int argc, char* argv[]);
* Main function for application
*
* @param [in] argc Number of arguments in shell
* @param [in] argv Pointer to arguments
*
* @return The standard return value
*/
int main(int argc, char *argv[]);

/**
* Shows the help for the application
* @param [in] applicationName The name of the application
*/
void ShowHelp(const std::string& applicationName);
* Shows the help for the application
* @param [in] applicationName The name of the application
*/
void ShowHelp(const std::string &applicationName);

/**
* Runs the checks
*/
void RunChecks(const cParameterContainer& inputParams);
* Runs the checks
*/
void RunChecks(const cParameterContainer &inputParams);

/*
* Writes an empty Report
*/
void WriteEmptyReport();
* Writes an empty Report
*/
void WriteEmptyReport();
4 changes: 2 additions & 2 deletions examples/checker_bundle_example/src/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#ifndef _STD_AFX_
#define _STD_AFX_

#include <sstream>
#include <fstream>
#include <memory>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <sstream>

#endif // _STD_INCLUDES_HEADER_FEP_XODR_MANIPULATION_
29 changes: 14 additions & 15 deletions examples/viewer_example/viewer_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
* with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#include "viewer/iConnector.h"
#include "common/result_format/cIssue.h"
#include "common/result_format/cLocationsContainer.h"
#include <stdio.h>
#include "common/result_format/c_issue.h"
#include "common/result_format/c_locations_container.h"
#include "viewer/i_connector.h"
#include <cstring>
#include <stdio.h>

const char* lasterrormsg = "";
const char *lasterrormsg = "";

bool StartViewer()
{
std::cout << "START VIEWER EXAMPLE" << std::endl;
return true;
}

bool Initialize(const char* xoscPath, const char* xodrPath)
bool Initialize(const char *xoscPath, const char *xodrPath)
{
if (std::strcmp(xoscPath, "")==0 && std::strcmp(xodrPath,"")==0)
if (std::strcmp(xoscPath, "") == 0 && std::strcmp(xodrPath, "") == 0)
{
lasterrormsg = "ERROR: No valid xosc or xodr file found.";
return false;
Expand All @@ -32,23 +32,23 @@ bool Initialize(const char* xoscPath, const char* xodrPath)
return true;
}

bool AddIssue(void* issueToAdd)
bool AddIssue(void *issueToAdd)
{
auto issue = static_cast<cIssue*>(issueToAdd);
auto issue = static_cast<cIssue *>(issueToAdd);
std::cout << "ADD ISSUE: " << issue->GetDescription() << std::endl;
return true;
}

bool ShowIssue(void * itemToShow, void* locationToShow)
bool ShowIssue(void *itemToShow, void *locationToShow)
{
auto issue = static_cast<cIssue*>(itemToShow);
auto location = static_cast<cLocationsContainer*>(locationToShow);
auto issue = static_cast<cIssue *>(itemToShow);
auto location = static_cast<cLocationsContainer *>(locationToShow);
std::cout << "SHOW ISSUE: " << issue->GetDescription() << std::endl;
std::cout << "LOCATION: " << location->GetDescription() << std::endl;
return true;
}

const char* GetName()
const char *GetName()
{
return "Viewer Example";
}
Expand All @@ -59,8 +59,7 @@ bool CloseViewer()
return true;
}

const char* GetLastErrorMessage()
const char *GetLastErrorMessage()
{
return lasterrormsg;
}

Loading
Loading