Skip to content

Instantly share code, notes, and snippets.

@scrubmx
Last active September 5, 2019 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrubmx/12746385672a404298f82f6f0560d197 to your computer and use it in GitHub Desktop.
Save scrubmx/12746385672a404298f82f6f0560d197 to your computer and use it in GitHub Desktop.
Solved! Working with postgres (postgresql 11) in travis
language: elixir
dist: bionic
sudo: required
elixir:
- '1.9.0'
otp_release:
- '22.0'
addons:
postgresql: '11'
apt:
packages:
- postgresql-11
- postgresql-client-11
env:
- MIX_ENV=test
cache:
directories:
- _build
- deps
before_install:
- sudo sed -i -e 's/^#listen_addresses.*/listen_addresses = "*"/' /etc/postgresql/11/main/postgresql.conf
- sudo sed -i -e 's/^port = 5433/port = 5432/' /etc/postgresql/11/main/postgresql.conf
- sudo service postgresql restart 11
install:
- mix local.hex --force
- mix local.rebar --force
before_script:
- cp config/travis.exs config/test.exs
- mix do ecto.create, ecto.migrate
script:
- mix test
use Mix.Config
# Configure your database
#
# !!!! The postgres user travis is created automatically !!!!
#
config :myapp, Myapp.Repo,
username: "travis",
password: "",
database: "myapp_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :sanborns, MyappWeb.Endpoint,
http: [port: 4002],
server: false
# Print only warnings and errors during test
config :logger, level: :warn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment