fix: the whole workflow

This commit is contained in:
Tobias Reisinger 2019-09-08 14:28:50 +02:00
parent f3c03739ca
commit 71f7447f09
12 changed files with 13 additions and 374 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "drogon"]
path = drogon
url = https://github.com/an-tao/drogon.git

View file

@ -23,9 +23,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# link_libraries(${DROGON_LIBRARIES}) # link_libraries(${DROGON_LIBRARIES})
########## ##########
find_package(Drogon CONFIG REQUIRED) # find_package(Drogon CONFIG REQUIRED)
include_directories(${DROGON_INCLUDE_DIRS}) # include_directories(${DROGON_INCLUDE_DIRS})
link_libraries(${DROGON_LIBRARIES}) # link_libraries(${DROGON_LIBRARIES})
if(CMAKE_CXX_STANDARD LESS 17) if(CMAKE_CXX_STANDARD LESS 17)
#With C++14, use boost to support any and string_view #With C++14, use boost to support any and string_view
@ -59,3 +59,5 @@ endforeach()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(core ${SRC_DIR} ${CTL_SRC} ${FILTER_SRC} ${VIEWSRC} ${PLUGIN_SRC} ${MODEL_SRC} ${HELPER_SRC}) add_executable(core ${SRC_DIR} ${CTL_SRC} ${FILTER_SRC} ${VIEWSRC} ${PLUGIN_SRC} ${MODEL_SRC} ${HELPER_SRC})
add_subdirectory(drogon)
target_link_libraries(${PROJECT_NAME} PRIVATE drogon)

View file

@ -1,42 +0,0 @@
FROM ubuntu:18.04
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends software-properties-common \
sudo curl wget cmake make locales git gcc-8 g++-8 \
openssl libssl-dev libjsoncpp-dev uuid-dev zlib1g-dev libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8 \
&& cd /opt/ \
&& wget -qO- https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/6.0.0/flyway-commandline-6.0.0-linux-x64.tar.gz | tar xvz \
&& sudo chmod +x /opt/flyway-6.0.0/flyway \
&& sudo ln -s /opt/flyway-6.0.0/flyway /usr/local/bin
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
CC=gcc-8 \
CXX=g++-8 \
AR=gcc-ar-8 \
RANLIB=gcc-ranlib-8 \
IROOT=/install
ENV DROGON_ROOT=$IROOT/drogon \
CORE_ROOT=$IROOT/core
ADD https://api.github.com/repos/an-tao/drogon/git/refs/heads/master $IROOT/version.json
RUN git clone https://github.com/an-tao/drogon $DROGON_ROOT
COPY ./build_drogon.sh $DROGON_ROOT/build.sh
WORKDIR $DROGON_ROOT
RUN ./build.sh
COPY . $CORE_ROOT
WORKDIR $CORE_ROOT
RUN ./build.sh
WORKDIR /srv/core
EXPOSE 5000
ENTRYPOINT ["./core"]

View file

@ -1,36 +0,0 @@
current_dir="${PWD}"
#The folder in which we will build emgauwa
build_dir='./build'
if [ -d $build_dir ]; then
echo "Deleted folder: ${build_dir}"
rm -rf $build_dir
fi
#Create building folder
echo "Created building folder: ${build_dir}"
mkdir $build_dir
echo "Entering folder: ${build_dir}"
cd $build_dir
echo "Start building emgauwa ..."
cmake ..
#If errors then exit
if [ "$?" != "0" ]; then
exit -1
fi
make
#If errors then exit
if [ "$?" != "0" ]; then
exit -1
fi
cp core /bin/
mkdir /srv/core/
cp config.json /srv/core
cp core /srv/core/

View file

