diff --git a/.github/workflows/merge_request.yml b/.github/workflows/merge_request.yml new file mode 100644 index 0000000..b42a8f2 --- /dev/null +++ b/.github/workflows/merge_request.yml @@ -0,0 +1,13 @@ +name: merge request + +on: + pull_request: + branches: + - 'master' + +jobs: + check: + uses: tinkoff-mobile-tech/workflows/.github/workflows/ios_lib.merge_request.yml@v1 + with: + xcodeproj_path: "TinkoffID.xcodeproj" + scheme_name: "TinkoffID-Package" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5b204da --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,19 @@ +name: publish + +on: + workflow_dispatch: + inputs: + bump_type: + required: true + type: string + description: "bump type for version" + +jobs: + publish: + uses: tinkoff-mobile-tech/workflows/.github/workflows/ios_lib.publish.yml@v1 + with: + xcodeproj_path: "TinkoffID.xcodeproj" + scheme_name: "TinkoffID-Package" + bump_type: ${{ inputs.bump_type }} + secrets: + cocapods_trunk_token: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7f53d5b..eb70493 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,8 @@ fastlane/test_output .DS_Store TinkoffID Debug/TinkoffID Debug.xcodeproj/xcuserdata .build + +# AppCode +.idea + +.swiftpm diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..34c85bf --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,73 @@ +warning_threshold: 1 + +excluded: +- Pods +- /**/Generated + +disabled_rules: +# У линий не должно пыть просбелов справа от текста +- trailing_whitespace +- class_delegate_protocol +# Делегаты должны быть weak, чтобы избежать цикла сильных ссылок +- weak_delegate +# Сложность тела функции должна быть ограничена +- cyclomatic_complexity +# Функции не должны быть слишком длинными +- function_body_length +# Файлы не должны быть слишком длинными +#- file_length +# ToDo remove below and fix violations! +- missing_docs +- legacy_random +- unused_closure_parameter +- colon +- force_try +- force_cast +- overridden_super_call +- vertical_whitespace +- leading_whitespace +- line_length +- operator_usage_whitespace +- trailing_comma +- trailing_newline +opt_in_rules: +# Некоторые переопределяемые методы всегда должны вызывать super +- overridden_super_call +# Некоторые методы не должны вызывать super +- prohibited_super_call +# Избегаем непосредственного вызова .init() +- explicit_init +# Операторы должны быть окружены одиночным пробелом +- operator_usage_whitespace +# Публичные методы/классы/.. должны быть документированы +- missing_docs + + +large_tuple: 4 + +line_length: 150 + +function_parameter_count: + warning: 10 + error: 15 + +file_length: + warning: 500 + +type_body_length: + warning: 400 + error: 450 + +nesting: + type_level: + warning: 3 + statement_level: + warning: 5 + +identifier_name: + min_length: 1 + max_length: 65 + +type_name: + min_length: 3 + max_length: 65 diff --git a/Gemfile b/Gemfile index 253977a..9731437 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source "https://rubygems.org" gem 'cocoapods', '~> 1.10.1' gem 'fastlane', '~> 2.172.0' +gem 'fastlane-plugin-changelog' gem 'rubocop', '~> 0.93.1' gem 'rubocop-require_tools' diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 2cee46b..92939fd 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,86 +1,4 @@ -lane :release do |options| - # Checking bump type - bump_type = resolve_bump_type(options) - - # Checking that everything is alright - checkup - - # Checking git - ensure_git_status_clean - ensure_git_branch(branch: "master") - - # Bumping podspec version - version = version_bump_podspec(bump_type: bump_type) - - # Stamping changelog - stamp_changelog(section_identifier: version) - - # Creating release commit and tag - git_commit(path: "CHANGELOG.md", message: "Release #{version}") - add_git_tag(tag: version) - - # Pushing to remote repo - push_to_git_remote(tags: true) - - # Pushing podspec to Cocoapods repo - push_podspec -end - -lane :checkup do - # Linting ruby files - lint_fastfile - - # Linting podspec - pod_lib_lint(allow_warnings: true) - - # Buidling Swift package - build_swift_package -end - -lane :build_swift_package do - project_name = "TinkoffID.xcodeproj" - scheme_name = "TinkoffID-Package" - config_file_name = "Config.xcconfig" - - # Creating configuration file - sh("echo SWIFT_ACTIVE_COMPILATION_CONDITIONS=''> #{config_file_name}") - - # Generating xcode project - sh("swift package generate-xcodeproj --xcconfig-overrides #{config_file_name}") - - # Building generated xcode project - sh("xcodebuild clean build -project ../#{project_name} -sdk iphoneos -scheme '#{scheme_name}'") - - # Cleaning up - sh("rm -f #{config_file_name}") - sh("rm -rf ../#{project_name}") -end - -lane :lint_fastfile do - Dir.chdir("..") do - error_callback = lambda do |result| - UI.user_error!("rubocop execution failed: #{result}") - end - - sh('bundle exec rubocop -c .rubocop.yml', error_callback: error_callback) - end -end - -lane :push_podspec do - podspec_name = "TinkoffID.podspec" - - pod_push( - path: podspec_name, - allow_warnings: true, - skip_tests: true - ) -end - -def resolve_bump_type(options) - valid_bump_types = ['patch', 'minor', 'major'] - bump_type = valid_bump_types.include?(options[:type]) ? options[:type] : nil - - UI.abort_with_message!("Bump type is not specified or incorrect! You can use `type: #{valid_bump_types.join('/')}` to specify it.") unless bump_type - - return bump_type -end +import_from_git( + url: "https://github.com/tinkoff-mobile-tech/workflows.git", # The URL of the repository to import the Fastfile from. + path: "fastlane/Fastfile" # The path of the Fastfile in the repository. +) diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile deleted file mode 100644 index 8f896e8..0000000 --- a/fastlane/Pluginfile +++ /dev/null @@ -1,5 +0,0 @@ -# Autogenerated by fastlane -# -# Ensure this file is checked in to source control! - -gem 'fastlane-plugin-changelog'