Skip to content

Commit

Permalink
Merge pull request #32 from BenediktBurger/add-codecov
Browse files Browse the repository at this point in the history
Add codecov to CI
  • Loading branch information
BenediktBurger authored Jan 31, 2024
2 parents ce35915 + 3d8baeb commit ab7ba64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 52 deletions.
63 changes: 12 additions & 51 deletions .github/workflows/pyleco_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ jobs:
run: mypy .

test_coverage:
name: Code Coverage
name: Code Coverage on codecov
runs-on: "ubuntu-latest"
permissions:
contents: write
pull-requests: write
issues: write
defaults:
run:
shell: bash -l {0}
Expand All @@ -93,53 +89,18 @@ jobs:
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install -e .[dev] # editable for covtest
- name: Test for Coverage
run: pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pyleco | tee pytest-coverage.txt
- name: Pytest Coverage Comment
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true
run: pytest --cov=pyleco --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
pytest-coverage-path: ./pytest-coverage.txt
title: Coverage Report
badge-title: PyLECO Coverage
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
remove-link-from-badge: false
unique-id-for-comment: python3
junitxml-path: ./pytest.xml
junitxml-title: Coverage Summary
- name: Check output coverage
if: ${{ success() }}
run: |
echo "Coverage Percentage - ${{ steps.coverageComment.outputs.coverage }}"
echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}"
echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}"
echo "Coverage Warnings - ${{ steps.coverageComment.outputs.warnings }}"
echo "Coverage Errors - ${{ steps.coverageComment.outputs.errors }}"
echo "Coverage Failures - ${{ steps.coverageComment.outputs.failures }}"
echo "Coverage Skipped - ${{ steps.coverageComment.outputs.skipped }}"
echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}"
echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}"
echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}"
- name: Create the Badge
if: ${{ success() }}
continue-on-error: true
uses: schneegans/[email protected]
with:
auth: ${{ secrets.pyleco_coverage_gist_secret }}
gistID: 7a8a7b874b62ed803eb56ca04830bede
filename: pyleco-coverage.json
label: Coverage Report
message: ${{ steps.coverageComment.outputs.coverage }}
color: ${{ steps.coverageComment.outputs.color }}
namedLogo: python
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/reports/
# env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml,!./cache
flags: unittests
name: codecov-umbrella
verbose: true

test:
name: Python ${{ matrix.python-version }}, ${{ matrix.os }}
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ The [reviewed branch](https://github.com/pymeasure/pyleco/tree/reviewed) contain
Development happens in the [main](https://github.com/pymeasure/pyleco/tree/main) branch.

Note: LECO is still under development, such that the code and API might change.
The LECO protocol branch [pyleco-stat](https://github.com/pymeasure/leco-protocol/tree/pyleco-state) contains the assumptions used in this project, which are not yet accepted into the LECO main branch.
The LECO protocol branch [pyleco-state](https://github.com/pymeasure/leco-protocol/tree/pyleco-state) contains the assumptions used in this project, which are not yet accepted into the LECO main branch.
These things might change, if LECO defines them differently.

![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/BenediktBurger/7a8a7b874b62ed803eb56ca04830bede/raw/pyleco-coverage.json)
[![codecov](https://codecov.io/gh/BenediktBurger/pyleco/graph/badge.svg?token=9OB3GWDLRB)](https://codecov.io/gh/BenediktBurger/pyleco)

For a tutorial on how to get started, see [GETTING_STARTED.md](GETTING_STARTED.md).

Expand Down

0 comments on commit ab7ba64

Please sign in to comment.