Skip to content
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

chore: Create workflow to build sample app with latest SDK release #457

Merged
merged 6 commits into from
Oct 30, 2024

Conversation

mahmoud-elmorabea
Copy link
Contributor

@mahmoud-elmorabea mahmoud-elmorabea commented Oct 25, 2024

Motivation

At the moment we don't have any sample apps that is built by pulling our SDK releases from Maven Central. That is the closest form to what our customers experience. So we want to start building those sample apps to:

  • Make sure that the sample apps build fine with the released version on Maven Central
  • Allow our internal Tech support, Customer success and other stakeholders to test and reproduce customers experience with our SDK

Proposal

  • New testing group on Firebase has been created only for sample apps with released SDK versions called public
  • The new workflow can be triggered manually or with Github API
  • A follow up to this change, we will trigger this workflow after the Deploy SDK workflow runs successfully

@mahmoud-elmorabea mahmoud-elmorabea self-assigned this Oct 25, 2024
Copy link

github-actions bot commented Oct 25, 2024

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.86%. Comparing base (8b30804) to head (939d8e1).
Report is 14 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #457      +/-   ##
============================================
+ Coverage     41.98%   51.86%   +9.88%     
- Complexity      259      291      +32     
============================================
  Files            99       96       -3     
  Lines          2320     2570     +250     
  Branches        344      352       +8     
============================================
+ Hits            974     1333     +359     
+ Misses         1247     1133     -114     
- Partials         99      104       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Build available to test
Version: MBL-553-build-sample-app-for-sdk-release-SNAPSHOT
Repository: https://s01.oss.sonatype.org/content/repositories/snapshots/

Copy link

github-actions bot commented Oct 25, 2024

📏 SDK Binary Size Comparison Report

No changes detected in SDK binary size ✅

@mahmoud-elmorabea mahmoud-elmorabea marked this pull request as ready for review October 25, 2024 12:31
@mahmoud-elmorabea mahmoud-elmorabea requested a review from a team October 25, 2024 12:31
touch "samples/local.properties"
echo "cdpApiKey=${{ secrets.CUSTOMERIO_JAVA_WORKSPACE_CDP_API_KEY }}" >> "samples/local.properties"
echo "siteId=${{ secrets.CUSTOMERIO_JAVA_WORKSPACE_SITE_ID }}" >> "samples/local.properties"
echo "sdkVersion=${{ env.SDK_VERSION }}" >> "samples/local.properties"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The sample app build scripts already check for sdkVersion here and this will cause the public release to be used instead of local project

end
end

lane :build_sample_app_for_sdk_release do |values|
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted for creating a new lane since the existing one is already fairly complicated. Also if we decide to move to a single app, we can just deprecate the older lane.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm unsure about this because again, both lanes have 70% of the same code, apart from some hardcoded values in this lane. I don't mind separate lane, but then could we probably move the shared code in methods that both lanes can utilize?

Also, could you point out the complicated parts in the other lane so we can see how we can make them less complicated in future?

for example, something like this, ensure, that when you are testing a feature branch we don't show the version of the SDK in user agent, but rather the branch its being tested on.

    UI.important("Updating the SDK's source code version to non-production version. This allows the sample apps to show the SDK version at runtime for app user to better understand the version of the SDK they are running.")
    sh("../../../scripts/update-version.sh \"#{new_app_version}.#{new_build_number}\"")

Copy link
Contributor

@Shahroz16 Shahroz16 left a comment

Choose a reason for hiding this comment

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

Thanks for the implementation! While both workflows/lanes serve different purposes, I notice there's significant code duplication that could lead to several issues:
such as maintenance burden and being error prone.

I have added couple of suggestions, let me know if they are helpful. Even if we don't move towards a more configurable approach we should at least remove duplication and use shared resources.

end
end

lane :build_sample_app_for_sdk_release do |values|
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm unsure about this because again, both lanes have 70% of the same code, apart from some hardcoded values in this lane. I don't mind separate lane, but then could we probably move the shared code in methods that both lanes can utilize?

Also, could you point out the complicated parts in the other lane so we can see how we can make them less complicated in future?

for example, something like this, ensure, that when you are testing a feature branch we don't show the version of the SDK in user agent, but rather the branch its being tested on.

    UI.important("Updating the SDK's source code version to non-production version. This allows the sample apps to show the SDK version at runtime for app user to better understand the version of the SDK they are running.")
    sh("../../../scripts/update-version.sh \"#{new_app_version}.#{new_build_number}\"")

@customerio customerio deleted a comment from github-actions bot Oct 28, 2024
@customerio customerio deleted a comment from github-actions bot Oct 29, 2024
@customerio customerio deleted a comment from github-actions bot Oct 29, 2024
@mahmoud-elmorabea mahmoud-elmorabea force-pushed the MBL-553-build-sample-app-for-sdk-release branch from 1fdad4c to bac56b2 Compare October 29, 2024 12:03
@mahmoud-elmorabea
Copy link
Contributor Author

@Shahroz16 I've extract common code in both Fastlane and the workflow and it's now shared.

@mahmoud-elmorabea mahmoud-elmorabea force-pushed the MBL-553-build-sample-app-for-sdk-release branch from bac56b2 to 279c8cb Compare October 29, 2024 12:13
@customerio customerio deleted a comment from github-actions bot Oct 29, 2024
@mahmoud-elmorabea mahmoud-elmorabea force-pushed the MBL-553-build-sample-app-for-sdk-release branch from 279c8cb to f9f32c7 Compare October 29, 2024 12:21
Copy link

  • java_layout: MBL-553-build-sample-app-for-sdk-release (1730204564)

Copy link

  • kotlin_compose: MBL-553-build-sample-app-for-sdk-release (1730204564)

Copy link
Contributor

@Shahroz16 Shahroz16 left a comment

Choose a reason for hiding this comment

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

Looks good just one suggestion regarding secrets simplified usage

.github/workflows/build-sample-app-for-sdk-release.yml Outdated Show resolved Hide resolved
.github/workflows/build-sample-apps.yml Outdated Show resolved Hide resolved
Copy link

  • java_layout: MBL-553-build-sample-app-for-sdk-release (1730254044)

Copy link

  • kotlin_compose: MBL-553-build-sample-app-for-sdk-release (1730254043)

@mahmoud-elmorabea mahmoud-elmorabea merged commit 7fbc1be into main Oct 30, 2024
33 of 35 checks passed
@mahmoud-elmorabea mahmoud-elmorabea deleted the MBL-553-build-sample-app-for-sdk-release branch October 30, 2024 10:26
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.

3 participants