mat*_*atb 5 ruby rspec mocha.js node.js travis-ci
我有一个包含多个组件的repo,其中大部分是JavaScript(Node.js),另一个是Ruby(Ruby on Rails).我想要一个.travis.yml文件触发一个构建,该构建运行每个组件的所有测试.根据Travis CI Google Group的帖子,目前还没有官方支持.
我的目录结构如下所示:
.
??? buildserver
??? core
??? extensions
??? webapp
??? Vagrantfile
??? package.json
??? .travis.yml
??? Makefile
我希望能够运行特定版本的Ruby(2.2.2)和Node.js(0.12.2).我已经有了一个make目标,因此make test在每个子目录中运行相应的测试套件.
mat*_*atb 17
事实证明,在Travis CI上运行隔离测试套件的每个VM都预装了Node.js和Ruby.默认情况下,你得到Ruby 1.9.3和Node.js 0.12.2(但是当Travis团队更新他们的环境时可能会改变),所以即使你只能language: Ruby在.travis.yml文件中指定一种语言(例如),你仍然可以运行Ruby和Travis CI VM上的Node.js程序.
我决定使用Node.js语言设置并安装适当的Ruby版本(但我可以做相反的效果).
这是我的.travis.yml配置文件:
language: node_js
node_js:
  - 0.12.2
addons:
  postgresql: "9.4"
before_install:
  - rvm install 2.2.2
install:
  # run whatever you have to do here. I have a Makefile that lets you install
  # all Node.js-related or Ruby-related dependencies as one step.
  - make npm
  - make bundler
before_script:
  # My Rails app lives in a subdirectory. I want to make sure that
  # my database is ready before I start running RSpec tests
  - psql -c 'create database test_db;' -U postgres
  # I use separate database.yml config for Travis CI
  - cp webapp/config/database.travis.yml webapp/config/database.yml
script:
  # `test` target executes `bundle exec rspec spec` and `npm run test`
  # in all appropriate subdirectories
  - make test
| 归档时间: | 
 | 
| 查看次数: | 2740 次 | 
| 最近记录: |