Integrate coveralls with github actions

Somehow I thought it worked automatically, but we had to provide the
token.

The configuration is based on Coveralls instructions to run parallel
builds [1].

Alternatively we could use the Coveralls GitHub Action [2] which
slightly simplifies the workflow configuration and removes the
dependency of the coveralls gem. However, it also adds a dependency on
simplecov-lcov and requires configuring it to renerate LCOV files on
each run, so the benefits of using it are not that big.

[1] https://docs.coveralls.io/parallel-build-webhook
[2] https://github.com/coverallsapp/github-action/
This commit is contained in:
Javi Martín
2020-12-01 21:40:22 +01:00
parent a504921eca
commit 45693e084b
3 changed files with 14 additions and 3 deletions

View File

@@ -1 +0,0 @@
service_name: travis-ci

View File

@@ -19,10 +19,13 @@ jobs:
POSTGRES_USER: consul
POSTGRES_PASSWORD: ""
env:
CI_BUILD_NUMBER: ${{ github.run_number }}
COVERALLS_FLAG_NAME: run-${{ matrix.ci_node_index }}
COVERALLS_PARALLEL: true
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
PGUSER: consul
POSTGRES_HOST: postgres
RAILS_ENV: test
COVERALLS: true
strategy:
fail-fast: false
matrix:
@@ -55,3 +58,12 @@ jobs:
with:
name: screenshots
path: tmp/screenshots
coveralls:
runs-on: ubuntu-18.04
needs: tests
env:
CI_BUILD_NUMBER: ${{ github.run_number }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
steps:
- name: Finish coveralls
run: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CI_BUILD_NUMBER&payload[status]=done"

View File

@@ -1,5 +1,5 @@
ENV["RAILS_ENV"] ||= "test"
if ENV["COVERALLS"]
if ENV["COVERALLS_REPO_TOKEN"]
require "coveralls"
Coveralls.wear!("rails")
end