Travis-CI 上的 Rails 数据库设置
我正在尝试在 Rails 项目上使用 Travis 持续集成。文档说,对于 SQLite3,测试数据库必须配置如下:
test:
adapter: sqlite3
database: ":memory:"
timeout: 500
但我想保留本地测试的默认配置。是否可以同时保留我的本地设置和 Travis 要求?
I'm trying to use Travis Continuous Integration on a Rails project. The documentation says that the test db must be configured as following for SQLite3:
test:
adapter: sqlite3
database: ":memory:"
timeout: 500
But I'd like to keep my default configuration for local tests. Is it possible to keep both my local settings and the Travis requirements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对这个问题的解决方案完全基于 一篇博客文章,有一些差异:
config/database.travis.yml
中的 Travis CI 特定设置;.travis.yml
之前的脚本部分;以下是这两个文件的完整列表:
My solution for this problem is fully based on a blog post with a few differences:
config/database.travis.yml
;cp config/database.travis.yml config/database.yml
in before script section of.travis.yml
;config/database.yml
in source tree.Here is full listing for both files:
@mrm 的博客文章没有回答您的问题。
我遇到了同样的问题,我的本地计算机上的 postgreql 凭据与 travis 默认凭据不同。这是我想出的最简单的解决方案:
请注意,Travis CI 自动设置 TRAVIS 环境变量。
你的解决方案是:
@mrm's blog post doesn't say anything about answering your question.
I faced the same problem where my postgreql credentials are different on my local machine than travis default. This is the simplest solution I came up with:
Note that Travis CI automatically sets TRAVIS environment variable.
Your solution would be:
我刚刚写了 一篇博客文章描述了如何执行此操作。
I just wrote a blog post describing how to do this.