python-3.xgithubgithub-actionscode-coveragecodecov

How to set up Codecov for Github?


I am getting Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v2/dist/codecov' failed with exit code 255 (https://github.com/eftalgezer/SIESTAstepper/actions/runs/3077344665/jobs/4972146066)

I have changed the Codecov version 3 to version 2, tried https://github.com/codecov/codecov-action/issues/598, Configuring codecov token in GitHub Actions .yaml for an R package, codecov fails in github actions but nothing works.

codecov.yml

python-package.yml

Edit:

I am getting Error: Codecov: Error validating uploader: Misformed armored text error in the latest version, 3.1.0. (https://github.com/eftalgezer/SIESTAstepper/actions/runs/3077489502/jobs/4972389835)

Edit:

Now I am getting the following error. (https://github.com/eftalgezer/SIESTAstepper/actions/runs/3077712442/jobs/4972763464)

Run codecov/codecov-action@v3.1.0
==> linux OS detected
https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (0146032e40bc0179db3afa3de179dab4da59ece0449af03d881f3c509eaabc8b  codecov)
==> Running version latest
==> Running version v0.3.1
/home/runner/work/_actions/codecov/codecov-action/v3.1.0/dist/codecov -n  -Q github-action-3.1.0 -e OS,PYTHON -f /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml -F unittests -s ./coverage/reports/
[2022-09-18T15:42:37.909Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.3.1
[2022-09-18T15:42:37.918Z] ['info'] => Project root located at: /home/runner/work/SIESTAstepper/SIESTAstepper
[2022-09-18T15:42:37.921Z] ['info'] ->  Token found by environment variables
[2022-09-18T15:42:37.928Z] ['info'] Searching for coverage files...
[2022-09-18T15:42:37.975Z] ['error'] None of the following appear to exist as files: /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml
[2022-09-18T15:42:37.976Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files!

Solution

  • The coverage file was not created. I have solved it with the following code.

        - name: Generate Report
          run: |
            pip install codecov
            pip install pytest-cov
            pytest --cov=./ --cov-report=xml
            codecov
        - name: Upload coverage to Codecov
          uses: codecov/codecov-action@v3.1.0
          with:
            token: ${{ secrets.CODECOV_TOKEN }}
            directory: ./coverage/reports/
            env_vars: OS,PYTHON
            files: /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml
            flags: tests
    

    Full code is here.