Change travis-ci to github action

This commit is contained in:
JianBo He 2020-03-15 19:46:17 +08:00 committed by JianBo He
parent 7e00b58db5
commit e492260fe8
5 changed files with 28 additions and 39 deletions

View File

@ -18,6 +18,11 @@ jobs:
make eunit
make ct
make cover
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make coveralls
- uses: actions/upload-artifact@v1
if: always()
with:

View File

@ -1,24 +0,0 @@
language: erlang
otp_release:
- 22.1
before_install:
- git clone https://github.com/erlang/rebar3.git; cd rebar3; ./bootstrap; sudo mv rebar3 /usr/local/bin/; cd ..
script:
- make compile
- rm -rf rebar.lock
- make xref
- rm -rf rebar.lock
- make eunit
- rm -rf rebar.lock
- make ct
- rm -rf rebar.lock
- make cover
- rm -rf rebar.lock
after_success:
- make coveralls
sudo: false

View File

@ -65,7 +65,7 @@ cover:
.PHONY: coveralls
coveralls:
@rebar3 coveralls send
@rebar3 as test coveralls send
.PHONY: xref
xref:

View File

@ -31,13 +31,12 @@
{cover_opts, [verbose]}.
{cover_export_enabled, true}.
{plugins, [coveralls]}.
{erl_first_files, ["src/emqx_logger.erl"]}.
{profiles,
[{test,
[{deps,
[{plugins, [{coveralls, {git, "https://github.com/emqx/coveralls-erl", {branch, "github"}}}]},
{deps,
[{bbmustache, "1.7.0"},
{emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.0"}}},
{emqx_ct_helpers, {git, "https://github.com/emqx/emqx-ct-helpers", {tag, "1.2.2"}}}

View File

@ -1,11 +1,20 @@
CONFIG1 = case os:getenv("TRAVIS") of
"true" ->
JobId = os:getenv("TRAVIS_JOB_ID"),
[{coveralls_service_job_id, JobId},
%% -*-: erlang -*-
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")},
{coveralls_coverdata, "_build/test/cover/*.coverdata"},
{coveralls_service_name , "travis-ci"} | CONFIG];
{coveralls_service_name, "github"} | CONFIG],
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;
_ ->
CONFIG
end,
CONFIG1.
end.