【发布时间】:2020-10-28 04:34:11
【问题描述】:
这是我的第一个问题。
我正在尝试将 github actions 集成到我的 rails 项目中。
我的 ruby.yml 是这样的:
name: Ruby
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@ec106b438a1ff6ff112340de34ddc62c540232e0
with:
ruby-version: 2.6.5
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rake
捆绑步骤需要很多时间,我不知道我是否可以只加载 Gemfile.lock 而不是每次都运行捆绑。但它运行正常。
问题在于测试步骤。
所以这是错误:
rails aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/home/runner/work/project/project/test/test_helper.rb:10:in `<main>'
/home/runner/work/project/project/test/application_system_test_case.rb:1:in `<main>'
/home/runner/work/project/project/test/system/create_practice_test.rb:1:in `<main>'
/home/runner/work/GPLM/GPLM/bin/rails:9:in `<top (required)>'
/home/runner/work/GPLM/GPLM/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => test:system
(See full trace by running task with --trace)
Coverage report generated for Minitest to /home/runner/work/project/project/coverage. 31 / 3352 LOC (0.92%) covered.
SimpleCov failed with exit 1
##[error]Process completed with exit code 1.
谢谢大家。
【问题讨论】:
-
看起来您缺少设置 Postgres 的步骤。如果您在本地运行数据库服务器,则在构建步骤中还必须设置 postgres 管理员。
标签: ruby-on-rails ruby github github-actions