Skip to content
Snippets Groups Projects
Commit 8f4b4610 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Don't run build in docker

parent da3107c5
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ lcov --directory . --capture --output-file coverage.info ...@@ -10,6 +10,7 @@ lcov --directory . --capture --output-file coverage.info
# Filter out external code. # Filter out external code.
lcov --remove coverage.info \ lcov --remove coverage.info \
'/usr/*' \ '/usr/*' \
'*/.deps/*' \
'*tests*' \ '*tests*' \
--output-file coverage.info --output-file coverage.info
......
...@@ -2,6 +2,45 @@ ...@@ -2,6 +2,45 @@
set -ex set -ex
CMAKE_VERSION=3.15.5
CMAKE_SHORT_VERSION=3.15
if [ $TRAVIS_OS_NAME == linux ]; then
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends apt-transport-https software-properties-common curl ninja-build
# cmake
curl https://cmake.org/files/v${CMAKE_SHORT_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh -o cmake-install.sh
sudo bash cmake-install.sh --skip-license --prefix=/usr/local
export PATH="/usr/local/bin:$PATH"
# Toolchains
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main"
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
pkg-config \
make \
clang++-6.0 \
clang-6.0 \
g++-8 \
unzip git \
libssl-dev \
openssl
mkdir -p build-libsodium
( cd build-libsodium
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz -o libsodium-1.0.17.tar.gz
tar xfz libsodium-1.0.17.tar.gz
cd libsodium-1.0.17/
./configure && make && sudo make install )
mkdir -p build-lcov
( cd build-lcov
curl -L http://downloads.sourceforge.net/ltp/lcov-1.14.tar.gz -o lcov-1.14.tar.gz
tar xfz lcov-1.14.tar.gz
cd lcov-1.14/
sudo make install )
fi
if [ $TRAVIS_OS_NAME == osx ]; then if [ $TRAVIS_OS_NAME == osx ]; then
brew update || true brew update || true
brew upgrade boost || true brew upgrade boost || true
......
...@@ -5,6 +5,9 @@ set -ex ...@@ -5,6 +5,9 @@ set -ex
if [ $TRAVIS_OS_NAME == linux ]; then if [ $TRAVIS_OS_NAME == linux ]; then
export CXX=${CXX_VERSION} export CXX=${CXX_VERSION}
export CC=${CC_VERSION} export CC=${CC_VERSION}
export PATH="/usr/local/bin:$PATH"
cmake --version
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/${CC_VERSION} 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/${CC_VERSION} 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/${CXX_VERSION} 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/${CXX_VERSION} 10
...@@ -14,17 +17,20 @@ if [ $TRAVIS_OS_NAME == linux ]; then ...@@ -14,17 +17,20 @@ if [ $TRAVIS_OS_NAME == linux ]; then
sudo update-alternatives --set g++ "/usr/bin/${CXX_VERSION}" sudo update-alternatives --set g++ "/usr/bin/${CXX_VERSION}"
sudo update-alternatives --set gcov "/usr/bin/gcov-8" sudo update-alternatives --set gcov "/usr/bin/gcov-8"
# Build dependencies.
cmake -GNinja -Hdeps -B.deps -DCMAKE_BUILD_TYPE=Debug
cmake --build .deps
# Build the library. # Build the library.
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug \ cmake -GNinja -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug \
-DBUILD_LIB_TESTS=ON \ -DBUILD_LIB_TESTS=ON \
-DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=.deps/usr \
-DCOVERAGE=${COVERAGE} || true -DCOVERAGE=${COVERAGE} || true
cmake --build build cmake --build build
# The tests will run anyway during coverage. # The tests will run anyway during coverage.
if [ $COVERAGE != ON ]; then make test
make test
fi
fi fi
if [ $TRAVIS_OS_NAME == osx ]; then if [ $TRAVIS_OS_NAME == osx ]; then
......
...@@ -21,21 +21,19 @@ matrix: ...@@ -21,21 +21,19 @@ matrix:
- CXX_VERSION=g++-8 - CXX_VERSION=g++-8
- CC_VERSION=gcc-8 - CC_VERSION=gcc-8
- CMAKE_GENERATOR=Ninja - CMAKE_GENERATOR=Ninja
- COVERAGE=ON
- os: linux - os: linux
compiler: clang compiler: clang
env: env:
- CXX_VERSION=clang++-6.0 - CXX_VERSION=clang++-6.0
- CC_VERSION=clang-6.0 - CC_VERSION=clang-6.0
- CMAKE_GENERATOR=Ninja - CMAKE_GENERATOR=Ninja
- COVERAGE=ON
install: cache:
- | directories:
if [ "$TRAVIS_OS_NAME" = "linux" ]; then - .deps
docker build -t nheko-reborn/mtxclient -f Dockerfile .
fi
- ./.ci/install.sh install: ./.ci/install.sh
script: script:
- $CXX --version - $CXX --version
...@@ -44,30 +42,13 @@ script: ...@@ -44,30 +42,13 @@ script:
# Start the synapse server to run the tests. # Start the synapse server to run the tests.
- if [ $TRAVIS_OS_NAME == linux ]; then make synapse; fi - if [ $TRAVIS_OS_NAME == linux ]; then make synapse; fi
# Build the lib and run the test suite against synapse. # Build the lib and run the linter & tests.
- | - ./.ci/script.sh
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} \
nheko-reborn/mtxclient \
/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: after_success:
# Generate coverage report and upload report to CodeCov. # Generate coverage report and upload report to CodeCov.
- | - |
if [ $COVERAGE == ON ]; then if [ "$COVERAGE" == ON ]; then
docker run -v `pwd`:/build \ ./.ci/coverage.sh && \
--net=host nheko-reborn/mtxclient \ bash <(curl -s https://codecov.io/bash) -f build/coverage.info || echo "Codecov failed"
/bin/bash -c "make -C build -j1 test && ./.ci/coverage.sh" && \
bash <(curl -s https://codecov.io/bash) -f "!*tests*" || echo "Codecov failed"
fi fi
...@@ -39,14 +39,6 @@ if(ASAN) ...@@ -39,14 +39,6 @@ if(ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
endif() endif()
if(COVERAGE)
include(CodeCoverage)
add_custom_target(ctest COMMAND ${CMAKE_CTEST_COMMAND})
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
setup_target_for_coverage(test_coverage ctest coverage)
endif()
if(NOT MSVC AND NOT APPLE) if(NOT MSVC AND NOT APPLE)
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
...@@ -181,6 +173,20 @@ if(NOT MSVC AND NOT APPLE) ...@@ -181,6 +173,20 @@ if(NOT MSVC AND NOT APPLE)
target_link_libraries(matrix_client PUBLIC Threads::Threads) target_link_libraries(matrix_client PUBLIC Threads::Threads)
endif() endif()
if(COVERAGE)
include(CodeCoverage)
add_custom_target(ctest COMMAND ${CMAKE_CTEST_COMMAND})
target_compile_options(matrix_client PUBLIC
-O0 # no optimization
-g # generate debug info
--coverage # sets all required flags
-fprofile-arcs -ftest-coverage # just to be sure, for clang!
)
target_link_options(matrix_client PUBLIC --coverage)
setup_target_for_coverage(test_coverage ctest coverage)
endif()
if(IWYU) if(IWYU)
find_program(iwyu_path NAMES include-what-you-use iwyu) find_program(iwyu_path NAMES include-what-you-use iwyu)
if(iwyu_path) if(iwyu_path)
......
...@@ -35,8 +35,8 @@ option(USE_EXISTING_SRC_DIR ...@@ -35,8 +35,8 @@ option(USE_EXISTING_SRC_DIR
include(ExternalProject) include(ExternalProject)
if(USE_BUNDLED_BOOST) if(USE_BUNDLED_BOOST)
# bundled boost is 1.68, which requires CMake 3.12 or greater. # bundled boost is 1.70, which requires CMake 3.15 or greater.
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.15)
endif() endif()
set(BOOST_URL set(BOOST_URL
......
...@@ -13,7 +13,7 @@ ExternalProject_Add( ...@@ -13,7 +13,7 @@ ExternalProject_Add(
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}/json BUILD_COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}/json
INSTALL_COMMAND make install INSTALL_COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}/json --target install
) )
list(APPEND THIRD_PARTY_DEPS Json) list(APPEND THIRD_PARTY_DEPS Json)
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