7

我在 GitHub 上托管了我的代码(用 C++ 编写),并希望将其链接到托管的持续集成 (CI) 服务器,例如Travis CIBuildHive。然后我想在我的项目页面上看到“构建通过”或“构建失败”。但是当我检查这两个服务的 CI 环境时,Travis CI 与 gcc、git、cmake 和 sqlite3 的可用性最接近,但我缺少另一个关键库 Qt4,它是构建我的项目所必需的。它也应该是免费的,因为它是一个免费的开源项目。

请告诉我我该怎么做?谢谢。

我需要:gcc、git、cmake、sqlite3 和 Qt4。

4

2 回答 2

8

以下 .travis.yml 解决了我的问题。可以在此页面上找到答案:http: //about.travis-ci.org/docs/user/build-configuration/#Installing-Packages-Using-apt

 language: cpp

 compiler: gcc

 before_install:
  - sudo apt-get update -qq
  - sudo apt-get install -qq cmake sqlite3 qt4-dev-tools

 before_script:
   - mkdir build
   - cd build
   - cmake ..

 script: make

 notifications:
   email:
     - xxx@users.sourceforge.net
   on_success: change
   on_failure: always
于 2013-02-24T13:19:30.037 回答
1

Not sure of this can work, but this blog post takes advantage of the Travis Build Matrix, in order to replace one language by another in the .travis.yml file:

# specify python as the language
language: python
# python versions to be used for testing
python:
- "2.6"
- "2.7"
env:
- JYTHON=true
- JYTHON=false
matrix:
exclude:
- python: 2.6
env: JYTHON=true
before_install:
- export JYTHON_URL='http://downloads.sourceforge.net/project/jython/jython/2.5.2/jython_installer-2.5.2.jar?r=http%3A%2F%2Fwww.jython.org%2Fdownloads.html&ts=1338089844&use_mirror=iweb'
- if [ "$JYTHON" == "true" ]; then wget $JYTHON_URL -O jython_installer.jar; java -jar jython_installer.jar -s -d $HOME/jython; export PATH=$HOME/jython:$PATH; fi
before_script: if [ "$JYTHON" == "true" ]; then export PYTHON_EXE=jython; jython -c "print ''"; else export PYTHON_EXE=python; fi
script: $PYTHON_EXE setup.py test 

So maybe you could setup a specific build which, actually, install qt4 and uses it instead of the official language.

于 2013-02-24T10:06:22.393 回答