-
Notifications
You must be signed in to change notification settings - Fork 370
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
ci: ensure snapshots are always cleaned up #903
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
☔ View full report in Codecov by Sentry. |
5c6b065
to
ae45387
Compare
This should be landed after #904 |
It might be worth it to change the bash script to python to improve readability, the ubuntu-latest image should come with python preinstalled. (https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md). |
Yes, but local environments (such as Windows) might not - I'm also not sure if it'll actually be that much more readable given how small the script is (I think it's mainly the |
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.
LGTM, thanks! I think having it in Python actually makes it easier to run on Windows right? As they won't have bash/grep unless they are running on Linux.
True though all of our other scripts are written in bash so Windows users will need "bash" installed already (and that doesn't mean they have to use Linux-on-Windows) |
How does the snapshot cleanups affect our acceptance tests if we have snapshots in them? Will it "cleanup" snapshots for those skipped tests? |
No, that's why we our skipping is done using https://github.com/gkampitakis/go-snaps?tab=readme-ov-file#skipping-tests |
While doing google#902 I realised we've got a couple of packages using snapshots but not cleaning them up afterwards - this adds a basic script to check for that, based on the existence of the `__snapshots__` directory. Here's what the annotations look like: <img width="739" alt="image" src="https://github.com/google/osv-scanner/assets/3151613/b85d4500-6d00-4faa-a8d0-6dc1358b4b80"> Note that because annotations are only shown for _files_, we annotate the first test file in a directory that doesn't contain `testmain_test.go` to ensure it is visible.
While doing #902 I realised we've got a couple of packages using snapshots but not cleaning them up afterwards - this adds a basic script to check for that, based on the existence of the
__snapshots__
directory.Here's what the annotations look like:
Note that because annotations are only shown for files, we annotate the first test file in a directory that doesn't contain
testmain_test.go
to ensure it is visible.