diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..7a00a96 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,27 @@ +name: CD + +on: + push: + branches: + - master + +jobs: + build: + + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v2 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6.5 + + - name: Bundle install + run: bundle install + + - name: Publish release + env: + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN_CI }} + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN_CI }} + run: bundle exec fastlane publish_release \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..027f74b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: + push: + branches-ignore: + - master + +jobs: + build: + + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v2 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6.5 + + - name: Ruby cache + uses: actions/cache@v1 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Bundle install + run: | + bundle config path vendor/bundle + bundle check || bundle install + - name: Pods cache + uses: actions/cache@v1 + with: + path: Pods + key: ${{ runner.os }}-cocoapods-${{ hashFiles('**/Podfile.lock') }} + + - name: Pod install + run: | + if [ ! -d "Pods" ]; then + bundle exec pod install + fi + - name: Build and test + run: bundle exec fastlane ci_check \ No newline at end of file diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml new file mode 100644 index 0000000..36ecbda --- /dev/null +++ b/.github/workflows/prepare_release.yml @@ -0,0 +1,25 @@ +name: Create release PRs + +on: + create + +jobs: + build: + + runs-on: macOS-latest + + if: contains(github.ref, 'release') # allow to filter on release branches only + steps: + - uses: actions/checkout@v2 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6.5 + + - name: Bundle install + run: bundle install + + - name: Prepare release + env: + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN_CI }} + run: bundle exec fastlane create_release_pr \ No newline at end of file diff --git a/ADFormController.podspec b/ADFormController.podspec index 507e9bb..ee0b753 100644 --- a/ADFormController.podspec +++ b/ADFormController.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |spec| spec.summary = 'Applidium\'s form controller' spec.platform = 'ios', '10.0' spec.license = { :type => 'Commercial', :text => 'Created and licensed by Applidium. Copyright 2016 Applidium. All rights reserved.' } - spec.source = { :git => 'ssh://git@codereview.technologies.fabernovel.com:29418/ADFormController', :tag => "v#{spec.version}" } + spec.source = { :git => 'git@github.com:faberNovel/ADFormController.git', :tag => "v#{spec.version}" } spec.source_files = 'Modules/ADFormController/Classes/*.{h,m,swift}' spec.resource_bundle = {'ADFormController' => 'Modules/ADFormController/Ressources/InputAccessoryView.xcassets'} spec.framework = 'Foundation', 'UIKit' diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b1252..3d71026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. `ADFormController` adheres to [Semantic Versioning](http://semver.org/). +## [6.0.3] + +### Fix +- Use cache to reuse formcontroller's cells + ## [6.0.1] ### Added diff --git a/Classes/FDTestFormTableViewController.m b/Classes/FDTestFormTableViewController.m index 11c4ee8..2d00fe2 100644 --- a/Classes/FDTestFormTableViewController.m +++ b/Classes/FDTestFormTableViewController.m @@ -14,7 +14,6 @@ #import "FDSharedObjectiveCHeader.h" #import "FDFormModel.h" #import -#import typedef NS_ENUM(NSUInteger, FDRowType) { FDRowTypeGender, diff --git a/FormDemo.xcodeproj/project.pbxproj b/FormDemo.xcodeproj/project.pbxproj index bd7258a..a353a52 100644 --- a/FormDemo.xcodeproj/project.pbxproj +++ b/FormDemo.xcodeproj/project.pbxproj @@ -580,7 +580,6 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Form-FormDemoTests/Pods-Form-FormDemoTests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/ADDynamicLogLevel/ADDynamicLogLevel.framework", "${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework", "${BUILT_PRODUCTS_DIR}/ADFormController/ADFormController.framework", "${BUILT_PRODUCTS_DIR}/ADKeyboardManager/ADKeyboardManager.framework", @@ -592,7 +591,6 @@ ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ADDynamicLogLevel.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ADFormController.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ADKeyboardManager.framework", @@ -647,7 +645,6 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Form-FormDemo/Pods-Form-FormDemo-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/ADDynamicLogLevel/ADDynamicLogLevel.framework", "${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework", "${BUILT_PRODUCTS_DIR}/ADFormController/ADFormController.framework", "${BUILT_PRODUCTS_DIR}/ADKeyboardManager/ADKeyboardManager.framework", @@ -657,7 +654,6 @@ ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ADDynamicLogLevel.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ADFormController.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ADKeyboardManager.framework", diff --git a/Gemfile.lock b/Gemfile.lock index ee4084a..e318c82 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,17 +1,3 @@ -GIT - remote: ssh://git@codereview.technologies.fabernovel.com:29418/ADFastlane - revision: c51b83c2930af4a4a8d72f09188b72f7b651a1a6 - branch: develop - specs: - fastlane-plugin-ft_internal (0.1.0) - ad_localize - fastlane-plugin-appcenter - fastlane-plugin-automated_test_emulator_run - fastlane-plugin-aws_s3 (>= 1.7.0) - fastlane-plugin-badge - fastlane-plugin-demo_mode - slather (< 3.0) - GEM remote: https://rubygems.org/ specs: @@ -21,19 +7,11 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - ad_localize (4.0.3) - activesupport (>= 5.2, < 7.0) - colorize (~> 0.8) - google-api-client (~> 0.34) - googleauth (~> 0.12) - nokogiri (~> 1.10) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) - apktools (0.7.4) - rubyzip (~> 2.0) atomos (0.1.3) aws-eventstream (1.1.0) aws-partitions (1.387.0) @@ -52,13 +30,7 @@ GEM aws-sigv4 (1.2.2) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) - badge (0.12.0) - curb (~> 0.9) - fastimage (>= 1.6) - fastlane (>= 2.0) - mini_magick (>= 4.9.4, < 5.0.0) claide (1.0.3) - clamp (1.3.2) cocoapods (1.10.0) addressable (~> 2.6) claide (>= 1.0.2, < 2.0) @@ -98,11 +70,9 @@ GEM cocoapods-try (1.2.0) colored (1.2) colored2 (3.1.2) - colorize (0.8.1) commander-fastlane (4.4.6) highline (~> 1.7.2) concurrent-ruby (1.1.7) - curb (0.9.10) declarative (0.0.20) declarative-option (0.1.0) digest-crc (0.6.1) @@ -160,15 +130,7 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-appcenter (1.10.0) - fastlane-plugin-automated_test_emulator_run (1.6.0) - fastlane-plugin-aws_s3 (1.8.0) - apktools (~> 0.7) - aws-sdk-s3 (~> 1) - mime-types (~> 3.3) - fastlane-plugin-badge (1.4.0) - badge (~> 0.12.0) - fastlane-plugin-demo_mode (1.0.2) + fastlane-plugin-changelog (0.15.0) ffi (1.13.1) fourflusher (2.3.1) fuzzy_match (2.0.4) @@ -211,12 +173,8 @@ GEM json (2.3.1) jwt (2.2.2) memoist (0.16.2) - mime-types (3.3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2020.0512) mini_magick (4.10.1) mini_mime (1.0.2) - mini_portile2 (2.4.0) minitest (5.14.2) molinillo (0.6.6) multi_json (1.15.0) @@ -225,8 +183,6 @@ GEM nap (1.1.0) naturally (2.2.0) netrc (0.11.0) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) os (1.1.1) plist (3.5.0) public_suffix (4.0.6) @@ -250,12 +206,6 @@ GEM CFPropertyList naturally slack-notifier (2.3.2) - slather (2.5.0) - CFPropertyList (>= 2.2, < 4) - activesupport - clamp (~> 1.3) - nokogiri (~> 1.8) - xcodeproj (~> 1.7) terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) @@ -292,7 +242,7 @@ DEPENDENCIES CFPropertyList (= 2.3.6) cocoapods (= 1.10.0) fastlane - fastlane-plugin-ft_internal! + fastlane-plugin-changelog RUBY VERSION ruby 2.6.5p114 diff --git a/Modules/ADFormController/Classes/FormController.swift b/Modules/ADFormController/Classes/FormController.swift index 2e9e320..5d464bc 100644 --- a/Modules/ADFormController/Classes/FormController.swift +++ b/Modules/ADFormController/Classes/FormController.swift @@ -149,7 +149,9 @@ private extension FormInput { guard let configuration = delegate?.configurationForFormController(self, at: indexPath) else { return UITableViewCell() } - return configuration.visit(self, at: indexPath) + let cell = configuration.visit(self, at: indexPath) + cells[indexPath] = cell + return cell } @objc(beginEditingAtIndexPath:) diff --git a/Podfile b/Podfile index c71f75e..ec9f6e7 100644 --- a/Podfile +++ b/Podfile @@ -1,11 +1,9 @@ -source 'ssh://git@codereview.technologies.fabernovel.com:29418/CocoaPodsSpecs' source 'https://github.com/CocoaPods/Specs.git' platform :ios, '10.0' use_frameworks! pod 'CocoaLumberjack/Swift', '~> 3.5', :inhibit_warnings => true -pod 'ADDynamicLogLevel', '~> 2.0', :inhibit_warnings => true abstract_target 'Form' do pod 'ADFormController', :path => './' @@ -13,7 +11,7 @@ abstract_target 'Form' do target 'FormDemo' do pod 'Alamofire', '~> 4.8' pod 'Watchdog', '~> 4.0' - pod 'ADUtils', '~> 9.3' + pod 'ADUtils', '~> 10.0' end target 'FormDemoTests' do diff --git a/Podfile.lock b/Podfile.lock index cc6b34f..454663b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,17 +1,13 @@ PODS: - - ADDynamicLogLevel (2.1.0): - - CocoaLumberjack (~> 3.0) - ADFormController (6.0.3): - ADKeyboardManager (~> 6.0) - ADKeyboardManager (6.0.0) - - ADUtils (9.4.0): - - ADUtils/objc (= 9.4.0) - - ADUtils/objc (9.4.0): + - ADUtils (10.5.0): + - ADUtils/objc (= 10.5.0) + - ADUtils/objc (10.5.0): - ADUtils/Swift - - ADUtils/Swift (9.4.0) + - ADUtils/Swift (10.5.0) - Alamofire (4.9.1) - - CocoaLumberjack (3.7.0): - - CocoaLumberjack/Core (= 3.7.0) - CocoaLumberjack/Core (3.7.0) - CocoaLumberjack/Swift (3.7.0): - CocoaLumberjack/Core @@ -32,9 +28,8 @@ PODS: - Watchdog (4.0) DEPENDENCIES: - - ADDynamicLogLevel (~> 2.0) - ADFormController (from `./`) - - ADUtils (~> 9.3) + - ADUtils (~> 10.0) - Alamofire (~> 4.8) - CocoaLumberjack/Swift (~> 3.5) - FBSnapshotTestCase (~> 2.1) @@ -56,18 +51,15 @@ SPEC REPOS: - OCMock - Quick - Watchdog - "ssh://git@codereview.technologies.fabernovel.com:29418/CocoaPodsSpecs": - - ADDynamicLogLevel EXTERNAL SOURCES: ADFormController: :path: "./" SPEC CHECKSUMS: - ADDynamicLogLevel: 7b576c84ef7a96ae1aa115e66516fc68f1e86de1 - ADFormController: 95290c99fc0264e0335d090e61cf595c0b324009 + ADFormController: 8958aee18f0e1cf43726f9ed80cbdfdac3c6347c ADKeyboardManager: a9dce48b8d2306c1fca5deb46d04fa8472516fe2 - ADUtils: c3521517403e01ae41ea9e37235fd637777f574c + ADUtils: 67372e355673bbc53f6843423dc78ebf3771f8ec Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 CocoaLumberjack: e8955b9d337ac307103b0a34fd141c32f27e53c5 FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a @@ -77,6 +69,6 @@ SPEC CHECKSUMS: Quick: f5754d69b7013f5864c29aab9ae6f0c79c5bc200 Watchdog: 370d2c2a58c9bede0e3f9b8cc26bf297745c31c2 -PODFILE CHECKSUM: dadcf27961b92a3718adc4924741ea82ddfcfa37 +PODFILE CHECKSUM: cde55cffb8e485ca348a8af64bd4a55211c4b9d9 COCOAPODS: 1.10.0 diff --git a/fastlane/.env.default b/fastlane/.env.default new file mode 100644 index 0000000..a819f37 --- /dev/null +++ b/fastlane/.env.default @@ -0,0 +1,3 @@ +PODSPEC = "ADFormController.podspec" +CHANGELOG = "CHANGELOG.md" +REPO = "faberNovel/ADFormController" \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5d4d519..1b46510 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,138 +1,111 @@ -import Fastlane::FtInternal.ios_fastfile_absolute_path - -##################################################### -# @!group Configuration -##################################################### - -override_lane :get_project_configuration do - { - xcworkspace: 'FormDemo.xcworkspace', - xcodeproj: 'FormDemo.xcodeproj' - } +desc "Run all unit tests" +lane :tests do + scan( + workspace: "FormDemo.xcworkspace", + configuration: "Stubs", + scheme: "FormDemo", + clean: true, + devices: ["iPhone 8"] + ) end -override_lane :get_variants_build_configurations do - { - 'FormDemo_Prod' => { - scheme: 'FormDemo', - xcode_configuration: 'Production', - target_name: 'FormDemo' - }, - } +desc "Run CI check for a commit" +lane :ci_check do + tests + pod_lib_lint( + use_bundle_exec: true, + allow_warnings: true + ) end -override_lane :get_slack_configuration do - { - channel: 'TODO', - slack_url: nil # Use nil to use FABERNOVEL's default one - } -end +desc "Release a new version" +lane :prepare_release do |options| + ensure_git_branch(branch: 'release/*') + ensure_git_status_clean -override_lane :get_variants_hockeyapp_configurations do - { - 'FormDemo_Prod' => { - api_token: nil, # Use nil to use FABERNOVEL's default one - public_identifier: "TODO_OR_NIL" #can be passed through cli option (hockeyapp_id) - } - } -end + target_version = target_version_from_branch -##################################################### -# @!group CI -##################################################### + next unless UI.confirm("Is your CHANGELOG up to date?") + update_changelog(target_version) + bump_podspec(target_version) -override_lane :get_variants_to_build_on_ci do |options| - case options[:commit_type] - when 'merge' - variants = ['FormDemo_Prod'] - when 'release' - variants = ['FormDemo_Prod'] - else - variants = ['FormDemo_Prod'] - end - variants + ensure_git_status_clean end -##################################################### -# @!group TEST -##################################################### +desc "Create release PR" +lane :create_release_pr do + ensure_git_branch(branch: 'release/*') + + ["master", "develop"].each do |base| + create_pull_request( + api_token: ENV["GITHUB_TOKEN"], + repo: ENV["REPO"], + title: "Release #{target_version_from_branch}", + base: base + ) + end +end -override_lane :get_test_configurations_for_ci do |options| +desc "Publish release" +lane :publish_release do + ensure_git_branch(branch: 'master') + + target_version = version_get_podspec(path: ENV["PODSPEC"]) + changelog = read_changelog( + changelog_path: ENV["CHANGELOG"], + section_identifier: "[#{target_version}]" + ) + set_github_release( + repository_name: ENV["REPO"], + api_token: ENV["GITHUB_TOKEN"], + name: "v#{target_version}", + tag_name: "v#{target_version}", + description: changelog, + commitish: "master" + ) + + pod_push(allow_warnings: true) end ##################################################### -# @!group Codesign +# Private ##################################################### -override_lane :get_variants_codesign_configurations do - MATCH_CUSTOMER_CONFIGURATION = - { - apple_id: "TODO", - apple_id_password: lane_context[:ALL_CLI_OPTIONS][:apple_password], - team_id: "TODO", - team_name: "TODO", - git_repository: "TODO", - git_branch: "TODO", - git_password: lane_context[:ALL_CLI_OPTIONS][:match_password], - } - { - 'FormDemo_Prod' => { - bundles: ["com.yourclient.appname", "com.yourclient.appname.watchkitextension"], - fabernovel_bundles: ["com.applidium.FormDemo", "com.applidium.appname.watchkitextension"], - provisioning_profile_templates: ["TODO_OR_NIL"], - local_provisioning_profile_names: ["TODO_OR_NIL", "TODO_OR_NIL"], - match_configuration: MATCH_CUSTOMER_CONFIGURATION - } - } +def update_changelog(target_version) + changelog_path = ENV["CHANGELOG"] + stamp_changelog( + changelog_path: changelog_path, + section_identifier: "#{target_version}" + ) + + git_add(path: changelog_path) + git_commit( + path: changelog_path, + message: "Update CHANGELOG" + ) end -override_lane :get_variants_itunes_connect_configurations do - ITC_CUSTOMER_CONFIGURATION = { - apple_id: "TODO_OR_REMOVE", - team_id: "TODO", - team_name: "TODO", - apple_id_password: lane_context[:ALL_CLI_OPTIONS][:apple_password], - itc_provider: "TODO" - } - { - 'FormDemo_Prod' => ITC_CUSTOMER_CONFIGURATION - } +def bump_podspec(target_version) + podspec_path = ENV["PODSPEC"] + version_bump_podspec( + path: podspec_path, + version_number: target_version + ) + + pod_install # update the Podfile.lock with the new version + + path = [podspec_path, "Podfile.lock"] + git_add(path: path) + git_commit( + path: path, + message: "Bump to #{target_version}" + ) end -##################################################### -# @!group PODS -##################################################### - -override_lane :get_pod_configuration do - { - use_libraries: false, - extra_sources_repos: nil, - skip_lib_lint: false, - pod_repository: FT_POD_REPO # You can use ft_pod_repo, nil for the pod trunk repo - } +def target_version_from_branch + git_branch.gsub(/release\/[A-Za-z]*/, "") end -##################################################### -# @!group LANES THAT CAN BE OVERRIDEN -##################################################### - -# private_lane :get_variants_crashlytics_configurations do -# end - -# private_lane :get_variants_s3_configurations do -# end - -# private_lane :user_defined_prebuild_lane do |options| -# end - -# private_lane :user_defined_postbuild_lane do |options| -# end - -# override_lane :get_project_tests_configurations do -# end - -# override_lane :get_test_configurations_for_ci do |options| -# end - -# override_lane :get_appstore_screenshots_test_configurations_for_variant do -# end +def pod_install + sh "bundle exec pod install" +end \ No newline at end of file diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 6e622e6..117d80a 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -1 +1 @@ -gem 'fastlane-plugin-ft_internal', git: "ssh://git@codereview.technologies.fabernovel.com:29418/ADFastlane", branch: 'develop' \ No newline at end of file +gem 'fastlane-plugin-changelog' \ No newline at end of file