diff --git a/.travis.yml b/.travis.yml new file mode 120000 index 0000000..bcbff36 --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +package/ci/travis.yml \ No newline at end of file diff --git a/package/ci/codecov.yml b/package/ci/codecov.yml new file mode 100644 index 0000000..dbddb01 --- /dev/null +++ b/package/ci/codecov.yml @@ -0,0 +1,8 @@ +fixes: +# The src/python/magnum/__init__.py is copied to cmake's build dir together +# with # setup.py next to the C++ binaries and the test is done from here. +# Python's coverage.py reports an absolute path to it, which means a simple +# "build/src/python/::src/python/" won't suffice. This is hardcoded to Travis +# Linux and macOS build paths so let's hope these won't change. +- "/home/travis/build/mosra/magnum-bindings/build/src/python/::src/python/" +- "/Users/travis/build/mosra/magnum-bindings/build/src/python/::src/python/" diff --git a/package/ci/travis-desktop.sh b/package/ci/travis-desktop.sh new file mode 100755 index 0000000..d01893d --- /dev/null +++ b/package/ci/travis-desktop.sh @@ -0,0 +1,61 @@ +#!/bin/bash +set -ev + +# Corrade +git clone --depth 1 git://github.com/mosra/corrade.git +cd corrade +mkdir build && cd build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=$HOME/deps \ + -DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_DEPRECATED=$BUILD_DEPRECATED \ + -DWITH_INTERCONNECT=OFF \ + -DWITH_PLUGINMANAGER=OFF \ + -DWITH_TESTSUITE=OFF \ + -G Ninja +ninja install +cd ../.. + +# Magnum +git clone --depth 1 git://github.com/mosra/magnum.git +cd magnum +mkdir build && cd build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=$HOME/deps \ + -DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ + -DCMAKE_BUILD_TYPE=Release \ + -DWITH_AUDIO=OFF \ + -DWITH_DEBUGTOOLS=OFF \ + -DWITH_GL=OFF \ + -DWITH_MESHTOOLS=OFF \ + -DWITH_PRIMITIVES=OFF \ + -DWITH_SCENEGRAPH=OFF \ + -DWITH_SHADERS=OFF \ + -DWITH_TEXT=OFF \ + -DWITH_TEXTURETOOLS=OFF \ + -DWITH_TRADE=OFF \ + -DWITH_VK=OFF \ + -DBUILD_DEPRECATED=OFF \ + -G Ninja +ninja install +cd ../.. + +# Build the thing +mkdir build && cd build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=$HOME/deps \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$HOME/pybind11 \ + -DPYBIND11_PYTHON_VERSION=3.6 \ + -DWITH_PYTHON=ON \ + -G Ninja +ninja + +# Verify the setuptools install +cd src/python +python3 setup.py install --root="$TRAVIS_BUILD_DIR/install" --prefix=/usr + +# Run tests +cd ../../../src/python/magnum +coverage run -m unittest -v diff --git a/package/ci/travis.yml b/package/ci/travis.yml new file mode 100644 index 0000000..85d7ba7 --- /dev/null +++ b/package/ci/travis.yml @@ -0,0 +1,60 @@ +addons: + apt: + packages: + - g++-4.8 + - libgl1-mesa-dev + - ninja-build + +matrix: + include: + - language: python + python: 3.6 + os: linux + dist: xenial + compiler: gcc + env: + - JOBID=linux-gl + - language: cpp + os: osx + compiler: clang + env: + - JOBID=macos-gl + +notifications: + webhooks: + urls: + - https://webhooks.gitter.im/e/00ec7a9066bb0fec98f3 + on_success: change + on_failure: always + on_start: never + +cache: + directories: + - $HOME/cmake + - $HOME/pybind11 + +install: +- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX=g++-4.8; fi +# Download CMake 3.1.3 to ensure we're still compatible with it (Travis has +# 3.9 since December 2017). Also, the PATH setting can't be cached, so it's +# separate (bit me two times already). Android needs CMake 3.7, but +# https://gitlab.kitware.com/cmake/cmake/issues/17253 is fixed in 3.9.2, so +# grab that. FindVulkan is since 3.7, in that case just use the system package. +- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/cmake/bin" ]; then cd $HOME ; wget -nc --no-check-certificate https://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz && mkdir -p cmake && cd cmake && tar --strip-components=1 -xzf ../cmake-3.1.3-Linux-x86_64.tar.gz && cd $TRAVIS_BUILD_DIR ; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$HOME/cmake/bin:$PATH && cmake --version; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ninja; fi + +# Code coverage of python bindings +- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then pip3 install coverage codecov; fi + +# pybind11 (cached) +- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/pybind11/bin" ]; then wget -nc https://github.com/pybind/pybind11/archive/v2.2.4.tar.gz && tar -xzf v2.2.4.tar.gz && cd pybind11-2.2.4 && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/pybind11 -DPYBIND11_PYTHON_VERSION=3.6 -DPYBIND11_TEST=OFF -G Ninja && ninja install && cd $TRAVIS_BUILD_DIR; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install pybind11; fi + +script: +- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then ./package/ci/travis-desktop.sh; fi +# Travis somehow is not able to gather all output, try to force it using this +- sync + +after_success: +- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then cd src/python && codecov; fi