From f500dadc081a96500395915631dfaaac9a6c5353 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 24 Nov 2022 22:08:34 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Add=20"Linters"=20group=20in=20CI=E2=80=94w?= =?UTF-8?q?e'll=20add=20a=20step=20to=20it=20later?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index cde74f65676..52a5b663e27 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -55,18 +55,20 @@ steps: context: "Unit Tests" ################# - # Lint Translations + # Linters ################# - - label: "🧹 Lint Translations" - command: "gplint /workdir/WooCommerce/Resources/AppStoreStrings.pot" - plugins: - - docker#v3.8.0: - image: "public.ecr.aws/automattic/glotpress-validator:1.0.0" - agents: - queue: "default" - notify: - - github_commit_status: - context: "Lint Translations" + - group: Linters + steps: + - label: "🧹 Lint Translations" + command: "gplint /workdir/WooCommerce/Resources/AppStoreStrings.pot" + plugins: + - docker#v3.8.0: + image: "public.ecr.aws/automattic/glotpress-validator:1.0.0" + agents: + queue: "default" + notify: + - github_commit_status: + context: "Lint Translations" ################# # UI Tests From 93565b0caa360047675eaf8046007bf57bc40ccf Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 24 Nov 2022 22:15:11 +0100 Subject: [PATCH 2/4] Add `skip_commit` option to `generate_strings_file_for_glotpress` --- fastlane/Fastfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 65b2de41113..4efe3f39bc9 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -976,8 +976,15 @@ platform :ios do configure_validate end + # Generates the `.strings` file to be imported by GlotPress, by parsing source code (using `genstrings` under the hood). + # + # + # @option [Boolean] skip_commit (default: false) If true, does not commit the changes made to the `.strings` file. + # + # @called_by complete_code_freeze + # desc 'Updates the main `Localizable.strings` file — that will be imported by GlotPress — from code and `Info.plist` files' - lane :generate_strings_file_for_glotpress do + lane :generate_strings_file_for_glotpress do |options| cocoapods en_lproj_path = File.join(RESOURCES_FOLDER, 'en.lproj') @@ -1006,6 +1013,8 @@ platform :ios do destination: File.join(en_lproj_path, 'Localizable.strings') ) + next if options.fetch(:skip_commit, false) + git_commit( path: en_lproj_path, message: 'Freeze strings for localization', From 09535058c6dc85a4ccd3a45424c6aead14ba7500 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 24 Nov 2022 22:16:01 +0100 Subject: [PATCH 3/4] Use `bash-cache` 2.12.0 with new command for generated `.strings` lint --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 52a5b663e27..eb826e8a34e 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -2,7 +2,7 @@ common_params: # Common plugin settings to use with the `plugins` key. - &common_plugins - - automattic/bash-cache#2.8.0 + - automattic/bash-cache#2.12.0 - automattic/git-s3-cache#v1.1.3: bucket: "a8c-repo-mirrors" # This is not necessarily the actual name of the repo or the GitHub organization From a07fa397ec6a41054f3eff3efa767e3d40bc7309 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 24 Nov 2022 22:20:11 +0100 Subject: [PATCH 4/4] Add step to lint `.strings` generation in CI --- .buildkite/commands/lint-localized-strings-format.sh | 8 ++++++++ .buildkite/pipeline.yml | 5 +++++ 2 files changed, 13 insertions(+) create mode 100755 .buildkite/commands/lint-localized-strings-format.sh diff --git a/.buildkite/commands/lint-localized-strings-format.sh b/.buildkite/commands/lint-localized-strings-format.sh new file mode 100755 index 00000000000..5e4a9f4d3d4 --- /dev/null +++ b/.buildkite/commands/lint-localized-strings-format.sh @@ -0,0 +1,8 @@ +#!/bin/bash -eu + +echo "--- :writing_hand: Copy Files" +SECRETS_DIR=~/.configure/woocommerce-ios/secrets +mkdir -pv $SECRETS_DIR +cp -v fastlane/env/project.env.example $SECRETS_DIR/project.env + +lint_localized_strings_format diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index eb826e8a34e..79565eef3f7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -70,6 +70,11 @@ steps: - github_commit_status: context: "Lint Translations" + - label: ":sleuth_or_spy: Lint Localized Strings Format" + command: .buildkite/commands/lint-localized-strings-format.sh + plugins: *common_plugins + env: *common_env + ################# # UI Tests #################