Skip to content

Separate tests and badge update#12

Merged
swo merged 1 commit into
mainfrom
swo_badge
Aug 14, 2025
Merged

Separate tests and badge update#12
swo merged 1 commit into
mainfrom
swo_badge

Conversation

@swo

@swo swo commented Aug 13, 2025

Copy link
Copy Markdown
Collaborator

Currently, any time I push a commit to a branch that has an open PR, CI will add another commit, updating the test coverage badge. Most of the time, this is a trivial commit, since the coverage hasn't actually changed, and it's only the timestamp that gets altered.

This caused friction for me because it meant that, at random intervals after I had git pushed to my PR branch, I would need to git pull --rebase, to update the coverage badge based on what had happened in CI.

My proposal here is to only run pytest on every push to a PR-linked branch, but update the coverage branch only when merging into main.

I'm not 100% sure this will work as expected. It might also not be the best approach. For example, one might just drop the timestamp, or maybe run some more complex logic to see if the test coverage actually changed (i.e., run poetry run coverage-badge, writing the bad to some temporary location, and then proceeding to commit it only if the checked-in file and the temporary file differ?).

@swo
swo requested review from cdc-ap66 and ryanraaschCDC August 13, 2025 21:54

@cdc-ap66 cdc-ap66 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. It was an annoying pattern we hadn't got around to fixing. This is much better! LGTM

@swo

swo commented Aug 14, 2025

Copy link
Copy Markdown
Collaborator Author

Let's hope this works!

@swo
swo merged commit a711833 into main Aug 14, 2025
3 checks passed
@swo
swo deleted the swo_badge branch August 14, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants