My build is broken on travis-ci:
$ psql -c 'create database travis_ci_test;' -U postgres
psql: 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"?
The command "psql -c 'create database travis_ci_test;' -U postgres" failed and exited with 2 during.
I'm usin this .travis.yml
:
Yaml Version updated on 05/31/2020:
dist: trusty
env:
global:
- PGPORT=5433
services:
- postgresql
addons:
postgresql: '10'
apt:
packages:
- postgresql-10
- postgresql-client-10
before_script:
- export RUBYOPT='-W0' # to remove ruby 2.7 warnings
- cp config/database.yml.travis config/database.yml
language: ruby
rvm:
- 2.7.0
script:
- bundle exec rails db:reset db:setup db:migrate
- bundle exec rspec
- bundle exec rubocop --config .rubocop.yml
before_install:
- gem update --system
- gem install bundler
you need to add services: postgresql to start the service. check here:
language: ruby
script:
- RAILS_ENV=test bundle exec rake db:migrate --trace
- bundle exec rake db:test:prepare
- bundle exec rspec
before_script:
- psql -c 'create database db_test;' -U postgres
rvm:
- 2.5.0
services:
- postgresql
- memcached
- redis-server
addons:
postgresql: "9.4"
before_install:
- gem update --system
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With