如何在Travis-CI中运行Gnome-Shell?

时间:2019-03-18 17:35:26

标签: travis-ci gnome-shell gnome-shell-extensions

如何在Travis-CI或类似的连续集成系统中运行简单的无头Gnome-Shell环境?

我正在尝试在Travis-CI中运行Gnome-Shell,以便为Gnome-Shell扩展运行一些集成测试。

我当前的方法是使用Xvfb,而我的.travis.yml如下:

dist: xenial
sudo: required
language: python
python: 2.7

install:
-   sudo apt-key update
-   sudo apt-get -yq update
-   sudo apt -yq install xvfb gnome-shell

before_script:
  - "export DISPLAY=:99.0"
  - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
  - sleep 3 # give xvfb some time to start
  - gnome-shell &
  - sleep 3 # give gnome-shell some time to start

script:
-   set -e
-   cd $TRAVIS_BUILD_DIR
-   make install
-   gnome-shell-extension-tool --enable-extension=myproject
-   sudo journalctl /usr/bin/gnome-shell|grep -i error

它到达失败并出现错误的最后一行:

(gnome-shell:8118): Gvc-WARNING **: Failed to connect context: Connection refused

此错误的原因是什么,我该如何解决?

0 个答案:

没有答案