coverallsapp/github-action

Python relevant lines not properly computed in the coverage

enekomartinmartinez opened this issue · 2 comments

The coverage computed by pytest in the GHA is correct. However, it seems that Coveralls is not able to interpret the relevant lines, and when a Python line is split shows all the lines as uncovered, except for the last line.

image

image

CI instruction we are using:

      - name: Test and coverage
        run: pytest tests/ --cov=pysd -n 2
      - name: Coveralls
        uses: coverallsapp/github-action@v2
        if: ${{ matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest' }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

https://github.com/SDXorg/pysd/blob/6d90f38c36118b0f7f2cb4eb4a274c20ff2c66c9/.github/workflows/ci.yml

We have been using run: coveralls --service=github instead of uses: coverallsapp/github-action@v2, which was uploading the coverage properly, but started failing on Friday.

We have also tried running the coverage with Python 3.7 and 3.11, and any of them adequately computed the total coverage. However, there were differences in the coverage values as described in #108

Thanks a lot!

mrexox commented

Hey! Thank you for the feedback. Actually coverage-reporter has only a beta support for Python.

So, I can suggest you adding a following step:

# Create an xml version of coverage report
coverage xml
coveralls -f coverage.xml

Or provide a file option to github action:

- run: coverage xml

- uses: coverallsapp/github-action@v2
  with:
    file: coverage.xml

Thanks a lot @mrexox. It worked as expected!

Adding the same documentation from https://github.com/coverallsapp/coverage-reporter#pytest-cov-test_tube-beta in this repo may be helpful to avoid further issues.