Skip to content

Commit eeb6bda

Browse files
committed
Install deps for integration tests automatically
1 parent d97ac05 commit eeb6bda

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

mix.exs

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -150,30 +150,40 @@ defmodule Sentry.Mixfile do
150150
])
151151
)
152152

153-
color_arg = if IO.ANSI.enabled?(), do: "--color", else: "--no-color"
154-
155-
{_, status} =
156-
System.cmd("mix", ["test", color_arg | args],
157-
into: IO.binstream(:stdio, :line),
158-
cd: Path.join("test_integrations", integration)
159-
)
160-
161-
if status > 0 do
162-
IO.puts(
163-
IO.ANSI.format([
164-
:red,
165-
"Integration tests for #{integration} failed"
166-
])
167-
)
168-
169-
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
170-
else
171-
IO.puts(
172-
IO.ANSI.format([
173-
:green,
174-
"Integration tests for #{integration} passed"
175-
])
176-
)
153+
case setup_integration(integration) do
154+
{_, 0} ->
155+
color_arg = if IO.ANSI.enabled?(), do: "--color", else: "--no-color"
156+
157+
{_, status} = run_in_integration(integration, ["test", color_arg | args])
158+
159+
if status > 0 do
160+
IO.puts(
161+
IO.ANSI.format([
162+
:red,
163+
"Integration tests for #{integration} failed"
164+
])
165+
)
166+
167+
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
168+
else
169+
IO.puts(
170+
IO.ANSI.format([
171+
:green,
172+
"Integration tests for #{integration} passed"
173+
])
174+
)
175+
end
177176
end
178177
end
178+
179+
defp setup_integration(integration) do
180+
run_in_integration(integration, ["deps.get"])
181+
end
182+
183+
defp run_in_integration(integration, args) do
184+
System.cmd("mix", args,
185+
into: IO.binstream(:stdio, :line),
186+
cd: Path.join("test_integrations", integration)
187+
)
188+
end
179189
end

0 commit comments

Comments
 (0)