-
Notifications
You must be signed in to change notification settings - Fork 8
Promo screenshots action refinements #685
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
base: trunk
Are you sure you want to change the base?
Promo screenshots action refinements #685
Conversation
Otherwise, every hit (and there are many) of the method would print the path in the logs. Example: ``` [20:09:25]: ------------------------------- [20:09:25]: --- Step: promo_screenshots --- [20:09:25]: ------------------------------- [20:09:25]: Creating Promo Screenshots /opt/homebrew/bin/drawText [20:09:25]: ✅ Original Screenshot Source: /Users/gio/Developer/a8c/wcios/fastlane/screenshots /opt/homebrew/bin/drawText [20:09:25]: ✅ Translation source: /Users/gio/Developer/a8c/wcios/fastlane/metadata /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText [20:09:26]: ▸ ✅ Font "Helvetica Neue" found and active /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText [20:09:26]: ✅ Output Folder: /Users/gio/Developer/a8c/wcios/fastlane/promo_screenshots /opt/homebrew/bin/drawText [20:09:26]: 💙 Creating Promo Screenshots for: ar-SA, de-DE, en-US [20:09:26]: Do you want to overwrite the existing promo screenshots? (y/n) y /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /opt/homebrew/bin/drawText /Users/gio/Developer/a8c/wcios/vendor/bundle/ruby/3.2.0/gems/fastlane-plugin-wpmreleasetoolkit-13.8.1/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb:410: warning: passing a block without an image argument is deprecated ... ```
Felt pretty dumb when I looked in the screenshots folder and realized that it was empty because, duh, I didn't run the automation.
See how rmagick/rmagick#1279 addressed the same issue.
Doing so prevents printing the long `drawText` message and making the logs noisy. I tried using `command:` and `log: false` to silence that (as per fastlane/fastlane#14945) but it didn't work.
Generated by 🚫 Danger |
| end | ||
|
|
||
| UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText') | ||
| UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText > /dev/null') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, we'd get a long list of command -v drawText output.
As a side note, this line seems to be called many times. We should cache, memoize, or otherwise implement a way to run this check only once.
| Action.sh('drawText', "html=#{text}", "maxWidth=#{width}", "maxHeight=#{height}", "output=#{temp_text_file.path}", "fontSize=#{font_size}", "stylesheet=#{stylesheet_path}", "alignment=#{position}") | ||
| system( | ||
| 'drawText', | ||
| "html=#{text}", | ||
| "maxWidth=#{width}", | ||
| "maxHeight=#{height}", | ||
| "output=#{temp_text_file.path}", | ||
| "fontSize=#{font_size}", | ||
| "stylesheet=#{stylesheet_path}", | ||
| "alignment=#{position}" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fastlane's sh should support logs: false to silence the call, but it did not parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Image.new(width, height) do | ||
| self.background_color = working_background | ||
| Image.new(width, height) do |info| | ||
| info.background_color = working_background | ||
| end | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addresses a deprecation warning. See commit message for more details.
| message = <<~MESSAGE | ||
| Unable to locate #{path}. | ||
| Did you run the automation to generate the screenshots? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case I go through the same process of pondering why annotating non existing screenshots fails again.
| Did you run the automation to generate the screenshots? | ||
| MESSAGE | ||
| UI.user_error!(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used user_error! instead of crash! because it makes less noise in the logs as it doesn't give a stacktrace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one 👍
What does it do?
I tried running the screenshot annotation on my end and it failed. Internal ref p1768453313053599/1768288277.528279-slack-CC7L49W13.
The reason it failed is that I didn't have screenshots images to annotate. That's obvious in hindsight, but it took me a bit to understand in between the dense logs.
This PR tracks the changes I made to cleanup the logs.
Note
As discussed in the thread, I haven't been able to test the changes yet in terms of actually calling down to ImageMagick. Still, I'd appreciate your feedback.
Checklist before requesting a review
bundle exec rubocopto test for code style violations and recommendations.specs/*_spec.rb) if applicable. — N.A.bundle exec rspecto run the whole test suite and ensure all your tests pass.CHANGELOG.mdfile to describe your changes under the appropriate existing###subsection of the existing## Trunksection.MIGRATION.mdfile to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider. — N.A.