codecov / codecov-bash

Global coverage report uploader for Codecov
https://codecov.io
Apache License 2.0
234 stars 155 forks source link

.gitignore file can break uploaded reports #376

Closed RobertoPrevato closed 3 years ago

RobertoPrevato commented 3 years ago

Hi, The .gitignore file can affect the behavior of uploaded reports and make them unusable - I didn't see this documented in the parts explaining how to integrate using GitHub actions.

I know because:

  1. in February 2020 I tried to give Codecov a try for my public projects in GitHub, and I wasn't able to make them work in any way
  2. a few days ago I decided to try a second time, and I succeeded to configure Codecov in this project
  3. then I tried again to configure Codecov for the project that was failing in February, and it was failing in the same way (i.e. reports uploaded successfully but failed to parse)

I later noticed that this was caused by my .gitignore file, which came from a generic template from Azure DevOps for Python projects.

Click to expand and see the .gitignore file ``` # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so .vscode # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ venv htmlcov .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .idea test-cov.xml test-output.xml */*.py,cover junit ```

When I updated my .gitignore file to look like the following, reports started working (for example, for this other project):

.vscode
venv
htmlcov
.coverage
__pycache__
*.egg-info
*.tar.gz
.mypy_cache

You can see in the GitHub workflow files how I am using Codecov.

Side notes:

thomasrockhu commented 3 years ago

@RobertoPrevato would you be able to open a ticket on our community boards for this?

RobertoPrevato commented 3 years ago

@thomasrockhu I created a bug report here: https://community.codecov.io/t/gitignore-file-can-break-uploaded-reports/2330