我可不想把每一个小改动都推给。travis。yml和我对源代码所做的每一个小更改,以便运行构建。使用jenkins,您可以下载jenkins并在本地运行。特拉维斯会提供这样的东西吗?
注意:我已经看到了travis-ci命令行并下载了它,但它似乎 要做的就是调用他们的API,然后连接到我的GitHub回购,所以如果 我不推,重启最后的构建也没有关系。
我可不想把每一个小改动都推给。travis。yml和我对源代码所做的每一个小更改,以便运行构建。使用jenkins,您可以下载jenkins并在本地运行。特拉维斯会提供这样的东西吗?
注意:我已经看到了travis-ci命令行并下载了它,但它似乎 要做的就是调用他们的API,然后连接到我的GitHub回购,所以如果 我不推,重启最后的构建也没有关系。
当前回答
类似于Scott McLeod的,但它也生成一个bash脚本来运行.travis.yml中的步骤。
在Docker中使用生成的Bash脚本进行本地故障排除
# choose the image according to the language chosen in .travis.yml
$ docker run -it -u travis quay.io/travisci/travis-jvm /bin/bash
# now that you are in the docker image, switch to the travis user
sudo - travis
# Install a recent ruby (default is 1.9.3)
rvm install 2.3.0
rvm use 2.3.0
# Install travis-build to generate a .sh out of .travis.yml
cd builds
git clone https://github.com/travis-ci/travis-build.git
cd travis-build
gem install travis
# to create ~/.travis
travis version
ln -s `pwd` ~/.travis/travis-build
bundle install
# Create project dir, assuming your project is `AUTHOR/PROJECT` on GitHub
cd ~/builds
mkdir AUTHOR
cd AUTHOR
git clone https://github.com/AUTHOR/PROJECT.git
cd PROJECT
# change to the branch or commit you want to investigate
travis compile > ci.sh
# You most likely will need to edit ci.sh as it ignores matrix and env
bash ci.sh
其他回答
您可以尝试Trevor,它使用Docker运行Travis构建。
从它的描述来看:
我经常需要为多个版本的Node.js运行测试。但我不想使用n/nvm手动切换版本,也不想仅仅为了运行测试而将代码推到Travis CI。 所以我创造了特雷弗上面写着。travis。yml并在您请求的所有版本中运行测试,就像Travis CI一样。现在,您可以在推送前进行测试,并保持git历史记录干净。
更新:我现在有一个完整的交钥匙,全能的答案,见https://stackoverflow.com/a/49019950/300224。只花了3年时间就弄明白了!
根据Travis文档:https://github.com/travis-ci/travis-ci,有一个混合的项目,共同提供我们所了解和喜爱的Travis CI web服务。下面的项目子集似乎允许使用.travis进行本地make测试功能。Yml在你的项目中:
travis-build
Travis-build创建构建 为每个作业编写脚本。它从.travis中获取配置。Yml文件和 创建bash脚本,然后在构建环境中通过 travis-worker。
travis-cookbooks
Travis-cookbooks拥有 用于提供构建环境的Chef烹饪书。
travis-worker
工人负责 在干净的环境中运行构建脚本。它将日志输出流发送到 travis-log和推送状态更新(构建开始/完成) travis-hub。
(其他子项目负责与GitHub、他们的web界面、电子邮件和他们的API通信。)
可以通过一个bounce主机SSH到Travis CI环境。该特性不是在Travis CI中构建的,但是可以通过以下步骤实现。
On the bounce host, create travis user and ensure that you can SSH to it. Put these lines in the script: section of your .travis.yml (e.g. at the end). - echo travis:$sshpassword | sudo chpasswd - sudo sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - sudo service ssh restart - sudo apt-get install sshpass - sshpass -p $sshpassword ssh -R 9999:localhost:22 -o StrictHostKeyChecking=no travis@$bouncehostip Where $bouncehostip is the IP/host of your bounce host, and $sshpassword is your defined SSH password. These variables can be added as encrypted variables. Push the changes. You should be able to make an SSH connection to your bounce host.
来源:Shell到Travis CI构建环境。
下面是完整的例子:
# use the new container infrastructure
sudo: required
dist: trusty
language: python
python: "2.7"
script:
- echo travis:$sshpassword | sudo chpasswd
- sudo sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config
- sudo service ssh restart
- sudo apt-get install sshpass
- sshpass -p $sshpassword ssh -R 9999:localhost:22 -o StrictHostKeyChecking=no travisci@$bouncehostip
参见:c-mart/travis-shell在GitHub。
请参见:如何为调试重现一个travis-ci构建环境
我不确定你在本地运行特拉维斯的最初原因是什么,如果你只是想玩它,那么停止阅读这里,因为它与你无关。
如果您已经有托管Travis的经验,并且希望在自己的数据中心获得相同的经验,请继续阅读。
自2014年12月Travis CI提供企业内部版本。
http://blog.travis-ci.com/2014-12-19-introducing-travis-ci-enterprise/
定价也是文章的一部分:
授权是按座位进行的,每个授权包括20个用户。每个许可证的定价为6,000美元起,包括20个用户和5个并发构建。这里有一个8500美元的无限版本的高级选项。
使用wwtd (travis会做什么)ruby gem在本地机器上运行测试,大致就像它们在travis上运行一样。
它将重新创建构建矩阵并运行每个配置,在推送之前检查设置。
gem i wwtd
wwtd