Skip to content

Commit

Permalink
Merge pull request #2993 from esl/imporve-coveralls-reporting
Browse files Browse the repository at this point in the history
report lcov file to coveralls using gh action
  • Loading branch information
chrzaszcz authored Jan 5, 2021
2 parents 1298aef + b1bb0ef commit d5c1586
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 37 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ jobs:
- name: create certificates
run: make certs
- name: run test
run: |
./rebar3 compile #required for coverage reporting
tools/travis-test.sh -p $PRESET -s true -e true
run: tools/travis-test.sh -p $PRESET -s true -e true
- name: prepare coverage report
run: ./rebar3 codecov analyze --lcov --json false
- name: report coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp _build/test/cover/*.coverdata /tmp
./rebar3 coveralls send
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: small_tests on OTP ${{matrix.otp}}
path-to-lcov: ./lcov.info
parallel: true

big_tests:
name: ${{matrix.preset}} on OTP ${{matrix.otp}}
Expand Down Expand Up @@ -68,19 +69,22 @@ jobs:
- if: ${{ matrix.preset == 'odbc_mssql_mnesia' }}
run: sudo apt-get install -y tdsodbc
- name: build releases
run: |
./rebar3 compile #required for coverage reporting
tools/build-releases.sh
run: tools/build-releases.sh
- name: build big tests
run: tools/travis-build-tests.sh
- name: start backends
run: tools/travis-setup-db.sh
- name: run test
run: tools/travis-test.sh -p $PRESET -s false -e false
- name: prepare coverage report
run: ./rebar3 codecov analyze --lcov --json false
- name: report coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./rebar3 coveralls send
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{matrix.preset}} on OTP ${{matrix.otp}}
path-to-lcov: ./lcov.info
parallel: true

coveralls_webhook:
needs: [big_tests, small_tests]
Expand Down
3 changes: 1 addition & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@
[
{pc, "1.11.0"},
{provider_asn1, "0.2.3"},
{rebar3_codecov, {git, "https://github.com/esl/rebar3_codecov.git", {ref, "6bd31cc"}}},
{coveralls, "2.2.0"},
{rebar3_codecov, {git, "https://github.com/esl/rebar3_codecov.git", {ref, "b08b90e"}}},
{rebar3_lint, "0.1.11"}
]}.

Expand Down
23 changes: 2 additions & 21 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,5 @@ MaybeFIPSSupport = fun(Config) ->
end
end,

MaybeConfigureCoveralls = fun(CONFIG) ->
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")} | 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
end,

Config0 = MaybeConfigureCoveralls(CONFIG),
Config1 = SetupIncludedApps(Config0, EnvApps),
MaybeFIPSSupport(Config1).
Config0 = SetupIncludedApps(CONFIG, EnvApps),
MaybeFIPSSupport(Config0).

0 comments on commit d5c1586

Please sign in to comment.