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 eunit
make ct make ct
make cover make cover
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make coveralls
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
if: always() if: always()
with: 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 .PHONY: coveralls
coveralls: coveralls:
@rebar3 coveralls send @rebar3 as test coveralls send
.PHONY: xref .PHONY: xref
xref: xref:

View File

@ -31,13 +31,12 @@
{cover_opts, [verbose]}. {cover_opts, [verbose]}.
{cover_export_enabled, true}. {cover_export_enabled, true}.
{plugins, [coveralls]}.
{erl_first_files, ["src/emqx_logger.erl"]}. {erl_first_files, ["src/emqx_logger.erl"]}.
{profiles, {profiles,
[{test, [{test,
[{deps, [{plugins, [{coveralls, {git, "https://github.com/emqx/coveralls-erl", {branch, "github"}}}]},
{deps,
[{bbmustache, "1.7.0"}, [{bbmustache, "1.7.0"},
{emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.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"}}} {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 %% -*-: erlang -*-
"true" ->
JobId = os:getenv("TRAVIS_JOB_ID"), case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
[{coveralls_service_job_id, JobId}, {"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_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 CONFIG
end, end.
CONFIG1.