diff --git a/.travis.yml b/.travis.yml index 9f31906..e96ee6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -48,19 +49,20 @@ 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" @@ -68,10 +70,10 @@ before_deploy: #- 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 81d6674..556b9d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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) @@ -70,4 +40,4 @@ if (DOXYGEN_FOUND) COMMENT "Generating API documentation with Doxygen") unset(DOXYFILE) endif() -##### + diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 08eacf4..51a994b 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -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) diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 1db0473..927d717 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -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 ) #**************************************************************************************************** diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt new file mode 100644 index 0000000..2df14d0 --- /dev/null +++ b/src/tests/CMakeLists.txt @@ -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})