-
Notifications
You must be signed in to change notification settings - Fork 2
/
mix.exs
117 lines (106 loc) · 2.95 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
defmodule Childchain.MixProject do
use Mix.Project
def project do
[
default_task: "childchain.start",
apps_path: "apps",
version: version(),
start_permanent: Mix.env() == :prod,
build_path: "_build" <> docker(),
deps_path: "deps" <> docker(),
deps: deps(),
dialyzer: dialyzer(),
aliases: aliases(),
releases: [
childchain: [
steps: steps(),
version: version(),
applications: tools() ++ [engine: :permanent, api: :permanent, status: :permanent, bus: :permanent],
config_providers: [
{Engine.ReleaseTasks.Contract, []},
{Status.ReleaseTasks.Logger, [sentry_logger: Sentry.LoggerBackend, default_logger: Ink]},
{Status.ReleaseTasks.Sentry, [current_version: version()]},
{Status.ReleaseTasks.Application, [release: "childchain", current_version: version()]}
]
]
],
preferred_cli_env: [
"test.integration": :test,
"test.all": :test,
"test.integration_block_submission_vault": :test,
"test.integration_block_submission": :test
]
]
end
defp aliases() do
[
# NB: Think about adding a seed routine here
"ecto.setup": ["ecto.create", "ecto.migrate"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["test --no-start"],
"test.integration": ["test --only integration"],
"test.integration_block_submission_vault": ["test --only block_submission_vault"],
"test.integration_block_submission": ["test --only block_submission"],
"test.all": ["test --include integration"]
]
end
defp deps do
[
{:credo, "~> 1.4", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev], runtime: false}
]
end
defp docker() do
case System.get_env("DOCKER") do
nil -> ""
_ -> "_docker"
end
end
defp steps() do
case Mix.env() do
:prod -> [:assemble, :tar]
_ -> [:assemble]
end
end
defp dialyzer() do
paths =
"apps"
|> File.ls!()
|> Enum.map(fn app ->
"_build#{docker()}/#{Mix.env()}/lib/#{app}/ebin"
end)
[
flags: [
:error_handling,
:race_conditions,
:underspecs,
:unknown,
:unmatched_returns
],
ignore_warnings: "dialyzer.ignore-warnings",
list_unused_filters: true,
plt_add_apps: [:ex_abi, :vmstats, :mix],
paths: paths
]
end
defp tools() do
case Mix.env() do
:prod ->
[tools: :permanent, runtime_tools: :permanent]
_ ->
[
observer: :permanent,
wx: :permanent,
tools: :permanent,
runtime_tools: :permanent
]
end
end
defp version() do
"#{String.trim(File.read!("VERSION"))}" <> "+" <> sha()
end
defp sha() do
git_sha = System.cmd("git", ["rev-parse", "--short=7", "HEAD"])
String.replace(elem(git_sha, 0), "\n", "")
end
end