codecov-action
codecov-action copied to clipboard
v4 Migration Guide
v4 has breaking changes, but it's not clear what I need to actually do to fix them. There should be easy instructions on how to migrate actions. Especially just the basic case...
I only use two arguments to the action, and it's not uploading coverage now. That's a pretty basic use case but it's not at all clear what I need to do to fix it.
Okay in the end the issue wasn't that I needed to change anything, but that Dependabot PRs didn't have access to CODECOV_TOKEN. Still, a migration guide would have let me get to the conclusion that it wasn't a param change or something faster.
Hi @bmulholland could you kindly explain what needs to be changed (some repo config, some GH actions yml file?) to make the dependabot PRs have access to the env var?
@Bibo-Joshi, you will need to add the CODECOV_TOKEN to the Dependabot secrets in your PR.
The URL will be something like https://github.com/{{ org }}/{{ repo }}/settings/secrets/dependabot
(example)
^ would be very useful to add/link to in https://github.com/codecov/codecov-action?tab=readme-ov-file#dependabot
I have CODECOV_TOKEN in the org level yet I get
Error: Codecov token not found. Please provide Codecov token with -t flag.
in the upload stage of my action https://github.com/fortio/fortio/actions/runs/7788613704/job/21238404141?pr=886#step:5:26
Not sure how to fix it tbh
nvm I needed https://github.com/fortio/fortio/pull/886/commits/8eef6d72772b4a6f4f681222bd48a1737b4107ae
@@ -23,3 +23,5 @@ jobs:
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # pin@v3
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
well I spoke too soon:
==> Running command '/home/runner/work/_actions/codecov/codecov-action/e0b68c6749509c5f83f984dd99a76a1c1a231044/dist/codecov do-upload'
/home/runner/work/_actions/codecov/codecov-action/e0b68c6749509c5f83f984dd99a76a1c1a231044/dist/codecov do-upload -C 9b2decb579a5ed5caba1d3f066f84caf6ba72717
info - 2024-02-05 23:31:53,068 -- ci service found: github-actions
warning - 2024-02-05 23:31:53,079 -- xcrun is not installed or can't be found.
warning - 2024-02-05 23:31:53,081 -- No gcov data found.
warning - 2024-02-05 23:31:53,081 -- coverage.py is not installed or can't be found.
info - 2024-02-05 23:31:53,094 -- Found 1 coverage files to upload
info - 2024-02-05 23:31:53,094 -- > /home/runner/work/fortio/fortio/coverage.txt
info - 2024-02-05 23:31:53,[34](https://github.com/fortio/fortio/actions/runs/7792239057/job/21249853540?pr=886#step:5:35)3 -- Your upload is now processing. When finished, results will be available at: https://app.codecov.io/github/fortio/fortio/commit/9b2decb579a5ed5caba1d3f066f84caf6ba72717
info - 2024-02-05 23:31:53,6[37](https://github.com/fortio/fortio/actions/runs/7792239057/job/21249853540?pr=886#step:5:38) -- Process Upload complete
unusable report
but then that gives
@ldemailly can you open a separate issue with this and a link if possible? Can help try to debug what happened on that upload
Same here, fails with:
warning - 2024-02-10 10:20:19,045 -- /__w/f3d/f3d/source/library/CMakeFiles/libf3d.dir/src/init.cxx.gcno
warning - 2024-02-10 10:20:19,045 -- /__w/f3d/f3d/source/library/CMakeFiles/libf3d.dir/src/options.cxx.gcno
warning - 2024-02-10 10:20:19,045 -- /__w/f3d/f3d/source/library/CMakeFiles/libf3d.dir/src/interactor_impl.cxx.gcno
warning - 2024-02-10 10:20:19,901 -- coverage.py is not installed or can't be found.
Traceback (most recent call last):
File "codecov_cli/main.py", line 81, in <module>
File "codecov_cli/main.py", line 77, in run
File "click/core.py", line 1157, in __call__
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "click/decorators.py", line 33, in new_func
File "codecov_cli/commands/upload.py", line 243, in do_upload
File "codecov_cli/services/upload/__init__.py", line 71, in do_upload_logic
File "codecov_cli/services/upload/upload_collector.py", line 152, in generate_upload_data
File "codecov_cli/services/upload/network_finder.py", line 17, in find_files
File "codecov_cli/helpers/versioning_systems.py", line 111, in list_relevant_files
ValueError: Can't determine root folder
[7475] Failed to execute script 'main' due to unhandled exception!
Warning: Codecov:
Failed to properly upload report: The process '/__w/_actions/codecov/codecov-action/v4/dist/codecov' failed with exit code 1
I've added a token.
same here. I get the following error after updating to v4 in GitHub actions (redacted):
Run codecov/codecov-action@v4
with:
token: ***
flags: backend
files: ./backend/coverage.xml
env:
working-directory: ./backend
pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:3).12.1/x6[4](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:4)
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.1/x[6](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:6)4/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.[12](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:12).1/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
AWS_DEFAULT_REGION: us-east-2
AWS_REGION: us-east-2
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
==> linux OS detected
https://cli.codecov.io/latest/linux/codecov.SHA256SUM
==> Running version latest
==> Running version v0.4.7
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-commit'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-commit
gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key ***: public key "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: Signature made Fri Feb 16 00:53:28 2024 UTC
gpg: using RSA key ***
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: ***
==> Uploader SHASUM verified (***[19](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:20)0a803543b2b codecov)
info - [20](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:21)24-02-16 10:53:05,591 -- ci service found: github-actions
warning - 2024-02-16 10:53:05,594 -- No config file could be found. Ignoring config.
info - 2024-02-16 10:53:05,836 -- Process Commit creating complete
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-report'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-report
info - 2024-02-16 10:53:06,552 -- ci service found: github-actions
warning - 2024-02-16 10:53:06,555 -- No config file could be found. Ignoring config.
info - 2024-02-16 10:53:06,657 -- Process Report creating complete
info - 2024-02-16 10:53:06,657 -- Finished creating report successfully --- {"response": "{\"external_id\":\"7114633a-af8f-40dd-9b0e-0ec748e2ce9d\",\"created_at\":\"2024-02-16T10:53:06.6355[21](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:22)Z\",\"commit_sha\":\"***\",\"code\":null}"}
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov do-upload'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov do-upload -f ./backend/coverage.xml -F backend
info - 20[24](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:25)-02-16 10:53:07,371 -- ci service found: github-actions
warning - 2024-02-16 10:53:07,374 -- No config file could be found. Ignoring config.
warning - 2024-02-16 10:53:07,382 -- xcrun is not installed or can't be found.
warning - 2024-02-16 10:53:07,534 -- No gcov data found.
warning - 2024-02-16 10:53:07,534 -- coverage.py is not installed or can't be found.
info - 2024-02-16 10:53:07,724 -- Found 1 coverage files to upload
info - 2024-02-16 10:53:07,724 -- > /home/runner/work/redbrick-app/redbrick-app/backend/coverage.xml
Traceback (most recent call last):
File "codecov_cli/main.py", line 81, in <module>
File "codecov_cli/main.py", line 77, in run
File "click/core.py", line 1157, in __call__
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "click/decorators.py", line 33, in new_func
File "codecov_cli/commands/upload.py", line 243, in do_upload
File "codecov_cli/services/upload/__init__.py", line 71, in do_upload_logic
File "codecov_cli/services/upload/upload_collector.py", line 167, in generate_upload_data
File "codecov_cli/services/upload/upload_collector.py", line 100, in _produce_file_fixes_for_network
File "codecov_cli/services/upload/upload_collector.py", line 114, in _get_file_fixes
FileNotFoundError: [Errno 2] No such file or directory: 'frontend/src/[path]/[file]'
[8[29](https://github.com/[owner]/[repo]/actions/runs/[run]/job/[job]#step:11:30)9] Failed to execute script 'main' due to unhandled exception!
Warning: Codecov:
Failed to properly upload report: The process '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov' failed with exit code 1
If it's worth noticing, I see the error FileNotFoundError: [Errno 2] No such file or directory: 'frontend/... while the codecov is actually running for backend
@mwestphal @pritamrungta would you be able to provide more information here? A link to CI would be great, but if not, maybe the Codecov step in your CI? Want to try to get this figured out
Hi @thomasrockhu-codecov Mine is a private repo, so I'm not sure if the CI link would be helpful. However, I've included the entire codecov step (command+output) in my message above. Let me know if there's any critical information that's missing which you're specifically looking out for.
Another note in continuation to the last message: When running codecov for frontend subdirectory (flags), it passes without any errors/warnings. So, this is always happening only for backend.
@pritamrungta what happens if you run it with
with:
directory: backend # or ../backend, however you need to get the directory from the current working dir
Previous step:
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.codecov-token }}
flags: backend
files: ${{env.working-directory}}/coverage.xml
Updated step:
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.codecov-token }}
flags: backend
directory: ${{env.working-directory}}
files: ${{env.working-directory}}/coverage.xml
And I still get the following error:
Run codecov/codecov-action@v4
with:
token: ***
flags: backend
directory: ./backend
files: ./backend/coverage.xml
env:
working-directory: ./backend
pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
AWS_DEFAULT_REGION: ***
AWS_REGION: ***
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
==> linux OS detected
https://cli.codecov.io/latest/linux/codecov.SHA256SUM
==> Running version latest
==> Running version v0.4.7
==> Running git config --global --add safe.directory /home/runner/work/[repo]/[repo]
/usr/bin/git config --global --add safe.directory /home/runner/work/[repo]/[repo]
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-commit'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-commit --git-service github
gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key ***: public key "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: Signature made Fri Feb 16 00:53:28 2024 UTC
gpg: using RSA key ***
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: ***
==> Uploader SHASUM verified (05b8306070b7f242adb37232c5cdb62431ba89958d4c08243e5190a803543b2b codecov)
info - 2024-02-27 17:54:56,254 -- ci service found: github-actions
warning - 2024-02-27 17:54:56,257 -- No config file could be found. Ignoring config.
info - 2024-02-27 17:54:56,383 -- Process Commit creating complete
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-report'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-report --git-service github
info - 2024-02-27 17:54:57,094 -- ci service found: github-actions
warning - 2024-02-27 17:54:57,097 -- No config file could be found. Ignoring config.
info - 2024-02-27 17:54:57,266 -- Process Report creating complete
info - 2024-02-27 17:54:57,267 -- Finished creating report successfully --- {"response": "{\"external_id\":\"1f52140d-7c56-4a56-b150-78f0ffddbd01\",\"created_at\":\"2024-02-27T17:54:57.226809Z\",\"commit_sha\":\"***\",\"code\":null}"}
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov do-upload'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov do-upload -f ./backend/coverage.xml -F backend --git-service github -s ./backend
info - 2024-02-27 17:54:57,977 -- ci service found: github-actions
warning - 2024-02-27 17:54:57,980 -- No config file could be found. Ignoring config.
warning - 2024-02-27 17:54:57,982 -- xcrun is not installed or can't be found.
warning - 2024-02-27 17:54:58,134 -- No gcov data found.
warning - 2024-02-27 17:54:58,134 -- coverage.py is not installed or can't be found.
warning - 2024-02-27 17:54:58,225 -- Some files were not found --- {"not_found_files": ["backend/coverage.xml"]}
info - 2024-02-27 17:54:58,309 -- Found 1 coverage files to upload
info - 2024-02-27 17:54:58,309 -- > backend/coverage.xml
Traceback (most recent call last):
File "codecov_cli/main.py", line 81, in <module>
File "codecov_cli/main.py", line 77, in run
File "click/core.py", line 1157, in __call__
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "click/decorators.py", line 33, in new_func
File "codecov_cli/commands/upload.py", line 243, in do_upload
File "codecov_cli/services/upload/__init__.py", line 71, in do_upload_logic
File "codecov_cli/services/upload/upload_collector.py", line 167, in generate_upload_data
File "codecov_cli/services/upload/upload_collector.py", line 100, in _produce_file_fixes_for_network
File "codecov_cli/services/upload/upload_collector.py", line 114, in _get_file_fixes
FileNotFoundError: [Errno 2] No such file or directory: 'frontend/src/[path]/[file].[ext]'
[8482] Failed to execute script 'main' due to unhandled exception!
Warning: Codecov:
Failed to properly upload report: The process '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov' failed with exit code 1
If it helps, this is the successful attempt using codecov/codecov-action@v3 (Previous step):
Run codecov/codecov-action@v3
with:
token: ***
flags: backend
files: ./backend/coverage.xml
env:
working-directory: ./backend
pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
AWS_DEFAULT_REGION: ***
AWS_REGION: ***
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
==> linux OS detected
https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
==> SHASUM file signed by key id ***
==> Uploader SHASUM verified (a66af85a0b56b2179d568067cf951e5b40c440b7cbffc305b6b08bcf9eb17dd8 codecov)
==> Running version latest
==> Running version v0.7.2
/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov -n -Q github-action-3.1.6 -f ./backend/coverage.xml -F backend
[2024-02-27T09:54:09.196Z] ['info']
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Codecov report uploader 0.7.2
[2024-02-27T09:54:09.204Z] ['info'] => Project root located at: /home/runner/work/[repo]/[repo]
[2024-02-27T09:54:09.205Z] ['info'] -> Token found by environment variables
[2024-02-27T09:54:09.217Z] ['info'] Searching for coverage files...
[2024-02-27T09:54:09.354Z] ['info'] => Found 1 possible coverage files:
./backend/coverage.xml
[2024-02-27T09:54:09.354Z] ['info'] Processing ./backend/coverage.xml...
[2024-02-27T09:54:09.370Z] ['info'] Detected GitHub Actions as the CI provider.
[2024-02-27T09:54:09.470Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-3.1.6-uploader-0.7.2&token=*******&branch=master&build=8062733540&build_url=https%3A%2F%2Fgithub.com%2F[owner]%2F[repo]%2Factions%2Fruns%2F8062733540&commit=[sha]&job=[job]&pr=&service=github-actions&slug=[owner]%2F[repo]&name=&tag=&flags=backend&parent=
[2024-02-27T09:54:10.112Z] ['info'] https://app.codecov.io/github/[owner]/[repo]/commit/[sha]
https://storage.googleapis.com/codecov/v4/raw/2024-02-27/55A3687C340065C44CC387762E637446/[sha]/4fc3cfd3-0483-4998-afc0-252cd28c1524.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***&X-Amz-Date=20240227T095410Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=***
[2024-02-27T09:54:10.112Z] ['info'] Uploading...
[2024-02-27T09:54:10.260Z] ['info'] {"status":"processing","resultURL":"https://app.codecov.io/github/[owner]/[repo]/commit/[sha]"}
FWIW, I'm also having a problem migrating from v3 to v4:
'''
debug - 2024-02-28 15:31:14,044 -- Collecting relevant files
Traceback (most recent call last):
File "codecov_cli/main.py", line 81, in
The full log is here:
https://github.com/skupperproject/skupper-router/actions/runs/8082844873/job/22084570489?pr=1428#step:36:305
Here is my changes to our workflow file:
https://github.com/skupperproject/skupper-router/pull/1428/files#diff-d0777657fa3fd81d23aaf7273e58aee453b04e67882517900c56daeef9b3e4c1
I removed the root_dir: setting since - according to the docs it shouldn't be necessary for git-based repo. In any case when I had "root_dir: ." it failed with the same traceback.
thanks
I'm getting a 500 error - not sure how to debug it? https://github.com/jest-community/eslint-plugin-jest/pull/1494
Same issue as @mwestphal : https://github.com/simplesamlphp/simplesamlphp/actions/runs/8102540822/job/22145363574#step:3:99
@thomasrockhu-codecov Let me know if you need anything else..
Hi 👋🏽 For people facing the
File "codecov_cli/helpers/versioning_systems.py", line 111, in list_relevant_files
ValueError: Can't determine root folder
@kgiusti @mwestphal @tvdijen
it should not fail if you set the root_dir option. There are many directory options (root_dir, directory, working_dir), and IIUC root_dir is mandatory when your git repo is not the working dir. The README or the error message might need to be clarified.
At least in my situation I had the exact same traceback and I set the 3 variables to the same value and I don't raise an exception anymore.
I'm not sure if one of these directory inputs should be passed here or if there should be some defaulting logic here.
Hoping it could help
@chouetz I don't have a git repo available at all at this stage. I've generated coverage files several steps before and I'm basically only trying to upload the build-directory.. This used to work fine in v3
I managed to fix the root_dir issue by setting the working-directory: input instead:
working-directory: ${{github.workspace}}/source
token: ${{inputs.codecov_token}}
fail_ci_if_error: true
files: ${{github.workspace}}/source/coverage.info
verbose: true
use_oidc: false
disable_search: true
Hi all, thanks for bearing with us as we rolled out v4. I realize that we should have done a better job of creating resources for our users to migrate, but there were some edge cases that we were unaware of.
This thread has a few too many issues and is hard for us to track and manage. If you are experiencing issues with v4, please open a new issue so that we can tackle appropriately.
Codecov token not found. Please provide Codecov token with -t flag. message does not make any sense when someone is using use_oidc: true and still randomly seems to happen. See https://github.com/ansible/vscode-ansible/actions/runs/9450893352/job/26031544106?pr=1348#step:14:56