This is an automated email from the ASF dual-hosted git repository. kocolosk pushed a commit to branch coverage-report in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit 0abb3137c18dbbbf2a063821872fdf180d070680 Author: Adam Kocoloski <kocol...@apache.org> AuthorDate: Wed Nov 10 14:35:07 2021 -0500 Try integrating with coveralls.io --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++++++- rebar.config | 7 ++++++- rebar.config.script | 21 ++++++++++++++++++++- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1c482d..aca30c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,15 +122,41 @@ jobs: persist-credentials: false - name: Compile erlfdb run: rebar3 compile + - name: Execute unit tests + run: rebar3 eunit - name: Execute binding test env: TEST_NAME: ${{ matrix.test-name }} API_VERSION: ${{ matrix.api-version }} - ERL_LIBS: _build/default/lib/erlfdb/ + COVER_ENABLED: true + ERL_LIBS: _build/test/lib/erlfdb/ run: | mkdir -p /usr/src/erlfdb/test/ ln -s $GITHUB_WORKSPACE/test/tester.es /usr/src/erlfdb/test/tester.es /usr/src/foundationdb/bindings/bindingtester/bindingtester.py erlang \ --test-name $TEST_NAME \ --api-version $API_VERSION \ + --instruction-prefix $API_VERSION \ --num-ops 10000 + - name: Upload results to Coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: bindingtest-${{ matrix.test-name }}-${{ matrix.api-version }} + run: rebar3 as test coveralls send + + finish: + needs: [build_on_linux, build_on_windows, binding_tester] + runs-on: ubuntu-latest + steps: + - name: Finalize Coveralls report + run: | + curl https://coveralls.io/webhook \ + --header 'Content-Type: application/json' \ + --data '{ + "repo_name": "${{ github.repository }}", + "repo_token": "${{ secrets.GITHUB_TOKEN }}", + "payload": { + "build_num": ${{ github.run_number }}, + "status": "done" + } + }' diff --git a/rebar.config b/rebar.config index 2b00cba..8ee34ee 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,5 @@ {plugins, [ + coveralls, pc ]}. @@ -37,4 +38,8 @@ verbose ]}. -{cover_enabled, true}. +{cover_enabled , true}. +{cover_export_enabled , true}. +{coveralls_coverdata , "_build/test/cover/*.coverdata"}. % or a string with wildcards or a list of files +{coveralls_service_name , "github"}. +{coveralls_parallel , true}. diff --git a/rebar.config.script b/rebar.config.script index 7a8dbb6..c5b64f0 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -9,6 +9,25 @@ MaxAPIVersion = integer_to_list(APIVersionBytes, 16) end. +% https://github.com/markusn/coveralls-erl#example-usage-rebar3-and-github-actions +CoverallConfig = + 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_flag_name, os:getenv("COVERALLS_FLAG_NAME")} | 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. + [{port_env, [ { "(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", @@ -31,4 +50,4 @@ MaxAPIVersion = "LDFLAGS", "$LDFLAGS /LIBPATH:\"c:/Program Files/foundationdb/lib/foundationdb\" fdb_c.lib" } -]}] ++ CONFIG. +]}] ++ CoverallConfig.