diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-08 05:59:35 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-08 06:11:16 +0300 |
commit | 3978096b231c73088287176e78c330eb4ad896ff (patch) | |
tree | 48f9dc58bbf08c076feee96d89d6a56c83f763cd | |
parent | fix server/Dockerfile (diff) | |
download | math-server-3978096b231c73088287176e78c330eb4ad896ff.tar.gz math-server-3978096b231c73088287176e78c330eb4ad896ff.zip |
add Travis config
-rw-r--r-- | .travis.yml | 16 | ||||
-rw-r--r-- | .travis/.gitattributes | 1 | ||||
-rwxr-xr-x | .travis/build.sh | 24 | ||||
-rwxr-xr-x | .travis/build_boost.sh | 49 |
4 files changed, 90 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..66ba91c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: cpp +os: linux +dist: bionic + +env: + global: + - boost_version=1.71.0 + matrix: + - build_type=debug arch=x64 + - build_type=release arch=x64 + +before_script: + - ./.travis/build_boost.sh + +script: + - ./.travis/build.sh diff --git a/.travis/.gitattributes b/.travis/.gitattributes new file mode 100644 index 0000000..dfdb8b7 --- /dev/null +++ b/.travis/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=lf diff --git a/.travis/build.sh b/.travis/build.sh new file mode 100755 index 0000000..f3ad8c8 --- /dev/null +++ b/.travis/build.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail -o xtrace + +readonly boost_fs="boost_${boost_version//\./_}" +readonly boost_dir="$HOME/$boost_fs" +readonly boost_librarydir="$boost_dir/stage/$arch/$build_type/lib" + +readonly build_dir="$HOME/build" + +main() { + mkdir -p -- "$build_dir" + cd -- "$build_dir" + cmake \ + -D "CMAKE_BUILD_TYPE=$build_type" \ + -D "CMAKE_CXX_STANDARD_LIBRARIES=-lpthread" \ + -D "BOOST_ROOT=$boost_dir" \ + -D "BOOST_LIBRARYDIR=$boost_librarydir" \ + -D Boost_USE_STATIC_LIBS=ON \ + "$TRAVIS_BUILD_DIR" + cmake --build . -- -j +} + +main diff --git a/.travis/build_boost.sh b/.travis/build_boost.sh new file mode 100755 index 0000000..9c757a5 --- /dev/null +++ b/.travis/build_boost.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail -o xtrace + +readonly boost_fs="boost_${boost_version//\./_}" +readonly boost_url="https://dl.bintray.com/boostorg/release/$boost_version/source/$boost_fs.tar.gz" +readonly boost_dir="$HOME/$boost_fs" + +address_model=32 +[ "$arch" = x64 ] && address_model=64 +readonly address_model + +clean() { + cd -- "$HOME/" +} + +download() { + trap clean RETURN + wget -- "$boost_url" + tar xzvf "$boost_fs.tar.gz" > /dev/null +} + +bootstrap() { + trap clean RETURN + cd -- "$boost_dir" + ./bootstrap.sh +} + +build() { + trap clean RETURN + cd -- "$boost_dir" + ./b2 \ + "address-model=$address_model" \ + link=static \ + variant="$build_type" \ + "--stagedir=stage/$arch/$build_type" \ + --with-filesystem \ + --with-program_options \ + --with-test +} + +main() { + clean + download + bootstrap + build +} + +main |