diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..0e83325 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,42 @@ +name: coverage + +on: + push: + branches: [ master, dev ] + pull_request: + branches: [ master, dev ] + +jobs: + coverage: + runs-on: ${{ matrix.platform }} + strategy: + max-parallel: 1 + matrix: + platform: + - ubuntu-latest + python-version: ['3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements_test.txt + pip install tox + pip install codecov + - name: Test + run: | + tox -r -e cov + - name: Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests + file: ./coverage.xml + name: adc_eval + fail_ci_if_error: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9bc50f3..076f74e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: [3.11] steps: - uses: actions/checkout@v2 diff --git a/README.rst b/README.rst index 8d86eea..fa08338 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -python-adc-eval |Lint| |PyPi Version| |Codestyle| -=================================================== +python-adc-eval |Lint| |PyPi Version| |Codecov| |Codestyle| +============================================================= A python-based ADC evaluation tool, suitable for standalone or library-based usage @@ -52,3 +52,5 @@ Given an array of values representing the output of an ADC, the spectrum can be :target: https://pypi.org/project/python-adc-eval .. |Codestyle| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black +.. |Codecov| image:: https://codecov.io/gh/fronzbot/python-adc-eval/graph/badge.svg?token=156GMQ4NNV + :target: https://codecov.io/gh/fronzbot/python-adc-eval diff --git a/tox.ini b/tox.ini index 8765e6f..fc9bbe1 100644 --- a/tox.ini +++ b/tox.ini @@ -31,3 +31,12 @@ ignore_errors = True commands = pip install . +[testenv:cov] +setenv = + LANG=en_US.UTF-8 + PYTHONPATH = {toxinidir} +commands = + pytest --timeout=9 --durations=10 --cov=adc_eval --cov-report=xml {posargs} +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/requirements_test.txt