Skip to content

Commit

Permalink
Run benchmarks with consolidated protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
José Valim committed Sep 27, 2018
1 parent cb1fa78 commit 39c835a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 30,10 @@ env:
global:
- PGVERSION=9.6
matrix:
- MIX_ENV=test
- MIX_ENV=pg PGVERSION=9.2
- MIX_ENV=pg
- MIX_ENV=mysql
- ECTO_ADAPTER=none
- ECTO_ADAPTER=pg PGVERSION=9.2
- ECTO_ADAPTER=pg
- ECTO_ADAPTER=mysql
install:
- mix local.hex --force
- mix local.rebar --force
Expand Down
19 changes: 9 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 2,23 @@ defmodule Ecto.MixProject do
use Mix.Project

@version "3.0.0-dev"
@adapters [:pg, :mysql]
@adapters ~w(pg mysql)

def project do
[app: :ecto,
version: @version,
elixir: "~> 1.4",
deps: deps(),
build_per_environment: false,
consolidate_protocols: false,
test_paths: test_paths(Mix.env),
consolidate_protocols: Mix.env() != :test,
test_paths: test_paths(System.get_env("ECTO_ADAPTER")),
xref: [exclude: [Mariaex, Ecto.Adapters.MySQL.Connection,
Postgrex, Ecto.Adapters.Postgres.Connection,
DBConnection, DBConnection.Ownership]],

# Custom testing
aliases: ["test.all": ["test", "test.adapters"],
"test.adapters": &test_adapters/1],
preferred_cli_env: ["test.all": :test],
preferred_cli_env: ["test.all": :test, "test.adapters": :test],

# Hex
description: "A database wrapper and language integrated query for Elixir",
Expand All @@ -32,7 31,7 @@ defmodule Ecto.MixProject do

def application do
[
applications: [:decimal, :logger, :crypto],
extra_applications: [:logger, :crypto],
env: [postgres_map_type: "jsonb"],
mod: {Ecto.Application, []}
]
Expand Down Expand Up @@ -75,16 74,16 @@ defmodule Ecto.MixProject do
end

defp test_adapters(args) do
for env <- @adapters, do: env_run(env, args)
for adapter <- @adapters, do: env_run(adapter, args)
end

defp env_run(env, args) do
defp env_run(adapter, args) do
args = if IO.ANSI.enabled?, do: ["--color"|args], else: ["--no-color"|args]

IO.puts "==> Running tests for MIX_ENV=#{env} mix test"
IO.puts "==> Running tests for ECTO_ADAPTER=#{adapter} mix test"
{_, res} = System.cmd "mix", ["test"|args],
into: IO.binstream(:stdio, :line),
env: [{"MIX_ENV", to_string(env)}]
env: [{"ECTO_ADAPTER", adapter}]

if res > 0 do
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
Expand Down

0 comments on commit 39c835a

Please sign in to comment.