@ -1,57 +0,0 @@
#!/bin/bash
#build drogon
function build_drogon() {
#Update the submodule and initialize
git submodule update --init
#Save current directory
current_dir="${PWD}"
#The folder in which we will build drogon
build_dir='./build'
if [ -d $build_dir ]; then
echo "Deleted folder: ${build_dir}"
rm -rf $build_dir
fi
#Create building folder
echo "Created building folder: ${build_dir}"
mkdir $build_dir
echo "Entering folder: ${build_dir}"
cd $build_dir
echo "Start building drogon ..."
if [ $1 -eq 1 ]; then
cmake .. -DMAKETEST=YES
else
cmake .. -DBUILD_ORM=NO
fi
#If errors then exit
if [ "$?" != "0" ]; then
exit -1
fi
make
#If errors then exit
if [ "$?" != "0" ]; then
exit -1
fi
echo "Installing ..."
sudo make install
#Go back to the current directory
cd $current_dir
#Ok!
}
if [ "$1" = "-t" ]; then
build_drogon 1
else
build_drogon 0
fi

View file

@ -1,63 +0,0 @@
# Find jsoncpp
#
# Find the jsoncpp includes and library
#
# if you nee to add a custom library search path, do it via via CMAKE_PREFIX_PATH
#
# This module defines
# JSONCPP_INCLUDE_DIRS, where to find header, etc.
# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
# JSONCPP_FOUND, If false, do not try to use jsoncpp.
# JSONCPP_INCLUDE_PREFIX, include prefix for jsoncpp
# only look in default directories
find_path(
JSONCPP_INCLUDE_DIR
NAMES jsoncpp/json/json.h json/json.h
DOC "jsoncpp include dir"
)
find_library(
JSONCPP_LIBRARY
NAMES jsoncpp
DOC "jsoncpp library"
)
set(JSONCPP_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIR})
set(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
# debug library on windows
# same naming convention as in qt (appending debug library with d)
# boost is using the same "hack" as us with "optimized" and "debug"
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
find_library(
JSONCPP_LIBRARY_DEBUG
NAMES jsoncppd
DOC "jsoncpp debug library"
)
set(JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARIES} debug ${JSONCPP_LIBRARY_DEBUG})
endif()
# find JSONCPP_INCLUDE_PREFIX
find_path(
JSONCPP_INCLUDE_PREFIX
NAMES json.h
PATH_SUFFIXES jsoncpp/json json
)
if (${JSONCPP_INCLUDE_PREFIX} MATCHES "jsoncpp")
set(JSONCPP_INCLUDE_PREFIX "jsoncpp")
set(JSONCPP_INCLUDE_DIRS "${JSONCPP_INCLUDE_DIRS}/jsoncpp")
else()
set(JSONCPP_INCLUDE_PREFIX "")
endif()
# handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE
# if all listed variables are TRUE, hide their existence from configuration view
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(jsoncpp DEFAULT_MSG
JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)
mark_as_advanced (JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)

View file

