fix-testing #30
@@ -13,11 +13,12 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Building binary with make
|
||||
run: |
|
||||
sed -i '1s/^/#define TEST\n/' src/config/config.hpp && \
|
||||
echo "#define TEST" >> src/OpenRouter/OpenRouter.hpp && \
|
||||
make -j$(nproc)
|
||||
- name: Testing to run binary builded with make
|
||||
run: ./build/openrouter
|
||||
|
||||
|
||||
Prepare-Build-Testing-With-CMake:
|
||||
runs-on: alpine-sdk
|
||||
steps:
|
||||
@@ -29,6 +30,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Building binary with CMake
|
||||
run: |
|
||||
sed -i '1s/^/#define TEST\n/' src/config/config.hpp && \
|
||||
echo "#define TEST" >> src/OpenRouter/OpenRouter.hpp && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
@@ -36,7 +38,7 @@ jobs:
|
||||
make -j$(nproc)
|
||||
- name: Testing to run binary builded with CMake
|
||||
run: ./build/openrouter
|
||||
|
||||
|
||||
Prepare-Build-Testing-With-Meson:
|
||||
runs-on: alpine-sdk
|
||||
steps:
|
||||
@@ -48,8 +50,9 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Building binary with meson
|
||||
run: |
|
||||
sed -i '1s/^/#define TEST\n/' src/config/config.hpp && \
|
||||
echo "#define TEST" >> src/OpenRouter/OpenRouter.hpp && \
|
||||
meson setup build && \
|
||||
ninja -C build
|
||||
- name: Testing to run binary builded with meson
|
||||
run: ./build/openrouter
|
||||
run: ./build/openrouter
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
#include <ConfigManager.hpp>
|
||||
|
||||
namespace config {
|
||||
#ifdef TEST
|
||||
static ConfigManager config;
|
||||
#else
|
||||
static ConfigManager config(std::string("../config.json"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <httplib.h>
|
||||
#include <json.hpp>
|
||||
#include <syslog.h>
|
||||
#include <types.hpp>
|
||||
|
||||
inline void check_body_empty(const httplib::Request& request, httplib::Response& response, std::string required_string) {
|
||||
if (request.body.empty()) {
|
||||
|
||||
+1
-1
@@ -3,10 +3,10 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
OpenRouter::OpenRouter router;
|
||||
#ifdef TEST
|
||||
return 0;
|
||||
#else
|
||||
OpenRouter::OpenRouter router;
|
||||
return router.serve(
|
||||
config::config.getConfig()["server"]["ip"],
|
||||
config::config.getConfig()["server"]["port"]
|
||||
|
||||
Reference in New Issue
Block a user