airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.1k stars 107 forks source link

Embed proguard rule for generated provider class #341

Closed mataku closed 1 year ago

mataku commented 1 year ago

Summary

Embed proguard rules for Codegen class so that minifyEnabled applications do not need additional rules.

Since the Codegen class extends the ShowkaseProvider class, additional rules are unnecessary for each application by providing rules for types that extend the ShowkaseProvider class.

consumerProguardRules is already specified in the project, so I added to it. https://github.com/airbnb/Showkase/blob/4a09e3ff1d3ef71c6b151b5c7deefc82529691c0/showkase/build.gradle#L15

refs. https://github.com/airbnb/Showkase/issues/199, https://github.com/airbnb/Showkase/issues/244

Context

Currently, we need to add extra proguard rules if we set minifyEnabled as true

@ShowkaseRootModule
class SampleShowkaseRootModule : ShowkaseRootModule

// Showkase generated class
public class SampleShowkaseRootModuleCodegen : ShowkaseProvider
# application proguard rules
-keep class **.SampleShowkaseRootModuleCodegen { }
mataku commented 1 year ago

@vinaygaba There seems to be a problem with ui-testing workflow on GitHub Actions. I think macos-10.15 labelled runner is no longer available, so created a pull request to fix it: https://github.com/airbnb/Showkase/pull/342

Announcement: https://github.blog/changelog/2022-07-20-github-actions-the-macos-10-15-actions-runner-image-is-being-deprecated-and-will-be-removed-by-8-30-22/

Available Runners: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

mataku commented 1 year ago

@vinaygaba Thanks for merging https://github.com/airbnb/Showkase/pull/342! Is there anything else I should do?

mataku commented 1 year ago

The workflow execution seems to be unstable. The previous commit passed and the latest commit failed. I will look log details

vinaygaba commented 1 year ago

@mataku yeah these builds have been flaky and I have not had the time to investigate. Any help on this front will be greatly appreciated 🙏🏻

mataku commented 1 year ago

I think this pull request itself doesn't affect CI workflow's result because all projects in Showkase set minifyEnabled as false so generated apk doesn't apply R8 or proguard.

I investigated test results in my forked repo: https://github.com/mataku/Showkase/actions (WIP)

ShowcaseBrowserTest#customAnnotatedPrivateComposablesShouldCompileButNotShow results ss- 2023-08-25 14 09 08
mataku commented 1 year ago

@vinaygaba How about treating instability in CI workflow as a new issue? If possible, I will create a new one.

For some time now, macOS specification on GitHub Actions has been out of date and the CI workflow has not been running, I don't understand the overall problem, but I think it was probably there originally as a potential issue.

In my investigation, the logs are printed unknown state, as if there is a system problem in the output or no logs at all in the first place, and the test will pass in many cases if it is retried. If tests related to changes in a pull request fail, the workflow will fail every time, so you can distinguish between the two.

vinaygaba commented 1 year ago

@mataku Yeah it's unrelated to your PR. I just would appreciate some help in figuring out what causes the flakiness. Additionally, even after removing the tests that were running on API 28, I continue to see them in the list above. I'll merge this PR in the meanwhile.

mataku commented 12 months ago

@vinaygaba

Additionally, even after removing the tests that were running on API 28

I think you still have left the (deleted) API 28 workflow set as "Require status checks to pass before merging"? Please check the Branch protection rules in Showkase repository settings

sample screenshot screenshot 2023-08-27 19 37 34
vinaygaba commented 11 months ago

@mataku I've reverted this PR. More explanation on why in the PR I updated it with - https://github.com/airbnb/Showkase/pull/354