Skip to content

Commit

Permalink
Add test coverage from Coveralls in CI (#281)
Browse files Browse the repository at this point in the history
* fix deramp residual and optimizer

* Add coveralls GitHub Actions routine

* Rename job build into test for coveralls

* Generate coverage output with pytest

* Specify path to pytest coverage file

* Convert coverage file to lcov format

* Add coverage badge
  • Loading branch information
rhugonnet authored Aug 24, 2022
1 parent d7ef951 commit 63c3da4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
branches: [ main ]

jobs:
build:
test:
name: ${{ matrix.os }}, python ${{ matrix.python-version}}
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -56,4 +56,30 @@ jobs:
python -c "from xdem.examples import *; download_longyearbyen_examples(overwrite=False)"
- name: Test with pytest
run: |
pytest -ra -n=auto
pip install pytest-cov coveralls
pytest -ra -n=auto --cov=xdem/
# We can skip the conversion step once this PR of pytest is merged: https://github.com/pytest-dev/pytest-cov/pull/536
# and replace pytest argument by --cov-report=lcov
- name: Converting coverage to LCOV format
run: |
pip install coveragepy-lcov
coveragepy-lcov --data_file_path .coverage --output_file_path coverage.info
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.test_number }}
path-to-lcov: coverage.info
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Upload to Coveralls finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ More documentation to come!
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/xdem.svg)](https://anaconda.org/conda-forge/xdem)
[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/xdem.svg)](https://anaconda.org/conda-forge/xdem)
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/xdem.svg)](https://anaconda.org/conda-forge/xdem)
[![Coverage Status](https://coveralls.io/repos/github/GlacioHack/xdem/badge.svg?branch=main)](https://coveralls.io/github/GlacioHack/xdem?branch=main)

To cite this package: [![Zenodo](https://zenodo.org/badge/doi/10.5281/zenodo.4809697.svg)](https://zenodo.org/record/4809698)

Expand Down

0 comments on commit 63c3da4

Please sign in to comment.