Skip to content
Snippets Groups Projects
Commit 4badb8b5 authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Use docker image for managing deps

parent e2d971d1
No related branches found
No related tags found
No related merge requests found
......@@ -7,26 +7,3 @@ if [ $TRAVIS_OS_NAME == osx ]; then
brew upgrade boost cmake
brew install libsodium
fi
if [ $TRAVIS_OS_NAME == linux ]; then
export CXX=${CXX_VERSION}
export CC=${CC_VERSION}
sudo apt-get update -qq
sudo apt-get remove -y cmake
# Build & install libsodium for source.
mkdir -p libsodium && pushd libsodium
curl -L \
https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VERSION}.tar.gz \
-o libsodium-${LIBSODIUM_VERSION}.tar.gz
tar xfz libsodium-${LIBSODIUM_VERSION}.tar.gz
pushd libsodium-${LIBSODIUM_VERSION}/
./configure && make && make check && sudo make install
popd
popd
wget https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh
sudo sh cmake-3.11.4-Linux-x86_64.sh --skip-license --prefix=/usr/local
export PATH="/usr/local/bin:$PATH"
fi
......@@ -11,29 +11,30 @@ if [ $TRAVIS_OS_NAME == linux ]; then
sudo update-alternatives --set gcc "/usr/bin/${CC_VERSION}"
sudo update-alternatives --set g++ "/usr/bin/${CXX_VERSION}"
fi
# Build dependencies.
cmake -Hdeps -B.deps -DCMAKE_BUILD_TYPE=Release \
-DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \
-DUSE_BUNDLED_GTEST=${TESTS}
cmake --build .deps
# Build the library.
cmake -H. -Bbuild -DOPENSSL_ROOT_DIR=${OPENSLL_ROOT_DIR} \
-DBUILD_LIB_TESTS=${TESTS} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=.deps/usr \
-DCOVERAGE=${COVERAGE} || true
cmake --build build
# Unit & Integration tests
if [ $TESTS == ON ]; then
make synapse
# Build the library.
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug \
-DBUILD_LIB_TESTS=ON \
-DBUILD_SHARED_LIBS=ON \
-DCOVERAGE=${COVERAGE} || true
cmake --build build
make test
fi
# Linting
if [ $LINT == ON ]; then
if [ $TRAVIS_OS_NAME == osx ]; then
# Build dependencies.
cmake -Hdeps -B.deps -DCMAKE_BUILD_TYPE=Release \
-DUSE_BUNDLED_BOOST=OFF \
-DUSE_BUNDLED_GTEST=OFF
cmake --build .deps
# Build the library.
cmake -H. -Bbuild -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DBUILD_LIB_TESTS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=.deps/usr || true
cmake --build build
make lint
fi
......@@ -10,47 +10,36 @@ services:
notifications:
email: false
before_cache:
# Save tagged docker images
- >
mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
| xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'
cache:
directories:
- $HOME/docker
matrix:
include:
- os: osx
osx_image: xcode9
compiler: clang
env:
- OPENSLL_ROOT_DIR=/usr/local/opt/openssl
- TESTS=OFF
- USE_BUNDLED_BOOST=OFF
- os: linux
compiler: gcc
env:
- CXX_VERSION=g++-8
- CC_VERSION=gcc-8
- TESTS=ON
- COVERAGE=ON
- USE_BUNDLED_BOOST=ON
- LIBSODIUM_VERSION=1.0.16
addons:
apt:
sources:
- "ubuntu-toolchain-r-test"
packages:
- "g++-8"
- "lcov"
- os: linux
compiler: clang
env:
- CXX_VERSION=clang++-6.0
- CC_VERSION=clang-6.0
- TESTS=ON
- USE_BUNDLED_BOOST=ON
- LIBSODIUM_VERSION=1.0.16
addons:
apt:
sources:
- "ubuntu-toolchain-r-test"
- "llvm-toolchain-trusty-6.0"
packages:
- "clang++-6.0"
- "clang-6.0"
before_install:
# Load cached docker images
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
install:
- ./.ci/install.sh
......@@ -59,10 +48,33 @@ script:
- $CXX --version
- cmake --version
- ./.ci/script.sh
# Start the synapse server to run the tests.
- if [ $TRAVIS_OS_NAME == linux ]; then make synapse; fi
# Build the lib and run the test suite against synapse.
- |
if [ $TRAVIS_OS_NAME == linux ]; then
docker run -v `pwd`:/build --net=host \
-e CXX_VERSION=${CXX_VERSION} \
-e CC_VERSION=${CC_VERSION} \
-e COVERAGE=${COVERAGE} \
-e TRAVIS_OS_NAME=${TRAVIS_OS_NAME} \
mujx/mtxclient-dev:0.1.0 \
/bin/bash -c "./.ci/script.sh"
fi
# Build the lib and run the linter.
- |
if [ $TRAVIS_OS_NAME == osx ]; then
./.ci/script.sh
fi
after_success:
# Generate coverage report and upload report to CodeCov.
- if [ $COVERAGE == ON ]; then make -C build/tests matrix_client_coverage; fi
- if [ $COVERAGE == ON ]; then ./.ci/coverage.sh; fi
- if [ $COVERAGE == ON ]; then bash <(curl -s https://codecov.io/bash) -f "!*tests*" || echo "Codecov failed"; fi
- |
if [ $COVERAGE == ON ]; then
docker run -v `pwd`:/build \
--net=host mujx/mtxclient-dev:0.1.0 \
/bin/bash -c "./.ci/coverage.sh" && \
bash <(curl -s https://codecov.io/bash) -f "!*tests*" || echo "Codecov failed"
fi
enable_testing()
file(COPY fixtures DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
find_package(GTest REQUIRED)
file(COPY fixtures DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment