JuliaRegistries / TagBot

Creates tags, releases, and changelogs for your Julia packages when they're registered
https://github.com/marketplace/actions/julia-tagbot
MIT License
91 stars 18 forks source link

Fix subdirectory tagging #282

Closed sloede closed 11 months ago

sloede commented 12 months ago

Fixes #281.

Note that this uses the suggestion by @ericphanson in https://github.com/JuliaRegistries/TagBot/issues/281#issuecomment-1717640641 to proceed with tagging if the corresponding commit could be identified from the registry PR and if the subdirectory hash of that commit matches the Julia package version tree hash.

cc @bgeihe

ericphanson commented 12 months ago

Is this something that we could easily add a test for? Or would that be a big effort?

sloede commented 12 months ago

Is this something that we could easily add a test for? Or would that be a big effort?

I am not sure how I would easily add a test for it, to be honest.

Any test would probably need to go into https://github.com/JuliaRegistries/TagBot/blob/7ac587806eabe2831c819161afa2eb81834c9c43/test/action/test_repo.py#L209-L226 What is hard to mock, however, is the _git.command(...). I checked other functions that directly run git commands, and, e.g., _versions_clone is also not tested explicitly as far as I can tell (since it would require a mock git repo somewhere with all the right ingredients. Beside this call to git, there is not really much else that could be checked.

Do have any other suggestions?

ericphanson commented 12 months ago

No, I am unfortunately not familiar with the code either, but I totally believe it's hard to test. In that case since the feature is totally broken currently I think it makes sense to fix it still without adding a test. However it would be great if someone more familiar w/ the code could give it a review.

sloede commented 11 months ago

@christopher-dG it would be great if you could review this. I tested the code manually with our repo that originally caused this error to surface, and it seems like everything has been fixed. As stated above, adding tests for this is hard, since we would have to mock an entire git repo.

christopher-dG commented 11 months ago

Seems good 👍

sloede commented 11 months ago

Thanks a lot for for bearing with me, with TagBot v1.16.1 we finally have our first successful, TagBot-created release for the subdirectory package LibTrixi.jl (which is part of https://github.com/trixi-framework/libtrixi).

ericphanson commented 11 months ago

Awesome! FYI, you can now configure Documenter to build stable docs based on tag prefixes, if you want to: https://documenter.juliadocs.org/dev/man/hosting/#Deploying-from-a-monorepo (another subdir feature thanks to @hannahilea!). Although I see you aren't using prefixes on your tags, so maybe that's irrelevant in this case.

sloede commented 11 months ago

You're right, we don't use prefixes, but thanks for letting me know 👍