Skip to content

Commit 18ef809

Browse files
authored
Move "mix test.integration" to an alias (#150)
1 parent 66212f6 commit 18ef809

File tree

4 files changed

+22
-24
lines changed

4 files changed

+22
-24
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
run: mix deps.compile
4444

4545
- name: Run tests
46-
run: mix test --trace
46+
run: mix test.integration --trace

config/config.exs

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/mix/tasks/test_integration.ex

Lines changed: 0 additions & 21 deletions
This file was deleted.

mix.exs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ defmodule Protobuf.Mixfile do
1515
deps: deps(),
1616
escript: escript(),
1717
description: description(),
18-
package: package()
18+
package: package(),
19+
aliases: aliases(),
20+
preferred_cli_env: ["test.integration": :test]
1921
]
2022
end
2123

@@ -56,4 +58,22 @@ defmodule Protobuf.Mixfile do
5658
~w(mix.exs README.md lib/google lib/protobuf lib/*.ex src LICENSE priv/templates .formatter.exs)
5759
]
5860
end
61+
62+
defp aliases do
63+
["test.integration": &run_integration_tests/1]
64+
end
65+
66+
defp run_integration_tests(args) do
67+
IO.puts("==> make clean")
68+
Mix.shell().cmd("make clean")
69+
70+
IO.puts("==> make gen-protos")
71+
Mix.shell().cmd("make gen-protos")
72+
73+
args = ["--only", "integration" | args]
74+
args = if IO.ANSI.enabled?(), do: ["--color" | args], else: ["--no-color" | args]
75+
76+
IO.puts("==> mix test #{Enum.join(args, " ")}")
77+
Mix.Task.run("test", args)
78+
end
5979
end

0 commit comments

Comments
 (0)