Skip to content

Commit

Permalink
Configure GitHub workflow to publish coverage
Browse files Browse the repository at this point in the history
Re-add coverage publishing on coveralls.io, formerly performed by
Travis CI (prior to theupdateframework#1242), using the coveralls cli tool according
to the documentation:
https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-gotcha

**Considered alternatives:**
- Official coveralls GitHub action, which does not seem to work
  well for Python:
  coverallsapp/github-action#4
  coverallsapp/github-action#30

- Inofficial fork of that action, which seems to work better
  but had issues finding the coverage data in the tests folder,
  or the covered code respectively.
  https://github.com/AndreMiras/coveralls-python-action

Besides aforementioned issues of these actions the use of cli tools
from curated package managers seems slightly preferable over
actions from the GitHub Marketplace (see theupdateframework#1246).

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
  • Loading branch information
lukpueh committed Dec 23, 2020
1 parent 9fdbcd5 commit 9c1d441
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,37 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install --upgrade tox coveralls
- name: Run tox
run: tox -e ${{ matrix.toxenv }}

- name: Publish on coveralls.io
env:
COVERALLS_FLAG_NAME: ${{ runner.os }} / Python ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Use cp workaround to publish coverage reports with relative paths
# FIXME: Consider refactoring the tests to not require the test
# aggregation script being invoked from the `tests` directory, so
# that `.coverage` is written to and .coveragrc can also reside in
# the project root directory as is the convention.
run: |
cp tests/.coverage .
coveralls --rcfile=tests/.coveragerc
coveralls-fin:
# Always run when all 'build' jobs have finished even if they failed
# TODO: Replace always() with a 'at least one job succeeded' expression
# see https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
if: always()
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finalize publishing on coveralls.io
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip3 install --upgrade coveralls
coveralls --finish

0 comments on commit 9c1d441

Please sign in to comment.