orgoro / coverage

GitHub Action for python coverage publish & analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: "could not read file cover.xml"

AJ-Gonzalez opened this issue · comments

commented

``hello,

I am having trouble with this action finding the xml file generated by coverage.

I have tried multiple paths and file names, and I am unsure as to why it does not recognize it.

As far as I have read, the docs don't specify a path where it should be.

What am I doing wrong here?

Here is my workflow yaml:

name: 'coverage'
on:
    pull_request:
        branches:
            - master
            - main
jobs:
    coverage:
        runs-on: ubuntu-latest
        steps:
          - name: Get Cover 
            uses: orgoro/coverage@v3.1
            with:
                coverageFile: cover.xml
                token: ${{ secrets.GITHUB_TOKEN }}

Am I missing the token? or does it grab it automatically?

You forgot to create the file. As I solved this:

name: 'coverage'
on:
    pull_request:
        branches:
            - master
            - main
jobs:
    coverage:
        runs-on: ubuntu-latest
        steps:
         - name: Run pytest
           run: python -m pytest --cov-report xml:coverage.xml
          - name: Get Cover 
            uses: orgoro/coverage@v3.1
            with:
                coverageFile: cover.xml
                token: ${{ secrets.GITHUB_TOKEN }}

After this, follow:
#248

commented

Thank you, yeah, I tried creating the file in the repo, i did not realize it had to be created in the workflow.
I'm gonna try this

Quick question, how do I set my thresholds?

commented

Okay I got it working with:

name: 'coverage'
on:
    pull_request:
        branches:
            - master
            - main
jobs:
    coverage:
        runs-on: ubuntu-latest
        steps:
          - name: Install Pytest
            run: pip install pytest pytest-cov
          - name: Run pytest
            run: python -m pytest --cov-report xml:coverage.xml
          - name: Get Cover 
            uses: orgoro/coverage@v3.1
            with:
                coverageFile: cover.xml
                token: ${{ secrets.GITHUB_TOKEN }}

It is not pickup up my unit tests with the unittest python module.

        run: python -m pytest --cov-report xml:coverage.xml.
            coverageFile: cover.xml

It is not pickup up my unit tests with the unittest python module.

I noticed that your file names don't match. :)