Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
travis_test
Browse files Browse the repository at this point in the history
  • Loading branch information
k-morozov committed Aug 3, 2020
2 parents 60b3f34 + ad58ab3 commit d106f95
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 59 deletions.
36 changes: 19 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ script:
- cd ${TRAVIS_BUILD_DIR}/build
- cmake ..
- cmake --build .
- cmake --build . --target test
- cd ${TRAVIS_BUILD_DIR}/build/bin
- tar -cf AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar server client
#- cmake --build . --target package
Expand All @@ -48,30 +49,31 @@ after_success:
fi
deploy:
provider: script
skip_cleanup: true
script:
- curl -T ${TRAVIS_BUILD_DIR}/build/bin/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar -uk-morozov:$BINTRAY_API_KEY https://api.bintray.com/content/k-morozov/AppChat/Download/0.7.$TRAVIS_BUILD_NUMBER/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar
on:
- provider: script
skip_cleanup: true
script:
- curl -T ${TRAVIS_BUILD_DIR}/build/bin/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar -uk-morozov:$BINTRAY_API_KEY https://api.bintray.com/content/k-morozov/AppChat/Download/0.7.$TRAVIS_BUILD_NUMBER/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar
on:
branch: master

- provider: pages
skip-cleanup: true
github-token: $GITHUB_API_KEY
keep-history: true
local-dir: docs/html
on:
branch: master
#provider: pages
#skip-cleanup: true
#github-token: $GITHUB_API_KEY
#keep-history: true
#local-dir: docs/html
#on:
#branch: master

before_deploy:
- git config --local user.name "k-morozov"
- git config --local user.email "[email protected]"
#- export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%d%m')-$TRAVIS_BUILD_NUMBER-Linux}
- git tag 0.7.$TRAVIS_BUILD_NUMBER-Linux
deploy:
provider: releases
api_key: $GITHUB_API_KEY
file: AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar
skip_cleanup: true
on:
- provider: releases
api_key: $GITHUB_API_KEY
file: AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar
skip_cleanup: true
on:
branch: release

38 changes: 4 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,17 @@ set (Boost_USE_MULTITHREADED ON)
#****************************************************************************************************
set(SRC src)
set(LIB lib)
set(Tests ${SRC}/tests/)
set(TESTS_BIN tests)

set(PROTOCOL_LIB_NAME protocol_lib)
set(LOGGER_LIB_NAME logger_lib)
set(STORAGE_LIB_NAME sqlite_db)
set(BACKTRACE_LIB_NAME backtrace)
set(TRACEDEXCEPTION_LIB_NAME tracedexception_lib)
#****************************************************************************************************
set(TESTS_SOURSES
${Tests}/startup_tests.cpp
${Tests}/test_request.cpp
${Tests}/test_response.cpp
${Tests}/test_datetime.cpp
)

#****************************************************************************************************
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#****************************************************************************************************
add_executable(${TESTS_BIN} ${TESTS_SOURSES})
enable_testing()

add_subdirectory(${SRC}/server)
add_subdirectory(${SRC}/client)
Expand All @@ -36,31 +28,9 @@ add_subdirectory(${LIB}/log)
add_subdirectory(${LIB}/storage)
add_subdirectory(${LIB}/libbacktrace)
add_subdirectory(${LIB}/traced_exception)
add_subdirectory(${SRC}/tests)

target_include_directories(${TESTS_BIN} PUBLIC ${SRC})
#****************************************************************************************************
set_target_properties(${TESTS} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
LINK_LIBRARIES pthread
COMPILE_OPTIONS "-std=c++17;-O2;-Wall;-Wextra;-Wpedantic"
)

#****************************************************************************************************
enable_testing()
include_directories(${GTEST_INCLUDE_DIR})

#****************************************************************************************************
find_package(Boost COMPONENTS system date_time filesystem program_options regex thread graph REQUIRED)
find_package (Threads)
find_package(GTest REQUIRED)
find_library(UnitTests gtest)
#****************************************************************************************************

target_link_libraries (${TESTS_BIN} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${UnitTests} ${PROTOCOL_LIB_NAME})
#****************************************************************************************************

##### Documentation
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYFILE ${CMAKE_SOURCE_DIR}/Doxyfile)
Expand All @@ -70,4 +40,4 @@ if (DOXYGEN_FOUND)
COMMENT "Generating API documentation with Doxygen")
unset(DOXYFILE)
endif()
#####

7 changes: 6 additions & 1 deletion src/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.5)
project(Client)

if (DEFINED ENV{TRAVIS_BUILD_NUMBER})
project(Client VERSION 0.0.$ENV{TRAVIS_BUILD_NUMBER})
else ()
project(Client VERSION 0.0.1)
endif ()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
14 changes: 7 additions & 7 deletions src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ set (Boost_USE_MULTITHREADED ON)
add_definitions(-DBOOST_STACKTRACE_USE_BACKTRACE)

set(SERVER_BIN server)
set(Connection_dir connection)
set(Channel_dir channel)
set(DIR_CONNECTION connection)
set(DIR_CHANNEL channel)

#****************************************************************************************************
set(CHANNELS_SRC
${Channel_dir}/iroom.h ${Channel_dir}/iroom.cpp
${Channel_dir}/channels_manager.h ${Channel_dir}/channels_manager.cpp
${Channel_dir}/channel.h ${Channel_dir}/channel.cpp
${DIR_CHANNEL}/iroom.h ${DIR_CHANNEL}/iroom.cpp
${DIR_CHANNEL}/channels_manager.h ${DIR_CHANNEL}/channels_manager.cpp
${DIR_CHANNEL}/channel.h ${DIR_CHANNEL}/channel.cpp
)
set(CONNECTIONS_SRC
${Connection_dir}/isubscriber.h ${Connection_dir}/isubscriber.cpp
${Connection_dir}/connection.h ${Connection_dir}/connection.cpp
${DIR_CONNECTION}/isubscriber.h ${DIR_CONNECTION}/isubscriber.cpp
${DIR_CONNECTION}/connection.h ${DIR_CONNECTION}/connection.cpp
)

#****************************************************************************************************
Expand Down
34 changes: 34 additions & 0 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.5)
project(Tests)

set(TESTS_BIN tests)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

#****************************************************************************************************
set(TESTS_SOURSES
startup_tests.cpp
test_request.cpp
test_response.cpp
test_datetime.cpp
)

#****************************************************************************************************
set_target_properties(${TESTS} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
LINK_LIBRARIES pthread
COMPILE_OPTIONS "-std=c++17;-O2;-Wall;-Wextra;-Wpedantic"
)
#****************************************************************************************************
add_executable(${TESTS_BIN} ${TESTS_SOURSES})
target_include_directories(${TESTS_BIN} PUBLIC .)
include_directories(${GTEST_INCLUDE_DIR})
find_package(GTest REQUIRED)
find_library(UnitTests gtest)
#****************************************************************************************************

target_link_libraries (${TESTS_BIN} ${CMAKE_THREAD_LIBS_INIT} ${UnitTests} ${PROTOCOL_LIB_NAME})

0 comments on commit d106f95

Please sign in to comment.