@@ -39,8 +39,6 @@ IsRebar3 = case application:get_key(rebar, vsn) of
39
39
lists :keymember (mix , 1 , application :loaded_applications ())
40
40
end ,
41
41
42
- JobId = case os :getenv (" TRAVIS_JOB_ID" ) of false -> " " ; V -> V end ,
43
-
44
42
ModCfg0 = fun (F , Cfg , [Key |Tail ], Op , Default ) ->
45
43
{OldVal ,PartCfg } = case lists :keytake (Key , 1 , Cfg ) of
46
44
{value , {_ , V1 }, V2 } -> {V1 , V2 };
@@ -103,14 +101,34 @@ GlobalDepsFilter = fun(Deps) ->
103
101
end , DepNames )
104
102
end ,
105
103
104
+ GithubConfig = case {os :getenv (" GITHUB_ACTIONS" ), os :getenv (" GITHUB_TOKEN" )} of
105
+ {" true" , Token } when is_list (Token ) ->
106
+ CONFIG1 = [{coveralls_repo_token , Token },
107
+ {coveralls_service_job_id , os :getenv (" GITHUB_RUN_ID" )},
108
+ {coveralls_commit_sha , os :getenv (" GITHUB_SHA" )},
109
+ {coveralls_service_number , os :getenv (" GITHUB_RUN_NUMBER" )}],
110
+ case os :getenv (" GITHUB_EVENT_NAME" ) =:= " pull_request"
111
+ andalso string :tokens (os :getenv (" GITHUB_REF" ), " /" ) of
112
+ [_ , " pull" , PRNO , _ ] ->
113
+ [{coveralls_service_pull_request , PRNO } | CONFIG1 ];
114
+ _ ->
115
+ CONFIG1
116
+ end ;
117
+ _ ->
118
+ []
119
+ end ,
120
+
106
121
Rules = [
107
122
{[port_env , " CXXFLAGS" ], true ,
108
123
AppendStr (CfgCXXFlags ), " $CXXFLAGS" },
109
124
{[port_env , " LDFLAGS" ], true ,
110
125
AppendStr (CfgLDFlags ), " $LDFLAGS" },
111
- {[post_hooks ], CfgWithGCov == " true" ,
126
+ {[post_hooks ], ( not IsRebar3 ) and ( CfgWithGCov == " true" ) ,
112
127
AppendList ([{eunit , " gcov -o c_src stringprep" },
113
128
{eunit , " mv *.gcov .eunit/" }]), []},
129
+ {[post_hooks ], IsRebar3 and (CfgWithGCov == " true" ),
130
+ AppendList ([{eunit , " gcov -o c_src stringprep" },
131
+ {eunit , " mv *.gcov _build/test/cover/" }]), []},
114
132
{[port_env , " LDFLAGS" ], CfgWithGCov == " true" ,
115
133
AppendStr (" --coverage" ), " " },
116
134
{[port_env , " CXXFLAGS" ], CfgWithGCov == " true" ,
@@ -124,17 +142,16 @@ Rules = [
124
142
{compile , {pc , compile }},
125
143
{clean , {pc , clean }}
126
144
]}]), []},
127
- {[deps ], os :getenv (" TRAVIS" ) == " true" ,
128
- AppendList ([{coveralls , " .*" , {git , " https://github.com/markusn/coveralls-erl.git" , {tag , " v2.0.1" }}}]), []},
129
- {[post_hooks ], os :getenv (" TRAVIS" ) == " true" ,
130
- AppendList ([{eunit , " echo '\n %%! -pa .eunit/ deps/coveralls/ebin\n main(_)->{ok,F}=file:open(\" erlang.json\" ,[write]),io:fwrite(F,\" ~s \" ,[coveralls:convert_file(\" .eunit/cover.coverdata\" , \" " ++ JobId ++ " \" , \" travis-ci\" ,\"\" )]).' > getcover.erl" },
131
- {eunit , " escript ./getcover.erl" }]), []},
145
+ {[plugins ], os :getenv (" COVERALLS" ) == " true" ,
146
+ AppendList ([{coveralls , {git ,
147
+ " https://github.com/RoadRunnr/coveralls-erl.git" ,
148
+ {branch , " feature/git-info" }}} ]), []},
132
149
{[deps ], os :getenv (" USE_GLOBAL_DEPS" ) /= false ,
133
150
GlobalDepsFilter , []}
134
151
],
135
152
136
153
137
- Config = FilterConfig (FilterConfig , CONFIG , Rules ),
154
+ Config = FilterConfig (FilterConfig , CONFIG , Rules ) ++ GithubConfig ,
138
155
139
156
% io:format("Rules:~n~p~n~nCONFIG:~n~p~n~nConfig:~n~p~n", [Rules, CONFIG, Config]),
140
157
0 commit comments