Switch from Travis to Github Actions

This commit is contained in:
Badlop
2021-06-17 13:22:28 +02:00
parent 45151eddab
commit 1f02d36302
5 changed files with 78 additions and 27 deletions

View File

@@ -29,7 +29,6 @@ IsRebar3 = case application:get_key(rebar, vsn) of
lists:keymember(mix, 1, application:loaded_applications())
end,
JobId = case os:getenv("TRAVIS_JOB_ID") of false -> ""; V -> V end,
ModCfg0 = fun(F, Cfg, [Key|Tail], Op, Default) ->
{OldVal,PartCfg} = case lists:keytake(Key, 1, Cfg) of
@@ -93,6 +92,23 @@ GlobalDepsFilter = fun(Deps) ->
end, DepNames)
end,
GithubConfig = case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
{"true", Token} when is_list(Token) ->
CONFIG1 = [{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")}],
case os:getenv("GITHUB_EVENT_NAME") =:= "pull_request"
andalso string:tokens(os:getenv("GITHUB_REF"), "/") of
[_, "pull", PRNO, _] ->
[{coveralls_service_pull_request, PRNO} | CONFIG1];
_ ->
CONFIG1
end;
_ ->
[]
end,
Rules = [
{[deps], IsRebar3,
Rebar3DepsFilter, []},
@@ -103,12 +119,17 @@ Rules = [
{compile, {pc, compile}},
{clean, {pc, clean}}
]}]), []},
{[plugins], IsRebar3 and (os:getenv("GITHUB_ACTIONS") == "true"),
AppendList([{coveralls, {git,
"https://github.com/RoadRunnr/coveralls-erl.git",
{branch, "feature/git-info"}}} ]), []},
{[deps], os:getenv("USE_GLOBAL_DEPS") /= false,
GlobalDepsFilter, []}
],
Config = FilterConfig(FilterConfig, CONFIG, Rules),
Config = FilterConfig(FilterConfig, CONFIG, Rules)
++ GithubConfig,
%io:format("Rules:~n~p~n~nCONFIG:~n~p~n~nConfig:~n~p~n", [Rules, CONFIG, Config]),