【发布时间】:2020-03-23 19:20:42
【问题描述】:
我现在遇到问题,不知道如何在 Github Actions 上下文中解决这个问题。
旁白:我正在关注tutorial,关于为 CI 设置具有 GH 操作的 Rails-Postgres。
通常当我在开发环境中遇到这个问题时,我会删除一个postmaster.pid 文件。但是在这里,因为我在GH操作的测试环境中,我不确定如何解决它。我已经尝试过在开发环境中执行此操作,但不幸的是它不起作用。
我尝试过的解决方案:
rm /usr/local/var/postgres/postmaster.pid在工作流的 postgres 条目中更改
ports
我的 GH 行动工作流程:
name: Test
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12.1
ports:
- 6543:6543
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Ruby version specified in `.ruby-version`
uses: eregon/use-ruby-action@master
- name: Install required apt packages
run: |
sudo apt-get -y install libpq-dev
- name: Setup cache key and directory for gems cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-use-ruby-${{ hashFiles('**/Gemfile.lock') }}
- name: Read Node.js version to install from `.nvmrc`
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Install required Node.js version
uses: actions/setup-node@v1
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: Get Yarn cache directory path
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup cache key and directory for node_modules cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Bundle install
run: |
gem install bundler -v2.1.4
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Yarn install
run: yarn --frozen-lockfile
- name: Run RSpec // ERRORS HERE
run: |
RUBYOPT='-W:no-deprecated -W:no-experimental' bundle exec rails db:prepare
RUBYOPT='-W:no-deprecated -W:no-experimental' bundle exec rspec
它在Run RSpec 任务上中断。
错误信息:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
谢谢大家的帮助????
【问题讨论】:
标签: ruby-on-rails postgresql github-actions