Search code examples
githubcontinuous-integrationgithub-actionscode-coveragecodecov

Where is coverage.xml located in Codecov?


I use /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml but I think the path is not correct. My report is not uploading on GitHub Actions.

Full file.


Solution

  • The coverage file is located at /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml. In general, it is /home/runner/work/<project>/<project>/coverage.xml.

    I 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/[email protected]
          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.