Skip to content

Commit

Permalink
IOS-8394: Misc tech improvements (#4128)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Fedorov <[email protected]>
Co-authored-by: Alexander Osokin <[email protected]>
  • Loading branch information
m3g0byt3 and tureck1y authored Oct 29, 2024
1 parent c065746 commit 09989d1
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 16 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/build-deploy-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ name: Alpha - Build and Deploy
on:
workflow_dispatch:
inputs:
xcode_version_override:
build_version_override:
description: >
Optional Xcode version override. Leave blank (default value) to use the default Xcode version;
pass a custom value (e.g. '16.0', '10.2.1', '11 Beta 7', '11.2 GM seed', etc) to use a different Xcode version for the build
Optional build version override. Leave blank (default value) to use the default value derived from the branch name
type: string
changelog:
description: >
Optional additional info about build
type: string
xcode_version_override:
description: >
Optional Xcode version override. Leave blank (default value) to use the default Xcode version;
pass a custom value (e.g. '16.0', '10.2.1', '11 Beta 7', '11.2 GM seed', etc) to use a different Xcode version for the build
type: string

concurrency:
group: '${{ github.workflow }} (${{ github.head_ref || github.ref_name }})'
Expand All @@ -22,7 +26,7 @@ jobs:
name: Prepare information
runs-on: [self-hosted, active]
outputs:
version: '${{ steps.jira.outputs.key }}'
version: '${{ steps.version.outputs.build_version }}'
stage: Alpha
build_number: '${{ github.run_number }}'
changelog: '${{ steps.changelog.outputs.result }}'
Expand All @@ -41,6 +45,27 @@ jobs:
action: getBranchSummary
branch-name: '${{ github.ref_name }}'

- name: Create version
id: version
env:
JIRA_ISSUE_KEY: '${{ steps.jira.outputs.key }}'
BUILD_VERSION_OVERRIDE: '${{ inputs.build_version_override }}'
run: |
BUILD_VERSION=""
if [[ -n "${BUILD_VERSION_OVERRIDE}" ]]; then
# Use the build version value from user input (if any)
BUILD_VERSION="${BUILD_VERSION_OVERRIDE}"
elif [[ -n "${JIRA_ISSUE_KEY}" ]]; then
# Use the build version value from Jira (if available)
BUILD_VERSION="${JIRA_ISSUE_KEY}"
else
# Fallback to default value
BUILD_VERSION="develop"
fi
echo "build_version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT"
- name: Create changelog
id: changelog
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@
</dict>
</dict>
</dict>
</plist>
</plist>
2 changes: 1 addition & 1 deletion TangemApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15296,7 +15296,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ \"${CI}\" == \"true\" || \"${ENABLE_PREVIEWS}\" == \"YES\" ]]; then\n exit 0\nfi\n\nfind . -name 'Localizable.strings' -not -path './Pods/*' -exec sort {} -o {} \\;\n";
shellScript = "\"./Utilites/sort-strings.sh\"\n";
};
E551D05F64007527CC513710 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
7 changes: 7 additions & 0 deletions Utilites/sort-strings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

if [[ "${CI}" == "true" || "${ENABLE_PREVIEWS}" == "YES" ]]; then
exit 0
fi

find . -name 'Localizable.strings' -not -path './Pods/*' -exec sort {} -o {} \;
1 change: 1 addition & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ lane :update_translations do |options|
lokalise(
destination: destination,
replace_breaks: true,
add_newline_eof: true,
use_original: true,
languages: languages,
export_sort: "a_z",
Expand Down
12 changes: 6 additions & 6 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ Options:
```


A lane that builds and tests SPM modules located in the "Modules" folder.
A separate lane is needed since it's still not possible to run unit tests from remove/local SPM dependencies inside the host app,
see https://forums.swift.org/t/running-swiftpm-tests-inside-project/62760 for details.
Options:
- xcode_version_override: Xcode version to use, optional (uses https://github.com/XcodesOrg/xcodes under the hood)
A lane that builds and tests SPM modules located in the "Modules" folder.
A separate lane is needed since it's still not possible to run unit tests from remove/local SPM dependencies inside the host app,
see https://forums.swift.org/t/running-swiftpm-tests-inside-project/62760 for details.
Options:
- xcode_version_override: Xcode version to use, optional (uses https://github.com/XcodesOrg/xcodes under the hood)


### release
Expand All @@ -54,7 +54,7 @@ Options:
- build: optional build number
- changelog: string for description archive
- xcode_version_override: Xcode version to use, optional (uses https://github.com/XcodesOrg/xcodes under the hood)


### check_bsdk_example_buildable

Expand Down
23 changes: 19 additions & 4 deletions fastlane/actions/lokalise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def self.run(params)
clean_destination = params[:clean_destination]
include_comments = params[:include_comments]
original_filenames = params[:use_original]
export_empty_as = params[:export_empty_as] ? params[:export_empty_as] : "base"
export_sort = params[:export_sort] ? params[:export_sort] : "first_added"
replace_breaks = params[:replace_breaks] ? true : false
export_empty_as = params[:export_empty_as] || "base"
export_sort = params[:export_sort] || "first_added"
replace_breaks = params[:replace_breaks] || false
add_newline_eof = params[:add_newline_eof] || false
filter_data = params[:filter_data]

body = {
Expand All @@ -25,7 +26,8 @@ def self.run(params)
export_empty_as: export_empty_as,
export_sort: export_sort,
include_comments: include_comments,
replace_breaks: replace_breaks
replace_breaks: replace_breaks,
add_newline_eof: add_newline_eof
}

if !filter_data.to_s.empty?
Expand Down Expand Up @@ -69,6 +71,11 @@ def self.run(params)
}
unzip_file("lokalisetmp/a.zip", destination, clean_destination)
FileUtils.remove_dir("lokalisetmp")

# Always sort all string files (which in turn adds EOF to the end of those files),
# since Lokalise only supports the `add_newline_eof` option for PHP and JSON file formats
exec("CI=false ./Utilites/sort-strings.sh")

UI.success "Localizations extracted to #{destination} 📗 📕 📘"
else
UI.error "Response did not include ZIP"
Expand Down Expand Up @@ -192,6 +199,14 @@ def self.available_options
verify_block: proc do |value|
UI.user_error! "Replace break should be true or false" unless [true, false].include? value
end),
FastlaneCore::ConfigItem.new(key: :add_newline_eof,
description: "Enable to add new line at end of file (if supported by format)",
optional: true,
is_string: false,
default_value: false,
verify_block: proc do |value|
UI.user_error! "Add newline EOF should be true or false" unless [true, false].include? value
end),
FastlaneCore::ConfigItem.new(key: :filter_data,
description: "Narrow export data range. Allowed values are translated or untranslated, reviewed (or reviewed_only), last_reviewed_only, verified and nonhidden",
optional: true,
Expand Down

0 comments on commit 09989d1

Please sign in to comment.