-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use bash-cache command for .strings validation
#19624
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,7 @@ | ||
| #!/bin/bash -eu | ||
|
|
||
| echo "--- :rubygems: Setting up Gems" | ||
| install_gems | ||
|
|
||
| echo "--- :cocoapods: Setting up Pods" | ||
| install_cocoapods | ||
|
|
||
| echo "--- :writing_hand: Copy Files" | ||
| mkdir -pv ~/.configure/wordpress-ios/secrets | ||
| cp -v fastlane/env/project.env-example ~/.configure/wordpress-ios/secrets/project.env | ||
|
|
||
| echo "--- Lint Localized Strings Format" | ||
| LOGS=logs.txt | ||
| set +e | ||
| set -o pipefail | ||
| bundle exec fastlane generate_strings_file_for_glotpress skip_commit:true | tee $LOGS | ||
| EXIT_CODE=$? | ||
| set -e | ||
|
|
||
| echo $EXIT_CODE | ||
|
|
||
| if [[ $EXIT_CODE -ne 0 ]]; then | ||
| # Strings generation finished with errors, extract the errors in an easy-to-find section | ||
| echo "--- Report genstrings errors" | ||
| ERRORS=errors.txt | ||
| echo "Found errors when trying to run \`genstrings\` to generate the \`.strings\` files from \`*LocalizedStrings\` calls:" | tee $ERRORS | ||
| echo '' >> $ERRORS | ||
| # Print the errors inline. | ||
| # | ||
| # Notice the second `sed` call that removes the ANSI escape sequences that | ||
| # Fastlane uses to color the output. | ||
| grep -e "\[.*\].*genstrings:" $LOGS \ | ||
| | sed -e 's/\[.*\].*genstrings: error: /- /' \ | ||
| | sed -e $'s/\x1b\[[0-9;]*m//g' \ | ||
| | sort \ | ||
| | uniq \ | ||
| | tee -a $ERRORS | ||
| # Annotate the build with the errors | ||
| cat $ERRORS | buildkite-agent annotate --style error --context genstrings | ||
| fi | ||
|
|
||
| exit $EXIT_CODE | ||
| lint_localized_strings_format | ||
|
Comment on lines
-13
to
+7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 🧹 🧹 ✨ |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
I wonder whether we would benefit from removing the
before_allcheck for this env file and instead rely on the lanes that need secret values to check for their availability.WordPress-iOS/fastlane/Fastfile
Lines 124 to 126 in adbb17e
This is the first time the global check bothers me. I guess that's because it's the first time I need to setup the file only to satisfy the check, not because the code I run needs a value from it.
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.
I actually wondered about this in the past too.
Probably for another PR, and even a small "project" to not only change this on all repos, but also probably get rid of the requirement for
~/.*-env.defaultfiles too (which have been bothering me too, not only because those files clutters my$HOME, but also because I don't use those in practice, as I put all my tokens and the likes that we expect in those files… in my~/.zshrcanyway (since they are mostly the same values for all repos, and I prefer having a single source of truth than one per project)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.
+1
We could devise a system that checks the environment for all the required tokens, then delegate to each user how to provide them.
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.
It happens that I also just talked about a similar topic with @rynaardb minutes ago, because putting all my tokens in
~/.zshrclike I've been doing will create an issue now that I'll have to do Tumblr releases, which will likely use similar ENV var names for GitHub and Buildkite tokens and the like… but will need different values for it.My braindump idea to improve on that while avoid polluting
$HOMEso that each user can provide the required tokens, but still be able to have different tokens (and different values for the same ENV vars) for different repos would basically be:And then add
local.envto the.gitignore(†).That way users will have the liberty to either not use that
local.envfile at all and just declare their ENV vars in~/.zshrcor wherever they prefer… or, if that's more convenient for them (especially for Release Managers who do releases of different apps that require different tokens), create alocal.envfile at the root of the dir where they cloned the repo and use that.(†) The name of the
local.envfile is inspired from the name of thelocal.propertiesfile used in a similar fashion for Android Projects to define Java properties only for the local user)