Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badges for flags does not work for my project #308

Closed
Sajjon opened this issue Mar 23, 2024 · 13 comments
Closed

Badges for flags does not work for my project #308

Sajjon opened this issue Mar 23, 2024 · 13 comments

Comments

@Sajjon
Copy link

Sajjon commented Mar 23, 2024

Bug / Help needed

Badges for specific flags does not work in open source project "Sargon" (github repo, codecov)

Environment

Brave 1.64.109
macOS 14.2

Reproduce

Example of working repo

See this open source repo named "fhircore", clicking here shows its:
"Repo" badge

In this PR see see three flags: [engine, geowidget, quest]
Screenshot 2024-03-23 at 10 36 01

So I try badges for these flags, by appending the &flag=<FLAG> query param to the base badge url, at it works, for all three!

My non working repo

In my repo Sargon I recently added support for three flags: rust, kotlin and swift, you see them working e.g. in this PR:

Screenshot 2024-03-23 at 10 41 28

So I now expect, just like the "fhircore" repo, to be able to generate badges for these three flags! Alas, it does not work!

The "repo badge" works for Sargon. But when I try adding the flag=<FLAG> e.g. flag=rust query parameter, like this;
https://codecov.io/gh/radixdlt/Sargon/graph/badge.svg?token=8QPKIUSAQD&flag=rust

it does not work, shows as "unknown".
Screenshot 2024-03-23 at 10 42 57

Neither does the two other flags: swift nor kotlin work :/

I have even enabled "flag analysis", and you can see all the flags here...

I did not work before when I did not have a codecov.yml and does not work when I the one from the working repo "fhircore", here is mine (with carryforward flags enabled, not sure it relates... but that is what "fhircore" used).

Expected behavior

I expected to be able to get "flag based badges" to work in Sargon, just like the "fhircore" repo has....

Additional Context

Here is the Github workflow (CI) for tests that produced the reports I took a screenshot of above, it has a Rust tests step, Swift tests step and Kotlin tests step, each one uploads to code cov using their approriate flag, see:

upload with "rust" flag
upload with "kotlin" flag
upload with "swift" flag

And once again, as seen in PR Codecov successfully produces a report with all the flags, so I really do not understand why I cannot get the per Flag Badges to work?

Please help :) thank you!

@drazisil-codecov
Copy link

Hi @Sajjon ,

Did you set carryforward:true https://github.com/radixdlt/sargon/blame/061d1fd65e4911af13be96ad81393df3e25da99e/codecov.yml#L15 before, or after you last uploaded coverage for the flags? On your latest commit, https://app.codecov.io/gh/radixdlt/sargon/commit/6915cf8385bf663a92b54e152998b9907fe64b3b, I see a single upload with no flags.

@Sajjon
Copy link
Author

Sajjon commented Mar 25, 2024

@drazisil-codecov The commit 6915cf8 you linked to is the last commit according to CodeCov, hmm why? 10 commits has been made since, see: https://github.com/radixdlt/sargon/commits/develop/

hmm...The carryforward:true was added in the PR which resulted in merge commit 6915cf8.

@drazisil-codecov
Copy link

@Sajjon ,

Can you link me where in your CI pipeline for are calling the Codecov uploader? I don't see any chaks from Codecov on any of the newer commits, so I want to see what happened during the upload.

@Sajjon
Copy link
Author

Sajjon commented Mar 25, 2024

@drazisil-codecov I provided that in my initial post, see the three links under Additional Context

@Sajjon
Copy link
Author

Sajjon commented Mar 25, 2024

See report from today: radixdlt/sargon#37 (comment)

CodeCov is working beatifully, we really love the tool, just that badges for flags does not work.

And what you found was strange, that https://app.codecov.io/github/radixdlt/Sargon/commits only shows 8 days old commits....

@drazisil-codecov
Copy link

Hi @Sajjon

Because that's the last commit on your default branch. Looking into badges still.

@drazisil-codecov
Copy link

drazisil-codecov commented Mar 25, 2024

@Sajjon ,

And that commit doesn't have flag data. Your recent ones do https://codecov.io/gh/radixdlt/Sargon/branch/uniffi-exposed/graph/badge.svg?token=8QPKIUSAQD&flag=rust, but they aren't on your default branch (note the change in the URL)

@Sajjon
Copy link
Author

Sajjon commented Mar 25, 2024

@drazisil-codecov ahh I see my error, the reason why Codecov does not see newer commits, I've accidentally specified main branch in Github workflow: https://github.com/radixdlt/sargon/blob/develop/.github/workflows/test.yml#L8, but my primary branch is develop (main branch does not exist). Maybe that is why the badges does not work.. And maybe the
https://codecov.io/gh/radixdlt/Sargon/graph/badge.svg?token=8QPKIUSAQD one is old, from the 8 days old commit ?

@drazisil-codecov
Copy link

Hi @Sajjon

Yes, that is correct. Without the branch being passed, like in my link above, it shows the default branch. Which, didn't have flag data 8 days ago :)

@Sajjon
Copy link
Author

Sajjon commented Mar 25, 2024

silly me! I will come back soon and confirm that flag badges work, when I've fixed my silly mistake!

@Sajjon
Copy link
Author

Sajjon commented Mar 26, 2024

@drazisil-codecov works like a charm, thanks for helping me! See README

I would just like to ask you if you could check with your colleagues (if you are not yourself in charge ofc ) if you can add support for customizing the "badge text", which was requested on community.codecov 2 years ago. Since it is not possible today, I had to make this somewhat ugly markdown table for my badges:

Screenshot 2024-03-26 at 18 39 43

This would be very pretty if I could use the flag value as the text of the badge (or fully customized).

@drazisil-codecov
Copy link

@Sajjon I have repeatedly begged Codecov NOT to put me in charge! lol

@rohan-at-sentry , before I create a new feature request, can you take a peek at https://community.codecov.com/t/how-to-change-badge-text/3584 ? I really thought I saw that as a feature request before, but I can only find #106, which doesn't appear to cover changing the text on the badge.

@rohan-at-sentry
Copy link

rohan-at-sentry commented Apr 3, 2024

@Sajjon @drazisil-codecov - I'm creating a feature request for customizing the badge text (#317) , and closing out this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting for: Product Owner
Development

No branches or pull requests

3 participants