diff --git a/.github/workflows/run_test_case.yaml b/.github/workflows/run_test_case.yaml index 54fe6afea..7de8efd8c 100644 --- a/.github/workflows/run_test_case.yaml +++ b/.github/workflows/run_test_case.yaml @@ -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: @@ -26,4 +31,4 @@ jobs: - uses: actions/upload-artifact@v1 with: name: cover - path: _build/test/cover \ No newline at end of file + path: _build/test/cover diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 95074d084..000000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/Makefile b/Makefile index ea73928cd..f0ef7d6e8 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ cover: .PHONY: coveralls coveralls: - @rebar3 coveralls send + @rebar3 as test coveralls send .PHONY: xref xref: diff --git a/rebar.config b/rebar.config index 2827059f7..8f9c63b3b 100644 --- a/rebar.config +++ b/rebar.config @@ -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"}}} diff --git a/rebar.config.script b/rebar.config.script index 558910385..5447ffb33 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,11 +1,20 @@ -CONFIG1 = case os:getenv("TRAVIS") of - "true" -> - JobId = os:getenv("TRAVIS_JOB_ID"), - [{coveralls_service_job_id, JobId}, - {coveralls_coverdata, "_build/test/cover/*.coverdata"}, - {coveralls_service_name , "travis-ci"} | CONFIG]; - _ -> - CONFIG - end, +%% -*-: erlang -*- -CONFIG1. +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, "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.