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

[MOB-2565] Browserstack Upload Automation via Fastlane #684

Merged

Conversation

d4r1091
Copy link
Member

@d4r1091 d4r1091 commented May 16, 2024

MOB-2565

Context

As part of the Firefox Upgrade work, we would like to automate the upload of the newest builds so that QA won't need to manually checkout branches and build to produce a .app to upload via Web to the Browserstack portal.

Approach

  • Add the Fastlane's browserstack plugin
  • implement into Fastlane as part of the AppCenter work as the resulting build is the same
  • Env vars securely stored in CircleCI

Other

  • Updated Fastlane
  • Once we'll get it done (Firefox upgrade merged), the target branch will be always main

Before merging

Checklist

  • I verified the workflow correctly triggered

@d4r1091 d4r1091 requested a review from a team May 16, 2024 15:20
Copy link

@lucaschifino lucaschifino left a comment

Choose a reason for hiding this comment

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

Nice! 🤖

Added a couple comments about organising them into separate jobs, let me know what you think 🙏

Already approving it anyway as it works both ways and maybe I'm missing a reason to split them 🙂

@@ -40,7 +40,7 @@ jobs:
name: Build and deploy to Testflight
command: bundle exec fastlane testflight_beta

build-and-deploy-appcenter:
build-and-deploy-appcenter-and-browserstack:

Choose a reason for hiding this comment

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

Personally I'd say this is more organised if split into two separate jobs that run in the same workflow consecutively or in parallel

desc "Deploy to MS App-Center"
lane :appcenter do
desc "Deploy to MS App-Center + Browserstack"
lane :upload_to_appcenter_and_browserstack do

Choose a reason for hiding this comment

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

Or maybe at least could be two different fastlane actions to avoid this and pattern and leaving a single responsibility.

@d4r1091
Copy link
Member Author

d4r1091 commented May 21, 2024

@lucaschifino will comment here. Good call on splitting them, personally would have gone that way as default.
However, for the sake of saving CircleCI credits as well as the timing hence servers energy (♻️), I went after coupling the job.
Whenever an action like gym performs a build that results in a successful one, some lane-specific environment variables are being set. Those will contain the path to the resulting Derived Data as well as the Product (.app, .ipa) paths.
By having a single gym action, we'll get for free the resulting product needed to upload the build to those two different services without having to perform another process or call another lane.
There is a middle step like creating another lane but that lane would be called as part of the appcenter one in order to be able to pass the parameters to its subsequent separated browserstack one. However, that would result in fake decoupling as both will be inevitably linked anyway.

@lucaschifino
Copy link

@lucaschifino will comment here. Good call on splitting them, personally would have gone that way as default. However, for the sake of saving CircleCI credits as well as the timing hence servers energy (♻️), I went after coupling the job. Whenever an action like gym performs a build that results in a successful one, some lane-specific environment variables are being set. Those will contain the path to the resulting Derived Data as well as the Product (.app, .ipa) paths. By having a single gym action, we'll get for free the resulting product needed to upload the build to those two different services without having to perform another process or call another lane. There is a middle step like creating another lane but that lane would be called as part of the appcenter one in order to be able to pass the parameters to its subsequent separated browserstack one. However, that would result in fake decoupling as both will be inevitably linked anyway.

Got it, makes sense! Thanks for explaining! ❤️♻️

Follow up question: if we leave them as consecutive actions on the same CircleCI workflow (with the one that generates the .ipa first) can't we still separate them but use the same previously generated file? I understand the file path is an environment variable right now, wonder wether we could set it up for the whole workflow instead of specific jobs.

FYI: If that is possible but takes too much effort, also no problem leaving it like you did imo.

@d4r1091
Copy link
Member Author

d4r1091 commented May 21, 2024

Yeah can do that 💯 but would be OK at job level - setting it at workflow level would mean going by tentative on setting things up as we need to pass the env var back to CircleCI so that it can set it up at workflow level (if works). In that case the workflow won't be renamed.

@d4r1091 d4r1091 force-pushed the MOB-2565_browserstack_upload_automation branch from 3df4b36 to 7eec30d Compare May 21, 2024 12:18
@d4r1091 d4r1091 force-pushed the MOB-2565_browserstack_upload_automation branch from 9559bcf to aba23f3 Compare May 21, 2024 13:20
@d4r1091
Copy link
Member Author

d4r1091 commented May 21, 2024

@lucaschifino achieved what we agreed on by utilizing a bit of hard coding but still coherent and unified. What we intended was indeed tried by myself in previous experiences and forgot not being possible.

@d4r1091 d4r1091 requested a review from lucaschifino May 21, 2024 14:50
Copy link

@lucaschifino lucaschifino left a comment

Choose a reason for hiding this comment

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

Looks great and already more organised, thanks! 🎉

Comment on lines +72 to +74
- run:
name: Upload to Browserstack
command: bundle exec fastlane upload_to_browserstack

Choose a reason for hiding this comment

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

👏

@d4r1091 d4r1091 merged commit 722ae35 into MOB-2012_firefox_120_upgrade May 21, 2024
@d4r1091 d4r1091 deleted the MOB-2565_browserstack_upload_automation branch May 21, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants