Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace coveralls with codecov #184

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
21 changes: 21 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# https://docs.codecov.com/docs/pull-request-comments#disable-comment
comment: false

# https://docs.codecov.com/docs/commit-status
coverage:
status:
changes: true
patch: true
project:
default: true
tests:
target: auto
threshold: 1
paths:
- "src/"
# advanced settings
branches:
- main
if_ci_failed: error #success, failure, error, ignore
informational: false
only_pulls: false
43 changes: 2 additions & 41 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,8 @@ on:
- 'v*.*.*dev*' # for testing releases

jobs:
test: # Copied from pytest.yml
name: pytest with coverage
runs-on: ubuntu-latest

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: clone sorunlib
uses: actions/checkout@v4

- name: Lint with flake8
run: |
pip3 install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 ./src/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./src/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Install sorunlib
run: |
pip3 install -e .[tests]

# Unit Tests
- name: Run unit tests
working-directory: ./tests
run: |
COVERAGE_FILE=.coverage.unit python3 -m pytest --cov sorunlib

# Coverage
- name: Report test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv ./tests/.coverage.* ./
pip install coveralls
coverage combine
coverage report
coveralls --service=github
test:
uses: ./.github/workflows/pytest.yml

wheel:
name: build and deploy to PyPI
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
push:
branches:
- main
workflow_call:

jobs:
test:
Expand Down Expand Up @@ -46,17 +47,14 @@ jobs:

# Coverage
- name: Report test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv ./tests/.coverage.* ./
pip install coveralls
coverage combine
coverage xml
coverage report
coveralls --service=github

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ This project is licensed under the BSD 2-Clause License - see the
.. _LICENSE.txt: https://github.com/simonsobs/sorunlib/blob/main/LICENSE.txt


.. |coverage| image:: https://coveralls.io/repos/github/simonsobs/sorunlib/badge.svg?branch=main
:target: https://coveralls.io/github/simonsobs/sorunlib?branch=main
.. |coverage| image:: https://codecov.io/github/simonsobs/sorunlib/graph/badge.svg?token=701SYU7A4I
:target: https://codecov.io/github/simonsobs/sorunlib

.. |docs| image:: https://readthedocs.org/projects/sorunlib/badge/?version=latest
:target: https://sorunlib.readthedocs.io/en/latest/?badge=latest
Expand Down