-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
mix.exs
167 lines (149 loc) · 4.56 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
defmodule Flop.MixProject do
use Mix.Project
@source_url "https://github.com/woylie/flop"
@version "0.26.1"
@adapters ~w(postgres sqlite)
def project do
[
app: :flop,
version: @version,
elixir: "~> 1.11",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
test_coverage: [tool: ExCoveralls],
test_paths: test_paths(System.get_env("ECTO_ADAPTER")),
preferred_cli_env: [
"coveralls.detail": :test,
"coveralls.github": :test,
"coveralls.html": :test,
"coveralls.html.all": :test,
"coveralls.json": :test,
"coveralls.json.all": :test,
"coveralls.post": :test,
"ecto.create": :test,
"ecto.drop": :test,
"ecto.migrate": :test,
"ecto.reset": :test,
"test.all": :test,
"test.adapters": :test,
coveralls: :test,
dialyzer: :test
],
dialyzer: [
ignore_warnings: ".dialyzer_ignore.exs",
list_unused_filters: true,
plt_file: {:no_warn, ".plts/dialyzer.plt"}
],
name: "Flop",
source_url: @source_url,
homepage_url: @source_url,
description: description(),
package: package(),
docs: docs(),
aliases: aliases(),
consolidate_protocols: Mix.env() != :test
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:credo, "~> 1.7.0", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4.0", only: [:dev, :test], runtime: false},
{:ecto, "~> 3.11"},
{:ecto_sql, "~> 3.11", only: :test},
{:ex_doc, "~> 0.21", only: :dev, runtime: false},
{:ex_machina, "~> 2.4", only: :test},
{:makeup_diff, "~> 0.1.0", only: :dev, runtime: false},
{:excoveralls, "~> 0.10", only: :test},
{:nimble_options, "~> 1.0"},
{:postgrex, ">= 0.0.0", only: :test},
{:ecto_sqlite3, "~> 0.17.0", only: :test},
{:stream_data, "~> 1.0", only: [:dev, :test]}
]
end
defp description do
"Filtering, ordering and pagination with Ecto."
end
defp package do
[
licenses: ["MIT"],
links: %{
"GitHub" => @source_url,
"Changelog" => @source_url <> "/blob/main/CHANGELOG.md",
"Sponsor" => "https://github.com/sponsors/woylie"
},
files: ~w(lib .formatter.exs mix.exs README* LICENSE* CHANGELOG*)
]
end
defp docs do
[
main: "readme",
extras: ["cheatsheets/schema.cheatmd", "README.md", "CHANGELOG.md"],
source_ref: @version,
skip_undefined_reference_warnings_on: ["CHANGELOG.md"],
groups_for_extras: [
Cheatsheets: ~r/cheatsheets\/.?/
],
groups_for_docs: [
"Query Functions": &(&1[:group] == :queries),
"Parameter Manipulation": &(&1[:group] == :parameters),
Miscellaneous: &(&1[:group] == :miscellaneous)
]
]
end
defp aliases do
[
"test.all": ["test", "test.adapters"],
"test.postgres": &test_adapters(["postgres"], &1),
"test.sqlite": &test_adapters(["sqlite"], &1),
"test.adapters": &test_adapters/1,
"coveralls.html.all": [
"test.adapters --cover",
"coveralls.html --import-cover cover"
],
"coveralls.json.all": [
# only run postgres and base tests for coverage until sqlite tests are
# fixed
fn _ -> test_adapters(["postgres"], ["--cover"]) end,
"coveralls.json --import-cover cover"
]
]
end
defp test_paths(adapter) when adapter in @adapters,
do: ["test/adapters/ecto/#{adapter}"]
defp test_paths(nil), do: ["test/base"]
defp test_paths(adapter) do
raise """
unknown Ecto adapter
Expected ECTO_ADAPTER to be one of: #{inspect(@adapters)}
Got: #{inspect(adapter)}
"""
end
defp test_adapters(adapters \\ @adapters, args) do
for adapter <- adapters do
IO.puts("==> Running tests for ECTO_ADAPTER=#{adapter} mix test")
{_, res} =
System.cmd(
"mix",
["test", ansi_option(), "--export-coverage=#{adapter}" | args],
into: IO.binstream(:stdio, :line),
env: [{"ECTO_ADAPTER", adapter}]
)
if res > 0 do
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
end
end
end
defp ansi_option do
if IO.ANSI.enabled?(), do: "--color", else: "--no-color"
end
end