summaryrefslogtreecommitdiff
path: root/mix.exs
diff options
context:
space:
mode:
authorILYA Khlopotov <iilyak@apache.org>2019-12-11 10:11:52 -0800
committerILYA Khlopotov <iilyak@apache.org>2019-12-12 03:08:46 -0800
commit1953c33005eb4ffdef75a4a248d6298b1e0ce41a (patch)
tree7fb69eeca9c44bf8d4e6f1597eae64eb9265b235 /mix.exs
parenta66998e9a47ed178e11dab365c0afad28030f335 (diff)
downloadcouchdb-1953c33005eb4ffdef75a4a248d6298b1e0ce41a.tar.gz
Integrate excoverals into test stack
Diffstat (limited to 'mix.exs')
-rw-r--r--mix.exs79
1 files changed, 78 insertions, 1 deletions
diff --git a/mix.exs b/mix.exs
index 2859da3d1..4432b1c83 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,3 +1,25 @@
+defmodule CoverTool do
+ def start(path, options) do
+ {dirs, options} = Keyword.pop(options, :dirs, [])
+ fun = ExCoveralls.start(path, options)
+ Mix.shell().info("Cover compiling modules ...")
+ :cover.stop()
+ :cover.start()
+
+ Enum.each(dirs, fn path ->
+ path
+ |> Path.expand(__DIR__)
+ |> String.to_charlist()
+ |> :cover.compile_beam_directory()
+ end)
+
+ ExCoveralls.ConfServer.start()
+ ExCoveralls.ConfServer.set(options)
+ ExCoveralls.StatServer.start()
+ fun
+ end
+end
+
defmodule CouchDBTest.Mixfile do
use Mix.Project
@@ -15,7 +37,12 @@ defmodule CouchDBTest.Mixfile do
deps: deps(),
consolidate_protocols: Mix.env() not in [:test, :dev, :integration],
test_paths: get_test_paths(Mix.env()),
- elixirc_paths: elixirc_paths(Mix.env())
+ elixirc_paths: elixirc_paths(Mix.env()),
+ test_coverage: [
+ tool: CoverTool,
+ dirs: get_coverage_paths(),
+ type: "html"
+ ]
]
end
@@ -37,6 +64,7 @@ defmodule CouchDBTest.Mixfile do
[
{:junit_formatter, "~> 3.0", only: [:dev, :test, :integration]},
{:httpotion, ">= 3.1.3", only: [:dev, :test, :integration], runtime: false},
+ {:excoveralls, "~> 0.12", only: :test},
{:jiffy, path: Path.expand("src/jiffy", __DIR__)},
{:ibrowse,
path: Path.expand("src/ibrowse", __DIR__), override: true, compile: false},
@@ -58,4 +86,53 @@ defmodule CouchDBTest.Mixfile do
def get_test_paths(_) do
[]
end
+
+ defp get_deps_paths() do
+ deps = [
+ "bunt",
+ "certifi",
+ "credo",
+ "excoveralls",
+ "hackney",
+ "httpotion",
+ "ibrowse",
+ "idna",
+ "jason",
+ "jiffy",
+ "junit_formatter",
+ "metrics",
+ "mimerl",
+ "parse_trans",
+ "ssl_verify_fun",
+ "unicode_util_compat",
+ "b64url",
+ "bear",
+ "mochiweb",
+ "snappy",
+ "triq",
+ "rebar",
+ "proper",
+ "mochiweb",
+ "meck",
+ "khash",
+ "hyper",
+ "fauxton",
+ "folsom",
+ "hqueue"
+ ]
+
+ deps |> Enum.map(fn app -> "src/#{app}" end)
+ end
+
+ defp get_coverage_paths() do
+ deps =
+ get_deps_paths()
+ |> Enum.reduce(MapSet.new(), fn x, set ->
+ MapSet.put(set, "#{x}/ebin")
+ end)
+
+ Path.wildcard("src/*/ebin")
+ |> Enum.filter(&File.dir?/1)
+ |> Enum.filter(fn path -> not MapSet.member?(deps, path) end)
+ end
end