GitHub Action failed to read lcov.info files in different folder from root

Before submitting a topic, please confirm the following

I have searched for similar issues before creating this topic.
I have verified that my repository is using the Codecov GitHub app, if using GitHub
I have validated my codecov.yaml configuration file.
I have filled out the below sections to the best of my ability.

Description

I tried to include Codecov in my Flutter project, it works fine with top level coverage, and found my lcov.info in root/coverage/, but there’s another coverage i’d like Codecov to cover, it’s in root/packages/packageA/coverage, and Codecov failed to cover it. I’ve tried to use directory and also files, but both failed.

CI/CD URL

Try to use files try with file, wish I'm lucky · suesitran/interactive_diary@7d4ef04 · GitHub

Codecov Output

2022-08-01T13:30:54.8198140Z ##[group***Run codecov/codecov-action@v3 2022-08-01T13:30:54.8199240Z with: 2022-08-01T13:30:54.8200130Z verbose: true 2022-08-01T13:30:54.8201090Z fail_ci_if_error: true 2022-08-01T13:30:54.8202240Z directory: ./packages/nartus_ui_package/coverage/ 2022-08-01T13:30:54.8203310Z env: 2022-08-01T13:30:54.8212550Z JAVA_HOME: /Users/runner/hostedtoolcache/Java_Zulu_jdk/11.0.16-8/x64 2022-08-01T13:30:54.8214020Z FLUTTER_ROOT: /Users/runner/hostedtoolcache/flutter/stable-3.0.5-x64 2022-08-01T13:30:54.8215580Z PUB_CACHE: /Users/runner/hostedtoolcache/flutter/stable-3.0.5-x64/.pub-cache 2022-08-01T13:30:54.8216760Z ##[endgroup*** 2022-08-01T13:30:55.0267920Z ==> macos OS detected 2022-08-01T13:30:57.7021090Z https://uploader.codecov.io/latest/macos/codecov.SHA256SUM 2022-08-01T13:30:57.8190690Z ==> SHASUM file signed by key id 806bb28aed779869 2022-08-01T13:30:58.0950360Z ==> Uploader SHASUM verified (5c2a45f8581731c23a6622e4d12315a50f491163560b84f4fdc3b7e512431d3b codecov) 2022-08-01T13:30:58.0952510Z ==> Running version latest 2022-08-01T13:30:58.2103380Z ==> Running version v0.2.4 2022-08-01T13:30:58.2135020Z [command***/Users/runner/work/_actions/codecov/codecov-action/v3/dist/codecov -n -Q github-action-3.1.0 -Z -s ./packages/nartus_ui_package/coverage/ -v 2022-08-01T13:30:58.9248660Z [2022-08-01T13:30:58.922Z*** ['verbose'*** Start of uploader: 1659360658922... 2022-08-01T13:30:58.9252770Z [2022-08-01T13:30:58.924Z*** ['info'*** 2022-08-01T13:30:58.9254540Z _____ _ 2022-08-01T13:30:58.9255960Z / ____| | | 2022-08-01T13:30:58.9257590Z | | ___ __| | ___ ___ _____ __ 2022-08-01T13:30:58.9259430Z | | / _ \ / _ |/ _ / / _ \ \ / /
2022-08-01T13:30:58.9276580Z | |
| () | (| | __/ (| () \ V /
2022-08-01T13:30:58.9278470Z _
____/ _,|_|____/ _/
2022-08-01T13:30:58.9279410Z
2022-08-01T13:30:58.9280190Z Codecov report uploader 0.2.4
2022-08-01T13:30:58.9420570Z [2022-08-01T13:30:58.941Z*** [‘info’*** => Project root located at: /Users/runner/work/interactive_diary/interactive_diary
2022-08-01T13:30:58.9438290Z [2022-08-01T13:30:58.943Z*** [‘info’*** → No token specified or token is empty
2022-08-01T13:30:58.9440530Z [2022-08-01T13:30:58.943Z*** [‘verbose’*** Start of network processing…
2022-08-01T13:30:58.9442550Z [2022-08-01T13:30:58.943Z*** [‘verbose’*** Searching for files in /Users/runner/work/interactive_diary/interactive_diary
2022-08-01T13:30:58.9809240Z [2022-08-01T13:30:58.980Z*** [‘verbose’*** coveragepy is not installed
2022-08-01T13:30:58.9811140Z [2022-08-01T13:30:58.980Z*** [‘info’*** Searching for coverage files…
2022-08-01T13:30:59.0125480Z [2022-08-01T13:30:59.011Z*** [‘info’*** Warning: Some files located via search were excluded from upload.
2022-08-01T13:30:59.0128620Z [2022-08-01T13:30:59.011Z*** [‘info’*** If Codecov did not locate your files, please review Supported Coverage Report Formats
2022-08-01T13:30:59.0134270Z [2022-08-01T13:30:59.012Z*** [‘error’*** There was an error running the uploader: No coverage files located, please try use `-f`, or change the project root with `-R`
2022-08-01T13:30:59.0136700Z [2022-08-01T13:30:59.012Z*** [‘verbose’*** The error stack is: Error: No coverage files located, please try use `-f`, or change the project root with `-R`
2022-08-01T13:30:59.0138480Z at main (/snapshot/repo/dist/src/index.js)
2022-08-01T13:30:59.0140080Z at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-08-01T13:30:59.0141950Z [2022-08-01T13:30:59.012Z*** [‘verbose’*** End of uploader: 90 milliseconds
2022-08-01T13:30:59.0750290Z ##[error***Codecov: Failed to properly upload: The process ‘/Users/runner/work/_actions/codecov/codecov-action/v3/dist/codecov’ failed with exit code 255`

Expected Results

Codecov finds all lcov.info in all sub packages and include them in report

Actual Results

codecov could not find all lcov.info files

@suesitran this could be a silly thing, but could you run CI/CD with a step before Codecov just to make sure that file exists? Maybe cat ./packages/nartus_ui_package/coverage/lcov.info?

Actually that’s the reason, and the failure is not because of codecov, but because of Flutter, I noted that issue in my article here: Flutter — Interactive Diary — A developer diary #5 | by Suesi Tran | Medium

It turned out, flutter test command does not generate lcov.info for all tests in all sub packages, so I have to run that command in each package separately

This command will fail to generate lcov.info in packages/*/ folder
flutter test test packages/*/test --coverage

So fix with this
for d in $(ls packages); do cd packages/$d; flutter test --coverage; cd -; done

It works, although it does not look elegant :slight_smile:

1 Like

Got it! Thanks for the write up @suesitran!!