diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6f94297 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +# Enable C++ support +language: cpp +# OS +sudo: required +dist: trusty +# Compiler selection +compiler: + - clang + - gcc +# Build steps +script: ./make-ci.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bf6030..1af9b9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ if (tests) add_executable(test_redox test/test.cpp) target_include_directories(test_redox PUBLIC ${GTEST_INCLUDE_DIRS}) - target_link_libraries(test_redox redox gtest) + target_link_libraries(test_redox redox ${GTEST_BOTH_LIBRARIES}) # So that we can run 'make test' add_test(test_redox test_redox) @@ -149,7 +149,7 @@ if (examples) add_executable(binary_data_publish examples/binary_data_publish.cpp) target_link_libraries(binary_data_publish redox) - + add_executable(pub_sub examples/pub_sub.cpp) target_link_libraries(pub_sub redox) diff --git a/README.md b/README.md index d45bf21..596c3d8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ redox ====== Modern, asynchronous, and wicked fast C++11 client for Redis +[![Build Status](https://travis-ci.org/hmartiro/redox.svg?branch=feature%2Ftravis-ci)] +(https://travis-ci.org/hmartiro/redox) Redox is a C++ interface to the [Redis](http://redis.io/) key-value store that makes it easy to write applications diff --git a/make-ci.sh b/make-ci.sh new file mode 100755 index 0000000..7553e4d --- /dev/null +++ b/make-ci.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Build script for continuous integration +set -ev +env | sort + +# Install packages +sudo apt-get update +sudo apt-get install -y libhiredis-dev libev-dev libgtest-dev redis-server + +# Clean +rm -rf build +mkdir build +cd build + +# Make gtest +git clone https://github.com/google/googletest +cd googletest +mkdir build +cd build +cmake -DBUILD_GMOCK=OFF -DBUILD_GTEST=ON -DBUILD_SHARED_LIBS=ON .. +time make +cd ../.. +sudo cp googletest/build/googletest/libg* /usr/local/lib/ +sudo cp -r googletest/googletest/include/gtest /usr/local/include + +# Make redox +cmake -Dexamples=ON -Dlib=ON -Dstatic_lib=ON -Dtests=ON .. +time make VERBOSE=1 + +# Test redox +sudo service redis-server restart +./test_redox +cd .. diff --git a/make.sh b/make.sh index febe16a..d88d0ed 100755 --- a/make.sh +++ b/make.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash mkdir -p build && cd build && cmake .. && diff --git a/test/test.cpp b/test/test.cpp index cbafca5..f18eb73 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -20,8 +20,9 @@ #include +#include + #include "redox.hpp" -#include "gtest/gtest.h" namespace {