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

Test coverage is not triggered by github action #669

Closed
Bachibouzouk opened this issue Nov 18, 2020 · 6 comments · Fixed by #864
Closed

Test coverage is not triggered by github action #669

Bachibouzouk opened this issue Nov 18, 2020 · 6 comments · Fixed by #864
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@Bachibouzouk
Copy link
Collaborator

Bachibouzouk commented Nov 18, 2020

The command to implement in the githut action .github/workflows/main.yml file as the last step is the following:

      - name: Update coverage
        env:
          COVERALLS_REPO_TOKEN: ${{ secrets.coverage_token }}
        run: |
          coverage report -m
          coveralls

This had failed when calling coverage report -m because of an import error on python 3.6 --> need to find out why and a solution

@smartie2076
Copy link
Collaborator

With github actions, this might be difficult to do. Found this workaround, but have no idea if there is a simpler way:
https://itnext.io/github-actions-code-coverage-without-third-parties-f1299747064d

@Bachibouzouk
Copy link
Collaborator Author

I can also update the covering at each release manually

@Bachibouzouk
Copy link
Collaborator Author

Anyone can also run coverage locally to see whether it increased or not

@smartie2076 smartie2076 added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 2, 2021
@smartie2076 smartie2076 mentioned this issue Mar 12, 2021
4 tasks
@Bachibouzouk
Copy link
Collaborator Author

EXECUTE_TESTS_ON=master coverage run -m pytest followed by coverage report -m locally

Using coveralls instead of python-coveralls we could trigger directly on github-action:

https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support

@SabineHaas
Copy link
Collaborator

Hi @Bachibouzouk, what I've found out:

  • no need to add token to secrets, see here --> your line COVERALLS_REPO_TOKEN: ${{ secrets.coverage_token }} is sufficient
  • It is recommended to add the following line COVERALLS_SERVICE_NAME: github see here
  • you can set a threshold for the test coverage to pass:
- name: Check test coverage
      run: coverage report -m --fail-under=${{ matrix.vcs == 'bzr' && 89 || 90 }}

Sadly, I did not get coveralls to run with pvcompare --> No data to report. although I can produce a report locally, see my PR.

I will stop for today and let you know in case I get a step further ;)
Would be happy for your input if you had/have similar problems. I am using python 3.7

@SabineHaas
Copy link
Collaborator

SabineHaas commented Apr 14, 2021

I've managed to upload test coverage automatically at commit, however test coverage is not shown - you can only check the tested / not tested lines (click on modules), see coveralls pvcompare

well, step by step ;)

note that I had to use COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} not COVERALLS_REPO_TOKEN: ${{ secrets.coverage_token }}

Update: maybe there was a bug yesterday at coveralls.io, because now it's working 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants