Skip to content

Commit 0de8555

Browse files
authored
Lint .strings generation in CI (#8214)
2 parents 9a53aad + a07fa39 commit 0de8555

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash -eu
2+
3+
echo "--- :writing_hand: Copy Files"
4+
SECRETS_DIR=~/.configure/woocommerce-ios/secrets
5+
mkdir -pv $SECRETS_DIR
6+
cp -v fastlane/env/project.env.example $SECRETS_DIR/project.env
7+
8+
lint_localized_strings_format

.buildkite/pipeline.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &common_plugins
5-
- automattic/bash-cache#2.8.0
5+
- automattic/bash-cache#2.12.0
66
- automattic/git-s3-cache#v1.1.3:
77
bucket: "a8c-repo-mirrors"
88
# This is not necessarily the actual name of the repo or the GitHub organization
@@ -55,18 +55,25 @@ steps:
5555
context: "Unit Tests"
5656

5757
#################
58-
# Lint Translations
58+
# Linters
5959
#################
60-
- label: "🧹 Lint Translations"
61-
command: "gplint /workdir/WooCommerce/Resources/AppStoreStrings.pot"
62-
plugins:
63-
- docker#v3.8.0:
64-
image: "public.ecr.aws/automattic/glotpress-validator:1.0.0"
65-
agents:
66-
queue: "default"
67-
notify:
68-
- github_commit_status:
69-
context: "Lint Translations"
60+
- group: Linters
61+
steps:
62+
- label: "🧹 Lint Translations"
63+
command: "gplint /workdir/WooCommerce/Resources/AppStoreStrings.pot"
64+
plugins:
65+
- docker#v3.8.0:
66+
image: "public.ecr.aws/automattic/glotpress-validator:1.0.0"
67+
agents:
68+
queue: "default"
69+
notify:
70+
- github_commit_status:
71+
context: "Lint Translations"
72+
73+
- label: ":sleuth_or_spy: Lint Localized Strings Format"
74+
command: .buildkite/commands/lint-localized-strings-format.sh
75+
plugins: *common_plugins
76+
env: *common_env
7077

7178
#################
7279
# UI Tests

fastlane/Fastfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,15 @@ platform :ios do
976976
configure_validate
977977
end
978978

979+
# Generates the `.strings` file to be imported by GlotPress, by parsing source code (using `genstrings` under the hood).
980+
#
981+
#
982+
# @option [Boolean] skip_commit (default: false) If true, does not commit the changes made to the `.strings` file.
983+
#
984+
# @called_by complete_code_freeze
985+
#
979986
desc 'Updates the main `Localizable.strings` file — that will be imported by GlotPress — from code and `Info.plist` files'
980-
lane :generate_strings_file_for_glotpress do
987+
lane :generate_strings_file_for_glotpress do |options|
981988
cocoapods
982989

983990
en_lproj_path = File.join(RESOURCES_FOLDER, 'en.lproj')
@@ -1006,6 +1013,8 @@ platform :ios do
10061013
destination: File.join(en_lproj_path, 'Localizable.strings')
10071014
)
10081015

1016+
next if options.fetch(:skip_commit, false)
1017+
10091018
git_commit(
10101019
path: en_lproj_path,
10111020
message: 'Freeze strings for localization',

0 commit comments

Comments
 (0)