From 8202c19d0fd24413c892414a62233fc437437bce Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 27 Sep 2023 19:49:17 -0400 Subject: [PATCH] ci: add codecov --- .github/workflows/python-tests.yml | 14 +++++++++++++- README.rst | 4 ++++ codecov.yml | 15 +++++++++++++++ gsms/__init__.py | 0 gsms.py => gsms/gsms.py | 0 requirements-dev.txt | 1 + scripts/build.py | 2 +- tests/unit/test_gsms.py | 2 +- 8 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 codecov.yml create mode 100644 gsms/__init__.py rename gsms.py => gsms/gsms.py (100%) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index a5cfc98..6f8f0bf 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -24,5 +24,17 @@ jobs: python -m pip install -r requirements-dev.txt - name: Test with pytest + id: test + shell: bash run: | - python -m pytest -v + python -m pytest \ + -rxXs \ + --tb=native \ + --verbose \ + --cov=gsms \ + tests + + - name: Upload coverage + # any except cancelled or skipped + if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure') + uses: codecov/codecov-action@v3 diff --git a/README.rst b/README.rst index 6ef283a..023b15a 100644 --- a/README.rst +++ b/README.rst @@ -128,3 +128,7 @@ Stats .. image:: https://img.shields.io/github/stars/lizardbyte/gsms?logo=github&style=for-the-badge :alt: GitHub stars :target: https://github.com/LizardByte/GSMS + +.. image:: https://img.shields.io/codecov/c/gh/LizardByte/GSMS?token=IC678AQFBI&style=for-the-badge&logo=codecov&label=codecov + :alt: Codecov + :target: https://codecov.io/gh/LizardByte/GSMS diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..c9d3a1a --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +--- +codecov: + branch: master + +coverage: + status: + project: + default: + target: auto + threshold: 10% + +comment: + layout: "diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes diff --git a/gsms/__init__.py b/gsms/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gsms.py b/gsms/gsms.py similarity index 100% rename from gsms.py rename to gsms/gsms.py diff --git a/requirements-dev.txt b/requirements-dev.txt index 3e98ba5..bc18aba 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,3 +2,4 @@ flake8==6.1.0 pyinstaller==6.0.0 pytest==7.4.2 +pytest-cov==4.1.0 diff --git a/scripts/build.py b/scripts/build.py index e2aaad1..04dd4b0 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -14,7 +14,7 @@ def build(): """Sets arguments for pyinstaller, creates spec, and builds binaries.""" pyinstaller_args = [ - 'gsms.py', + 'gsms/gsms.py', '--onefile', '--noconfirm', '--paths=./', diff --git a/tests/unit/test_gsms.py b/tests/unit/test_gsms.py index d544bd1..8e05f45 100644 --- a/tests/unit/test_gsms.py +++ b/tests/unit/test_gsms.py @@ -7,7 +7,7 @@ import pytest # local imports -import gsms +from gsms import gsms def test_windows_guid_wrapper():