Add GitHub workflow for checking API compatibility #2182
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #2171
This currently only runs as GitHub workflow but not as part of a regular Maven build. It first checks out the pull request base, builds the project and installs the artifacts into the local Maven repository. Then it checks out the pull request head builds it and compares the artifacts with the previous ones.
The API differences report is uploaded as GitHub artifact, an example can be seen here: https://github.com/google/gson/actions/runs/2905297668
Note that the artifact is produced even when there are non-breaking changes, or no changes. Though in these cases the workflow won't fail.
This is mainly a proof-of-concept, I don't know how well this approach will work for real pull requests.
This uses https://github.com/siom79/japicmp. I don't know whether it covers all cases, so it would be good to not rely on it exclusively.