2017-09-01 97 views
1

我正在使用Electron構建使用JavaScript的跨平臺應用程序。雖然讓Travis CI能夠成功構建,但我遇到了一些麻煩。電子應用程序Travis CI構建失敗

docs on setting it up說,我.travis.yml應類似於此:

addons: 
    apt: 
    packages: 
     - xvfb 

install: 
    - export DISPLAY=':99.0' 
    - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & 

我現在.travis.yml看起來是這樣的:

language: node_js 

node_js: 
    - "node" 

addons: 
    apt: 
    packages: 
     - xvfb 

before_install: 
    - cd src/ 

install: 
    - npm install 

before_script: 
    - export DISPLAY=':99.0' 
    - Xvfb :99 -screen 0 1024x768x24 +extension GLX +extension RANDR > /dev/null 2>&1 & 

script: 
    - npm test 

這裏是一個構建日誌(在引擎收錄,因爲它是巨大的):https://pastebin.com/8N4P2S7Y。重要的部分如下:

> [email protected] test /home/travis/build/blabel3/ThemeCreator/src 
> electron . 

Xlib: extension "RANDR" missing on display ":99.0". 
Xlib: extension "RANDR" missing on display ":99.0". 


No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself. 
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received 

The build has been terminated 

非常感謝你們提供的任何幫助!

回答

1

它應該可以只用sh -e /etc/init.d/xvfb start

目前我使用以下配置運行xvfb的,它工作正常。

os: 
    - linux 

language: node_js 

node_js: 
    - "7.7" 

before_script: 
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0; fi 
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh -e /etc/init.d/xvfb start; fi 
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sleep 3; fi 

script: 
    - node --version 
    - npm --version 
    - npm install 
    - npm run e2e 
+0

你也可以用'''xvfb-run my_script''來減少一些設置。 http://manpages.ubuntu.com/manpages/zesty/man1/xvfb-run.1.html – renemilk