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 authored and MVrachev committed Feb 24, 2021
1 parent d524412 commit 74a51fd
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,39 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
pip install --upgrade tox coveralls
- name: Run tox
run: tox -e ${{ matrix.toxenv }}

- name: Publish on coveralls.io
# TODO: Maybe make 'lint' a separate job instead of case handling here
if: ${{ matrix.toxenv != 'lint' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ runner.os }} / Python ${{ matrix.python-version }} / ${{ matrix.toxenv }}
COVERALLS_PARALLEL: true
# 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 --service=github --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
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: |
python -m pip install --upgrade pip
pip install --upgrade coveralls
coveralls --finish

0 comments on commit 74a51fd

Please sign in to comment.