coverallsapp / github-action

Coveralls Github Action
https://coveralls.io
MIT License
455 stars 76 forks source link

Coveralls does not process xml generated by pytest-cov #174

Closed s-martin closed 1 year ago

s-martin commented 1 year ago

hi, I generate coverage with pytest-cov. See below:

   - name: Test with pytest
      working-directory: ./components/gpio_control
      run: |
        pip install -r requirements.txt
        pytest --cov --cov-report xml
    - name: Report to Coveralls
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        path-to-lcov: ./components/gpio_control/coverage.xml

When coveralls parses the xml it fails. Any ideas?

Using lcov file: ./components/gpio_control/coverage.xml
Error:  "2023-05-10T19:33:48.683Z"  'error from lcovParse: ' 'Failed to parse string'
Error:  "2023-05-10T19:33:48.684Z"  'input: ' '<?xml version="1.0" ?>\n' +
  '<coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="0.7143" lines-covered="575" lines-valid="805" timestamp="[1683747228379](tel:1683747228379)" version="7.2.5">\n' +
  '\t<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.2.5 -->\n' +
  '\t<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->\n' +
  '\t<sources>\n' +
  '\t\t<source></source>\n' +
  '\t</sources>\n' +
  '\t<packages>\n' +
  '\t\t<package branch-rate="0" complexity="0" line-rate="0.3283" name=".">\n' +
  '\t\t\t<classes>\n' +
  '\t\t\t\t<class branch-rate="0" complexity="0" filename="__init__.py" line-rate="1" name="__init__.py">\n' +
  '\t\t\t\t\t<methods/>\n' +
  '\t\t\t\t\t<lines/>\n' +
  '\t\t\t\t</class>\n' +
  '\t\t\t\t<class branch-rate="0" complexity="0" filename="config_compatibility.py" line-rate="0.07812" name="config_compatibility.py">\n' +
  '\t\t\t\t\t<methods/>\n' +
  '\t\t\t\t\t<lines>\n' +
  '\t\t\t\t\t\t<line hits="1" number="2"/>\n' +
  '\t\t\t\t\t\t<line hits="1" number="3"/>\n' +
  '\t\t\t\t\t\t<line hits="1" number="4"/>\n' +
…
s-martin commented 1 year ago

I just fixed it by using v2 and format: cobertura.