-
Notifications
You must be signed in to change notification settings - Fork 23
/
rebar.config.script
50 lines (45 loc) · 1.58 KB
/
rebar.config.script
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
%% -*- mode:erlang -*-
BuildWithoutRocks =
fun(Config) ->
case os:getenv("BUILD_WITHOUT_ROCKSDB") of
false ->
Config;
_ ->
io:format(user, "Building without rocksDB", []),
Deps = lists:keydelete(mnesia_rocksdb, 1, proplists:get_value(deps, Config)),
ErlOpts = lists:keyreplace('MRIA_HAS_ROCKSDB', 2, proplists:get_value(erl_opts, Config),
{d, 'MRIA_HAS_ROCKSDB', false}),
Config1 = lists:keyreplace(deps, 1, Config, {deps, Deps}),
lists:keyreplace(erl_opts, 1, Config1, {erl_opts, ErlOpts})
end
end,
AddCoverallsToken =
fun(Config) ->
case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
{"true", Token} when is_list(Token) ->
[{coveralls_repo_token, Token},
{coveralls_service_job_id, os:getenv("GITHUB_RUN_ID")},
{coveralls_commit_sha, os:getenv("GITHUB_SHA")},
{coveralls_service_number, os:getenv("GITHUB_RUN_NUMBER")},
{coveralls_coverdata, "_build/test/cover/*.coverdata"},
{coveralls_service_name, "github"} | Config];
_ ->
Config
end
end,
AddCoverallsPR =
fun(Config) ->
case os:getenv("GITHUB_EVENT_NAME") =:= "pull_request" andalso
string:tokens(os:getenv("GITHUB_REF"), "/") of
[_, "pull", PRNO, _] ->
[{coveralls_service_pull_request, PRNO} | Config];
_ ->
Config
end
end,
%%%% Create final configuarion %%%%
lists:foldl(fun(Fun, Conf) -> Fun(Conf) end, CONFIG,
[ BuildWithoutRocks
, AddCoverallsToken
, AddCoverallsPR
]).