@ -1,37 +0,0 @@
# Copyright (C) 2007-2009 LuaDist.
# Created by Peter Kapec <kapecp@gmail.com>
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Note:
# Searching headers and libraries is very simple and is NOT as powerful as scripts
# distributed with CMake, because LuaDist defines directories to search for.
# Everyone is encouraged to contact the author with improvements. Maybe this file
# becomes part of CMake distribution sometimes.
# - Find sqlite3
# Find the native SQLITE3 headers and libraries.
#
# SQLITE3_INCLUDE_DIRS - where to find sqlite3.h, etc.
# SQLITE3_LIBRARIES - List of libraries when using sqlite.
# SQLITE3_FOUND - True if sqlite found.
# Look for the header file.
FIND_PATH(SQLITE3_INCLUDE_DIR NAMES sqlite3.h)
# Look for the library.
FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3)
# Handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
# Copy the results to the output variables.
IF(SQLITE3_FOUND)
SET(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
SET(SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
ELSE(SQLITE3_FOUND)
SET(SQLITE3_LIBRARIES)
SET(SQLITE3_INCLUDE_DIRS)
ENDIF(SQLITE3_FOUND)
MARK_AS_ADVANCED(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)

View file

@ -1,119 +0,0 @@
# - Try to find UUID
# Once done this will define
#
# UUID_FOUND - system has UUID
# UUID_INCLUDE_DIRS - the UUID include directory
# UUID_LIBRARIES - Link these to use UUID
# UUID_DEFINITIONS - Compiler switches required for using UUID
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
# in cache already
set(UUID_FOUND TRUE)
else (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
find_path(UUID_INCLUDE_DIR
NAMES
uuid.h
PATH_SUFFIXES
uuid
HINTS
${UUID_DIR}/include
$ENV{UUID_DIR}/include
$ENV{UUID_DIR}
${DELTA3D_EXT_DIR}/inc
$ENV{DELTA_ROOT}/ext/inc
$ENV{DELTA_ROOT}
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/usr/include/gdal
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
find_library(UUID_LIBRARY
NAMES
uuid ossp-uuid
HINTS
${UUID_DIR}/lib
$ENV{UUID_DIR}/lib
$ENV{UUID_DIR}
${DELTA3D_EXT_DIR}/lib
$ENV{DELTA_ROOT}/ext/lib
$ENV{DELTA_ROOT}
$ENV{OSG_ROOT}/lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
find_library(UUID_LIBRARY_DEBUG
NAMES
uuidd
HINTS
${UUID_DIR}/lib
$ENV{UUID_DIR}/lib
$ENV{UUID_DIR}
${DELTA3D_EXT_DIR}/lib
$ENV{DELTA_ROOT}/ext/lib
$ENV{DELTA_ROOT}
$ENV{OSG_ROOT}/lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
if (NOT UUID_LIBRARY AND BSD)
set(UUID_LIBRARY "")
endif(NOT UUID_LIBRARY AND BSD)
set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
set(UUID_LIBRARIES ${UUID_LIBRARY})
if (UUID_INCLUDE_DIRS)
if (BSD OR UUID_LIBRARIES)
set(UUID_FOUND TRUE)
endif (BSD OR UUID_LIBRARIES)
endif (UUID_INCLUDE_DIRS)
if (UUID_FOUND)
if (NOT UUID_FIND_QUIETLY)
message(STATUS "Found UUID: ${UUID_LIBRARIES}")
endif (NOT UUID_FIND_QUIETLY)
else (UUID_FOUND)
if (UUID_FIND_REQUIRED)
message(FATAL_ERROR "Could not find UUID")
endif (UUID_FIND_REQUIRED)
endif (UUID_FOUND)
# show the UUID_INCLUDE_DIRS and UUID_LIBRARIES variables only in the advanced view
mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)
endif (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)

View file

@ -1,16 +0,0 @@
version: '3.2'
volumes:
v-core-data:
services:
core:
image: registry.gitlab.com/emgauwa/core
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "80:5000"
volumes:
- type: volume
source: v-core-data
target: /srv/core

1
drogon Submodule

@ -0,0 +1 @@
Subproject commit 195bc5299e73a5f93c65cd336c49a9a013b934bd

View file

@ -33,7 +33,7 @@ main()
int rc; int rc;
/* Open database */ /* Open database */
rc = sqlite3_open("test.db", &globals::db); rc = sqlite3_open("core.sqlite", &globals::db);
if( rc ) { if( rc ) {
LOG_FATAL << "Can't open database: " << sqlite3_errmsg(globals::db); LOG_FATAL << "Can't open database: " << sqlite3_errmsg(globals::db);

View file

@ -12,10 +12,13 @@ version_num=$sqlite_return;
while [ -f sql/migration_$version_num.sql ] while [ -f sql/migration_$version_num.sql ]
do do
echo "sql/migration_$version_num.sql";
sqlite3 core.sqlite < sql/migration_$version_num.sql; sqlite3 core.sqlite < sql/migration_$version_num.sql;
((version_num++)); ((version_num++));
done; done;
echo "New Schemaversion: $version_num";
if [ $sqlite_return -eq 0 ] if [ $sqlite_return -eq 0 ]
then then
sqlite3 core.sqlite "INSERT INTO meta (version_num) VALUES ($version_num); "; sqlite3 core.sqlite "INSERT INTO meta (version_num) VALUES ($version_num); ";