-
Notifications
You must be signed in to change notification settings - Fork 7
Add test coverage badge to GitHub page with self-contained solution #122
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
Conversation
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
…rkflow Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
…p target Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
kwerle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No - let's avoid using codecov and simply parse the coverage output to get a number.
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Done! I've replaced Codecov with a self-contained solution that parses SimpleCov output directly. The workflow now:
No external services or secrets required. Changes in commit 465825b. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
When I look at https://github.com/kwerle/ruby_language_server/tree/copilot/add-test-coverage-badge?tab=readme-ov-file (the github page for this branch) I see an icon that says custom badge resource not found.
Is that expected?
Makefile
Outdated
| ./bin/run_in_shell "COVERAGE=true bundle exec rake test" | ||
|
|
||
| rubocop: image | ||
| ./bin/run_in_shell bundle exec rubocop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't use run_in_shell on ci because it is interactive. Chnge this to the docker command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Use sed for better portability instead of grep -P | ||
| COVERAGE=$(sed -n 's/.*"coverage":\([0-9.]*\).*/\1/p' coverage/.last_run.json | head -1) | ||
| if [ -z "$COVERAGE" ]; then | ||
| echo "Error: Could not extract coverage percentage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see from the build results that this failed.
https://github.com/kwerle/ruby_language_server/actions/runs/20662551515/job/59328099365
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit ecd8f98. The issue was with the sed regex pattern - it wasn't accounting for optional spaces after the colon in the JSON. The pattern now correctly matches "coverage": 85.7 with or without spaces. I also added debug output to help diagnose future issues.
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Yes, that's expected for now. The badge URL was pointing to the I've fixed this in commit ecd8f98 - the badge URL now points to the feature branch so you should see it working. Once this PR is merged to master (or develop), you'll want to update the URL back to point to the main branch. The badge should now display once the CI run completes successfully. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: kwerle <23320+kwerle@users.noreply.github.com>
Add Test Coverage Badge to GitHub Page
Note: The badge URL in README points to the feature branch for testing. Update to
masterordevelopbranch after merge.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.