diff --git a/.travis.yml b/.travis.yml index fe6575f2..067ec3de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,77 @@ notifications: irc: irc.freenode.org#vdebug slack: secure: BksygPSsoRfvre27w6XQN9ooKB9C1n83Bw96YurvyDHJ6BYM2Gv9fW1Sj6NHpB8MQkMaJ+9gRiBSflkP+l80t3EXAdStuI/8EM/wZu1ov6bmYT/hYQ8HnULmmPNj8uVzsX13VGEUC/YY4osWuJFM1wh61dStoF+SKrpslqWCV4w= -language: python -env: - matrix: - - DISTRO: 'ubuntu:16.04' - - DISTRO: 'debian:9' -before_install: - - docker run --rm -d --name vdebug-distro-test -v $(pwd):/travis $DISTRO tail -f /dev/null - - docker ps -install: - - |- - docker exec -t vdebug-distro-test bash -c "apt-get update && apt-get install -y sudo vim-gtk3 xvfb python3 python3-pip ruby-dev gcc make automake libtool php-cli php-xdebug locales && gem install bundler && pip3 install coverage && echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen && echo 'LANG=en_US.UTF-8' > /etc/default/locale && useradd -u $(id -u) -M -s /bin/bash -d /travis travis && echo '%travis ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/travis" - - docker exec -t vdebug-distro-test su - travis -c "bundle install" -script: - - docker exec -t vdebug-distro-test su - travis -c "coverage run -m unittest discover && coverage report -m --include='python3/vdebug/*'" - - docker exec -t vdebug-distro-test su - travis -c "xvfb-run bundle exec rake spec features" + +language: minimal +dist: xenial +matrix: + include: + - os: linux + env: DOCKER=false + - os: linux + env: DOCKER=true DISTRO=debian:9 + - os: osx + language: minimal + env: DOCKER=false + +before_install: | + set -e + if $DOCKER; then + docker run --rm -d --name vdebug-distro-test -v $(pwd):/travis $DISTRO tail -f /dev/null + docker ps + fi + +install: | + set -e + if [[ $TRAVIS_OS_NAME = osx ]]; then + #brew update + brew install neovim + pip3 install coverage + bundle install --path vendor/bundle + elif $DOCKER; then + docker exec --env=DEBIAN_FRONTEND=noninteractive vdebug-distro-test apt-get update + # Vim, php, xdebug, bundler and coverage are needed to run the tests. + # Xvfb is needed to use the server feature of vim without a running X + # server (which is needed for some tests). The locales package is used to + # set things up inside the container. + docker exec --env=DEBIAN_FRONTEND=noninteractive vdebug-distro-test apt-get install --no-install-recommends -y vim-gtk3 php-cli php-xdebug bundler python3-coverage xvfb locales xauth + # By default the locale inside the container is latin1. For consistent + # tests we want to use utf8. + docker exec vdebug-distro-test sh -c 'echo en_US.UTF-8 UTF-8 >> /etc/locale.gen' + docker exec vdebug-distro-test sh -c 'echo LANG=en_US.UTF-8 > /etc/default/locale' + docker exec vdebug-distro-test locale-gen + docker exec vdebug-distro-test useradd -u $(id -u) -M -s /bin/bash -d /travis travis + # We are currently on docker 17.09 and the --workdir option for exec was + # only introduced in 17.12. Therefore we have to use the shell with cd. + docker exec -u travis vdebug-distro-test sh -c 'cd /travis && bundle install --path vendor/bundle' + else + sudo apt-get update + sudo apt-get install --no-install-recommends -y vim-gtk3 php-cli php-xdebug bundler python3-coverage xvfb + bundle install --path vendor/bundle + fi + +script: | + set -e + if [[ $TRAVIS_OS_NAME = osx ]]; then + coverage3 run -m unittest discover + coverage3 report -m --include="python3/vdebug/*" + bundle exec rake features + bundle exec rake spec + elif $DOCKER; then + # The tests have to be run with su(1) to get the right value for $LANG. + # If docker is used to switch the user and just run sh(1) the locale setup + # from above is not picked up. + docker exec vdebug-distro-test su - travis -c 'python3-coverage run -m unittest discover' + docker exec vdebug-distro-test su - travis -c 'python3-coverage report -m --include="python3/vdebug/*"' + docker exec vdebug-distro-test su - travis -c 'xvfb-run bundle exec rake features' + # The spec/startup_spec.rb test fails randomly on travis so we execute it + # last so all other tests will run first. It seems that some of the + # failures result from the xvfb from above no releasing the display fast + # enough: https://stackoverflow.com/a/8880717 + docker exec vdebug-distro-test su - travis -c 'xvfb-run --auto-servernum bundle exec rake spec' + else + python3-coverage run -m unittest discover + python3-coverage report -m --include="python3/vdebug/*" + xvfb-run bundle exec rake features + xvfb-run --auto-servernum bundle exec rake spec + fi diff --git a/Gemfile b/Gemfile index dbcbb584..bc67b59a 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,3 @@ gem 'rake', '~> 10.0.4' gem 'rspec', '~> 2.13.0' gem 'vimrunner', '~> 0.3.0' gem 'cucumber' -gem 'travis'