diff --git a/.travis.yml b/.travis.yml index a8ee1c4..d8e3fd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,19 @@ sudo: required -language: cpp env: - distribution: ubuntu - version: 16.04 - init: /sbin/init - run_opts: "" - distribution: fedora - version: 23 - init: /sbin/init - run_opts: "" + - distribution: arch + - distribution: debian-testing + - distribution: debian services: - docker before_install: - - sudo docker pull ${distribution}:${version} - - sudo docker build --rm=true --file=ci/${distribution}-${version}.docker --tag=${distribution}-${version}:jucipp ci + - ./ci/update_travis.sh script: - - container_id=$(mktemp) - - sudo docker run --detach --volume="${PWD}":/home/:rw ${run_opts} ${distribution}-${version}:jucipp "${init}" > "${container_id}" - - - sudo docker exec "$(cat ${container_id})" /home/ci/${distribution}-${version}.build - - - sudo docker stop "$(cat ${container_id})" \ No newline at end of file + - CXX=clang++ CC=clang ./ci/compile_container.sh + - ./ci/compile_container.sh + - ./ci/static_analysis.sh \ No newline at end of file diff --git a/ci/compile_container.sh b/ci/compile_container.sh new file mode 100755 index 0000000..87fac58 --- /dev/null +++ b/ci/compile_container.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +function linux () { + cd ci || exit + sudo rm ../build -rf + sudo docker run -it \ + -e "CXX=$CXX" \ + -e "CC=$CC" \ + -e "make_command=$make_command" \ + -e "cmake_command=$cmake_command" \ + -e "distribution=$distribution" \ + -v "$PWD/../:/jucipp" \ + --entrypoint="/jucipp/ci/entrypoint.sh" \ + "cppit/jucipp:$distribution" +} + +#TODO Should run compile/install instructions for osx +function osx () { + true +} + +$TRAVIS_OS_NAME diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh new file mode 100755 index 0000000..7107c5a --- /dev/null +++ b/ci/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ "${cmake_command}" == "" ]; then + cmake_command="cmake -DCMAKE_CXX_FLAGS=\"-Werror\" .." +fi + +if [ "${make_command}" == "" ]; then + make_command="make -j 2" +fi + +cd jucipp || exit +mkdir -p build && cd build || exit +sh -c "${cmake_command}" || exit +exec sh -c "${make_command}" \ No newline at end of file diff --git a/ci/fedora-23.build b/ci/fedora-23.build deleted file mode 100755 index 2a171e9..0000000 --- a/ci/fedora-23.build +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -cd /home && -mkdir build && -cd build && -cmake -DCMAKE_CXX_COMPILER=g++ .. && -make \ No newline at end of file diff --git a/ci/fedora-23.docker b/ci/fedora-23.docker deleted file mode 100644 index 79aa8d6..0000000 --- a/ci/fedora-23.docker +++ /dev/null @@ -1,3 +0,0 @@ -FROM fedora:23 - -RUN dnf install -y git cmake make gcc-c++ clang-devel clang lldb-devel boost-devel gtksourceviewmm3-devel gtkmm30-devel aspell-devel aspell-en \ No newline at end of file diff --git a/ci/static_analysis.sh b/ci/static_analysis.sh new file mode 100755 index 0000000..9c1ca86 --- /dev/null +++ b/ci/static_analysis.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +function linux () { + cd ci || exit + sudo docker run -it \ + -v "${PWD}/../:/jucipp/" \ + "cppit/jucipp:${distribution}" \ + sh -c "cd jucipp/build && scan-build -o ../html_${distribution} --status-bugs make" +} + +#TODO should do static analysis on build +function osx () { + true +} + +$TRAVIS_OS_NAME diff --git a/ci/ubuntu-16.04.build b/ci/ubuntu-16.04.build deleted file mode 100755 index 2a171e9..0000000 --- a/ci/ubuntu-16.04.build +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -cd /home && -mkdir build && -cd build && -cmake -DCMAKE_CXX_COMPILER=g++ .. && -make \ No newline at end of file diff --git a/ci/ubuntu-16.04.docker b/ci/ubuntu-16.04.docker deleted file mode 100644 index 17c9335..0000000 --- a/ci/ubuntu-16.04.docker +++ /dev/null @@ -1,4 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update -RUN apt-get install -y git cmake make g++ libclang-3.5-dev liblldb-3.5-dev clang-format-3.5 pkg-config libboost-filesystem-dev libboost-regex-dev libgtksourceviewmm-3.0-dev aspell-en libaspell-dev \ No newline at end of file diff --git a/ci/update_travis.sh b/ci/update_travis.sh new file mode 100755 index 0000000..8969bae --- /dev/null +++ b/ci/update_travis.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +function linux () { + sudo apt-get update + sudo apt-get purge lxc-docker + sudo apt-get install --yes --force-yes -o Dpkg::Options::="--force-confnew" linux-image-extra-$(uname -r) docker-engine + sudo service docker stop || exit + sudo rm -rf /var/lib/docker || exit + sudo service docker start || exit +} + +# TODO method should update osx, brew, packages etc needed for juCi++ +function osx () { + brew update + brew rm llvm + brew doctor + brew upgrade + brew install --with-clang --with-lldb llvm + brew install cmake pkg-config boost homebrew/x11/gtksourceviewmm3 aspell clang-format +} + +$TRAVIS_OS_NAME \ No newline at end of file