Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use only LCOV files? #30

Open
moonkwoo opened this issue Dec 16, 2019 · 29 comments
Open

Can I use only LCOV files? #30

moonkwoo opened this issue Dec 16, 2019 · 29 comments

Comments

@moonkwoo
Copy link

Hello,

My application is based on python and I use pytest-cov to create report file.
The available formats of reports file are terminal, html, xml in pytest-cov.
(c.f. https://pytest-cov.readthedocs.io/en/latest/reporting.html)

Can I use not only LCOV files but also XML, HTML to send report file to coveralls?

@ruippeixotog
Copy link

I have the same question. I'm trying to migrate from Travis to GitHub Actions and I have a cobertura.xml file generated by sbt-scoverage but I can't seem to find a way to convert it to LCOV. Previously I used sbt-coveralls, but they don't support GitHub Actions and I'd rather use the officially supported action anyway.

Would it be a possibility to support some of the most common coverage formats?

@riquellopes
Copy link

Hi guys. I've the same problem with my python application. Do you've a solution to solve this?

@riquellopes
Copy link

Hello,

My application is based on python and I use pytest-cov to create report file.
The available formats of reports file are terminal, html, xml in pytest-cov.
(c.f. https://pytest-cov.readthedocs.io/en/latest/reporting.html)

Can I use not only LCOV files but also XML, HTML to send report file to coveralls?

Hi moonkwoo, to solve I used this tip: https://github.com/aodj/icelandreview/blob/master/.github/workflows/pythonpackage.yml#L30

@Rotendahl
Copy link

The solution provided by @riquellopes works.
However it does not run on forked pull requests like the official action.

A solution that either converts python-coverage to .lcov or extending the official action to support some other format is still needed.

@SVilgelm
Copy link

SVilgelm commented Feb 8, 2020

@nickmerwin Could you give us an example how to use the coverage repo generated by pytest-cov?
@coveralls

@SteadBytes
Copy link

SteadBytes commented Feb 11, 2020

@SVilgelm that output is not supported by this GitHub action (LCOV only) and requires using the coveralls python library instead which, as @Rotendahl pointed out, doesn't work on forked PRs.

@ruippeixotog
Copy link

@nickmerwin are there any plans from Coveralls to officially maintain and/or add new features to this, or was this just an experiment?

@DomAmato
Copy link

no update in months and limited functionality... kind of a shame since the github actions are nice but I guess for tests we can't really rely on this

@chrisjsewell
Copy link

Oh well looks like I'm ditching coveralls for codecov. It's a shame I like coveralls, but if forked PRs aren't supported with GitHub actions/pytest then its not viable for my, and I imagine lots of others, use cases

@AndreMiras
Copy link
Contributor

I made it work and wrote an action for it https://github.com/marketplace/actions/coveralls-python
It's still early so the API may change, always keep an eye on the documentation is something breaks and keep me posted how it works or doesn't work for you

lukehsiao pushed a commit to HazyResearch/fonduer that referenced this issue Apr 12, 2020
Coveralls.io cannot be easily used by GitHub Actions because the secret token is not passed to PRs which are opened by third-party forks (#392). Furthermore, Coveralls.io's GitHub Action only supports LCOV files (coverallsapp/github-action#30). But, coverage.py generates .coverage files. 

Since they are roughly equivalent in functionality for our purpose, we switch from coveralls.io to CodeCov.
@mikeengland
Copy link

mikeengland commented Apr 17, 2020

We also use Python with Coveralls so this is a blocker for us. Unfortunately we create PRs from forked repos which cannot access the Coveralls token secret, so there is no way to use the manual coveralls module to upload the coverage via Github Actions.

tkilias referenced this issue in exasol/sqlalchemy-exasol May 20, 2020
bwillis added a commit to bwillis/versioncake that referenced this issue Jun 7, 2020
The coveralls gem produces JSON formats, but the Coveralls GH Action seems to only support LCOV files: coverallsapp/github-action#30
baztian added a commit to baztian/jaydebeapi that referenced this issue Jun 19, 2020
@baztian
Copy link

baztian commented Jun 19, 2020

Was considering switching to sonarcloud.io but they don't seem to support matrix builds very well: https://community.sonarsource.com/t/cannot-run-sonarsource-sonarcloud-github-action-master-java-not-found/14922

baztian added a commit to baztian/jaydebeapi that referenced this issue Jun 19, 2020
@SVilgelm
Copy link

I moved all my projects to CodeCov, they added tokenless mode for GitHub Actions and it supports any type of coverage reports.

@MarvinT
Copy link

MarvinT commented Jul 3, 2020

For anyone still trying to get pytest working, I think there have been some changes to the env vars needed to run coveralls and get it to find the correct repo on coveralls.io

      - name: Coveralls
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          coveralls

N.B. I have to pip install git+https://github.com/TimoRoth/coveralls-python.git until TheKevJames/coveralls-python#227 is pulled in.

An example configuration is here: greenelab/ponyo#11
but its complicated a bit by using a conda installation to deal with R dependencies

@dinkopehar
Copy link

So, based on OP question, only way to upload coverage in XML is to convert it to lcov format I guess ?

@afinetooth
Copy link
Member

afinetooth commented Jun 10, 2021

@dinko-pehar the answer is yes, only LCOV. That’s for the Coveralls GitHub action on its own. It only accepts LCOV.

That said, some other integrations—language specific, community-created integrations—support other coverage report formats (typically the standard more common to the language), which those integrations convert to the JSON expected by the Coveralls API. (Which is what the Coveralls GitHub Action does—converts LCOV to JSON.)

if you’re working in python, check out this project:
https://github.com/TheKevJames/coveralls-python

(It supports GitHub Actions for CI.)

For other languages, see the Coveralls docs site and look for your language in the left-hand nav:
http://docs.coveralls.io

@dinkopehar
Copy link

I'm looking into Crystal lang. Using some coverage tools compatible with Crystal, it's able to generate cobertura.xml report.
Maybe I can create tool to convert from cobertura to lcov and then upload it. I saw tools which convert lcov to cobertura, so I guess it's possible.

@afinetooth
Copy link
Member

afinetooth commented Jun 10, 2021

@dinko-pehar in that case check out Coveralls’ new Universal Coverage Reporter:
https://github.com/coverallsapp/coverage-reporter

It’s written in Crystal and currently has support for LCOV and SimpleCov.

Maybe you can contribute a plug-in adding read-and-convert support for your standard following its model.

@dinkopehar
Copy link

That's great. I'll have a look at that and how it can be extended I hope.

@AngellusMortis
Copy link

AngellusMortis commented Jul 13, 2021

I managed to get everything working nicely using coveragepy-lcov. It requires Python 3.8+ though so if you have an older version, you may need to do a setup-python to get the correct version after running pytest.

Something similar to:

- name: Setup Python
  uses: actions/setup-python@v2
  with:
    python-version: '3.9'

- name: Covert Coverage Results
  run: |
    pip install coveragepy-lcov
    coveragepy-lcov --data_file_path .coverage --output_file_path lcov.info

- name: Upload Coverage Results
  uses: coverallsapp/github-action@master
  with:
    github-token: ${{ secrets.github_token }}
    path-to-lcov: lcov.info

EDIT: As a note, I am not able to get this to report coverage correctly to Coveralls. Coverage is always being reported as 0%. It might be an issue with coveragepy-lcov or it might be an issue with the paths that the Coveralls Github Action is expecting.

@razzeee
Copy link

razzeee commented Aug 7, 2021

Thanks @AngellusMortis was able to figure it out due to your post
trakt/script.trakt#566

@lluc
Copy link

lluc commented Oct 5, 2021

EDIT: As a note, I am not able to get this to report coverage correctly to Coveralls. Coverage is always being reported as 0%. It might be an issue with coveragepy-lcov or it might be an issue with the paths that the Coveralls Github Action is expecting.

I also have the same problem : in Coveralls, coverage is always reported as 0% 🤔

@riquellopes
Copy link

The simplest was to do this

- name: Test
      env:
        COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
      run: |
        pytest -s -v --cov={project} --cov-report term-missing && coveralls

@maziyarpanahi
Copy link

It would be great to have support for sbt as well. Currently, we do something like:

 - name: Upload coverage data to Coveralls
        run: sbt ++${{ matrix.scala-version }} coverageAggregate coveralls
        env:
          COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COVERALLS_FLAG_NAME: Scala ${{ matrix.scala-version }}

But it doesn't leave a comment this way. Would be great if we can use the official GA support for sbt.

ronawho added a commit to chapel-lang/sphinxcontrib-chapeldomain that referenced this issue Mar 24, 2022
Migrate our sphinx domain to github actions

[reviewed by @lydia-duncan]

Migrate from Travis to Github Actions. Travis is no longer free (or well
supported), so migrate to github actions. For the most part this is a
direct transliteration of the Travis job, but the main coveralls
github-action doesn't work with xml (coverallsapp/github-action#30), so
switch to using codecov, which provides similar functionality.

Here's some resources I used:
- https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
- https://github.com/codecov/codecov-action

Resolves Cray/chapel-private#1804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests