From 4f300a2366a087e0632e422d845126181e60adb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Olejn=C3=ADk?= Date: Fri, 3 Nov 2023 12:19:04 +0100 Subject: [PATCH] Project updates (#137) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ⬆️ Update CI * 🔧 Bump deployment target to iOS 12 * 🔧 Update CI device * 🚨 Fix lint warnings * 🔧 Fix macOS deployment target * 🔧 Upload result bundle for failed tests * 🔧 Update host application for iOS tests * 🔧 Install yeetd before tests * 🔧 Comment out suspicious FC test * 🔧 Try to fix flaky FC test * 🔧 Improve CI jobs --- .github/workflows/build.yml | 2 +- .github/workflows/checks.yml | 6 ++-- .github/workflows/deploy.yml | 6 ++-- .github/workflows/docs.yml | 29 ------------------- .github/workflows/stale.yml | 2 +- .github/workflows/tests.yml | 16 ++++++++-- .github/xcode-version | 2 +- ACKategories-iOS/Base/FlowCoordinator.swift | 2 +- .../UINavigationControllerExtensions.swift | 8 ++--- .../FlowCoordinatorTests.swift | 1 + ACKategories.podspec | 4 +-- ACKategories.xcodeproj/project.pbxproj | 14 ++++----- ACKategoriesCore/BetterURL.swift | 5 ++-- ACKategoriesCore/CollectionExtensions.swift | 2 +- ACKategoriesCore/DictionaryExtensions.swift | 2 +- .../PropertyWrappers/UserDefault.swift | 2 +- ACKategoriesCore/PublisherExtensions.swift | 2 +- .../VCCompositionViewController.swift | 2 +- Package.swift | 9 ++---- TapestryConfig.swift | 9 ------ 20 files changed, 47 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 TapestryConfig.swift diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a30a8150..cd68efc6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: name: Carthage runs-on: macos-13 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - uses: AckeeCZ/load-xcode-version@1.1.0 - name: Build run: carthage build --no-skip-current --cache-builds --use-xcframeworks diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7dbc8958..1f3dccdc 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,14 +8,14 @@ jobs: name: Swiftlint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - name: GitHub Action for SwiftLint uses: norio-nomura/action-swiftlint@3.1.0 changelog: name: Changelog runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - name: Changelog Reminder uses: peterjgrainger/action-changelog-reminder@v1.2.0 with: @@ -26,7 +26,7 @@ jobs: name: Podspec runs-on: macos-13 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - name: Install Bundler dependencies run: bundle install - name: Lint podspec diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0c7dc43d..d41e012b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: name: Upload Carthage binary runs-on: macos-13 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - uses: AckeeCZ/load-xcode-version@1.1.0 - name: Build run: carthage build --no-skip-current --cache-builds --use-xcframeworks @@ -21,7 +21,7 @@ jobs: mv Carthage/Build/*.xcframework /tmp/ACKategories cd /tmp zip -r "$DST/"ACKategories.xcframework.zip ACKategories - - uses: xresloader/upload-to-github-release@v1 + - uses: xresloader/upload-to-github-release@v1.3.12 if: startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -33,7 +33,7 @@ jobs: name: Push podspec to Cocoapods trunk runs-on: macos-13 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - uses: AckeeCZ/load-xcode-version@1.1.0 - name: Install gems run: bundle install diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index ddada384..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Documentation - -on: - push: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3.5.3 - - name: Generate Documentation - uses: SwiftDocOrg/swift-doc@master - with: - inputs: "ACKategories-iOS" - output: "Documentation" - - name: Generate Documentation - uses: SwiftDocOrg/swift-doc@master - with: - inputs: "ACKategoriesCore" - output: "Documentation" - - name: Upload Documentation to Wiki - uses: SwiftDocOrg/github-wiki-publish-action@master - with: - path: "Documentation" - env: - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CI_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index f5151594..00b0c2a9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,7 +7,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: actions/stale@v8 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a73873f..a69e5b5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,9 +7,19 @@ jobs: name: Run tests runs-on: macos-13 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4 - uses: AckeeCZ/load-xcode-version@1.1.0 - name: Run iOS tests - run: set -o pipefail && xcodebuild test -scheme ACKategories-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14 Pro Max,OS=latest' ONLY_ACTIVE_ARCH=YES | xcpretty + run: set -o pipefail && xcodebuild test -scheme ACKategories-iOS -resultBundlePath Tests-iOS.xcresult -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 15 Pro Max,OS=latest" ONLY_ACTIVE_ARCH=YES | xcpretty + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: Tests-iOS.xcresult + path: Tests-iOS.xcresult - name: Run macOS tests - run: set -o pipefail && xcodebuild test -scheme ACKategoriesCore -destination 'platform=OS X,arch=x86_64' | xcpretty \ No newline at end of file + run: set -o pipefail && xcodebuild test -scheme ACKategoriesCore -resultBundlePath Tests-macOS.xcresult -destination 'platform=OS X,arch=x86_64' | xcpretty + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: Tests-macOS.xcresult + path: Tests-macOS.xcresult \ No newline at end of file diff --git a/.github/xcode-version b/.github/xcode-version index 7ea95c24..9dc738e6 100644 --- a/.github/xcode-version +++ b/.github/xcode-version @@ -1 +1 @@ -14.3.1 \ No newline at end of file +15.0.1 \ No newline at end of file diff --git a/ACKategories-iOS/Base/FlowCoordinator.swift b/ACKategories-iOS/Base/FlowCoordinator.swift index 6ebef631..904d0d2b 100644 --- a/ACKategories-iOS/Base/FlowCoordinator.swift +++ b/ACKategories-iOS/Base/FlowCoordinator.swift @@ -25,7 +25,7 @@ extension Base { } /// When flow coordinator handles modally presented flow, we are interested `rootVC` changes - private var rootVCSetter: (UIViewController?) -> () = { _ in } + private var rootVCSetter: (UIViewController?) -> Void = { _ in } /// Parent coordinator public weak var parentCoordinator: FlowCoordinator? diff --git a/ACKategories-iOS/UINavigationControllerExtensions.swift b/ACKategories-iOS/UINavigationControllerExtensions.swift index bf3f1510..98d05997 100644 --- a/ACKategories-iOS/UINavigationControllerExtensions.swift +++ b/ACKategories-iOS/UINavigationControllerExtensions.swift @@ -8,28 +8,28 @@ import UIKit public extension UINavigationController { - func pushViewController(_ viewController: UIViewController, animated: Bool, completion: @escaping () -> ()) { + func pushViewController(_ viewController: UIViewController, animated: Bool, completion: @escaping () -> Void) { CATransaction.begin() CATransaction.setCompletionBlock(completion) pushViewController(viewController, animated: animated) CATransaction.commit() } - func popViewController(animated: Bool, completion: @escaping () -> ()) { + func popViewController(animated: Bool, completion: @escaping () -> Void) { CATransaction.begin() CATransaction.setCompletionBlock(completion) popViewController(animated: animated) CATransaction.commit() } - func popToViewController(_ viewController: UIViewController, animated: Bool, completion: @escaping () -> ()) { + func popToViewController(_ viewController: UIViewController, animated: Bool, completion: @escaping () -> Void) { CATransaction.begin() CATransaction.setCompletionBlock(completion) popToViewController(viewController, animated: animated) CATransaction.commit() } - func popToRootViewController(animated: Bool, completion: @escaping () -> ()) { + func popToRootViewController(animated: Bool, completion: @escaping () -> Void) { CATransaction.begin() CATransaction.setCompletionBlock(completion) popToRootViewController(animated: animated) diff --git a/ACKategories-iOSTests/FlowCoordinator/FlowCoordinatorTests.swift b/ACKategories-iOSTests/FlowCoordinator/FlowCoordinatorTests.swift index f0e45849..3549b514 100644 --- a/ACKategories-iOSTests/FlowCoordinator/FlowCoordinatorTests.swift +++ b/ACKategories-iOSTests/FlowCoordinator/FlowCoordinatorTests.swift @@ -22,6 +22,7 @@ final class FlowCoordinatorTests: XCTestCase { } override func tearDown() { + ErrorHandlers.rootViewControllerDeallocatedBeforeStop = nil window = nil super.tearDown() diff --git a/ACKategories.podspec b/ACKategories.podspec index 74daa1a4..9a801e45 100644 --- a/ACKategories.podspec +++ b/ACKategories.podspec @@ -10,9 +10,9 @@ Tools, cocoa subclasses and extensions we love to use at Ackee. s.author = { 'Ackee' => 'info@ackee.cz' } s.source = { :git => 'https://github.com/AckeeCZ/ACKategories.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/ackeecz' - s.swift_version = '5.1.3' + s.swift_version = '5.9' - s.ios.deployment_target = '11.0' + s.ios.deployment_target = '12.0' s.osx.deployment_target = '10.13' s.source_files = 'ACKategoriesCore/**/*.swift' diff --git a/ACKategories.xcodeproj/project.pbxproj b/ACKategories.xcodeproj/project.pbxproj index 7bdaf097..d8a58e57 100644 --- a/ACKategories.xcodeproj/project.pbxproj +++ b/ACKategories.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -1189,6 +1189,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MARKETING_VERSION = 6.12.3; ONLY_ACTIVE_ARCH = YES; SWIFT_VERSION = 5.0; @@ -1225,6 +1227,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MARKETING_VERSION = 6.12.3; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_VERSION = 5.0; @@ -1298,7 +1302,6 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1374,7 +1377,6 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = cz.ackee.enterprise.ACKategoriesCore; @@ -1585,7 +1587,6 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "ACKategories-iOS/Supporting files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1661,7 +1662,6 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "ACKategories-iOS/Supporting files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1751,7 +1751,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ACKategoriesExample.app/ACKategoriesExample"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ACKategoriesExample.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ACKategoriesExample"; }; name = Debug; }; @@ -1816,7 +1816,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ACKategoriesExample.app/ACKategoriesExample"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ACKategoriesExample.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ACKategoriesExample"; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/ACKategoriesCore/BetterURL.swift b/ACKategoriesCore/BetterURL.swift index 811f7bb1..750eba74 100644 --- a/ACKategoriesCore/BetterURL.swift +++ b/ACKategoriesCore/BetterURL.swift @@ -11,14 +11,14 @@ public struct BetterURL: RawRepresentable, Codable, Hashable { public init?(rawValue: String) { self.rawValue = rawValue - + var replacedURLString: String { rawValue .replacingOccurrences(of: " ", with: "%20") .replacingOccurrences(of: "{", with: "%7B") .replacingOccurrences(of: "}", with: "%7D") } - + if let url = URL(string: rawValue) { self.url = url } else if let url = URL(string: replacedURLString) { @@ -28,4 +28,3 @@ public struct BetterURL: RawRepresentable, Codable, Hashable { } } } - diff --git a/ACKategoriesCore/CollectionExtensions.swift b/ACKategoriesCore/CollectionExtensions.swift index 66626074..d0e406c7 100644 --- a/ACKategoriesCore/CollectionExtensions.swift +++ b/ACKategoriesCore/CollectionExtensions.swift @@ -41,7 +41,7 @@ extension Collection { extension Collection where Index: Strideable, Index.Stride: SignedInteger { /// Return objects in given range - public subscript(safe range: CountableRange) -> Array { + public subscript(safe range: CountableRange) -> [Element] { return range.compactMap { self[safe: $0] } } } diff --git a/ACKategoriesCore/DictionaryExtensions.swift b/ACKategoriesCore/DictionaryExtensions.swift index 712f7f41..56e59d02 100644 --- a/ACKategoriesCore/DictionaryExtensions.swift +++ b/ACKategoriesCore/DictionaryExtensions.swift @@ -38,7 +38,7 @@ extension Dictionary where Value: OptionalProtocol { guard let key = key as? Key else { return } - result = (result as? Dictionary)?[key] + result = (result as? [Key: Value])?[key] } return result as? T } diff --git a/ACKategoriesCore/PropertyWrappers/UserDefault.swift b/ACKategoriesCore/PropertyWrappers/UserDefault.swift index eb061226..7790044a 100644 --- a/ACKategoriesCore/PropertyWrappers/UserDefault.swift +++ b/ACKategoriesCore/PropertyWrappers/UserDefault.swift @@ -95,7 +95,7 @@ public final class UserDefault { } public extension UserDefault { - convenience init(_ key: String, `default`: Optional = nil, userDefaults: UserDefaults = .standard) where Value == Optional { + convenience init(_ key: String, `default`: Wrapped? = nil, userDefaults: UserDefaults = .standard) where Value == Wrapped? { self.init(key, default: `default`, userDefaults: userDefaults) } } diff --git a/ACKategoriesCore/PublisherExtensions.swift b/ACKategoriesCore/PublisherExtensions.swift index 248517ec..d4511fd1 100644 --- a/ACKategoriesCore/PublisherExtensions.swift +++ b/ACKategoriesCore/PublisherExtensions.swift @@ -63,4 +63,4 @@ extension Publishers { zipped.subscribe(subscriber) } } -} \ No newline at end of file +} diff --git a/ACKategoriesExample/Screens/VC composition/VCCompositionViewController.swift b/ACKategoriesExample/Screens/VC composition/VCCompositionViewController.swift index 6858b789..e7c00ea1 100644 --- a/ACKategoriesExample/Screens/VC composition/VCCompositionViewController.swift +++ b/ACKategoriesExample/Screens/VC composition/VCCompositionViewController.swift @@ -32,7 +32,7 @@ final class VCCompositionViewController: TitleViewController { containerView.topAnchor.constraint(equalTo: nameLabel.bottomAnchor, constant: 30), containerView.leadingAnchor.constraint(equalTo: view.leadingAnchor), containerView.trailingAnchor.constraint(equalTo: view.trailingAnchor), - containerView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + containerView.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) let childVC = TitleViewController(name: "Child", color: .blue) diff --git a/Package.swift b/Package.swift index 211a3570..28af7ff9 100644 --- a/Package.swift +++ b/Package.swift @@ -1,11 +1,11 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.9 import PackageDescription let package = Package( name: "ACKategories", platforms: [ - .iOS(.v11), - .macOS("10.13") + .iOS(.v12), + .macOS(.v10_13) ], products: [ .library(name: "ACKategories", targets: ["ACKategories-iOS"]), @@ -16,8 +16,5 @@ let package = Package( .testTarget(name: "ACKategories-iOSTests", dependencies: ["ACKategories-iOS"], path: "ACKategories-iOSTests"), .target(name: "ACKategoriesCore", path: "ACKategoriesCore"), .testTarget(name: "ACKategoriesCoreTests", dependencies: ["ACKategoriesCore"], path: "ACKategoriesCoreTests"), - ], - swiftLanguageVersions: [ - .v5 ] ) diff --git a/TapestryConfig.swift b/TapestryConfig.swift deleted file mode 100644 index 375b0a12..00000000 --- a/TapestryConfig.swift +++ /dev/null @@ -1,9 +0,0 @@ -import PackageDescription - -let config = TapestryConfig(release: Release(actions: [.pre(.docsUpdate), - .pre(.dependenciesCompatibility([.cocoapods, .carthage, .spm(.all)]))], - add: ["README.md", - "ACKategories.podspec", - "CHANGELOG.md"], - commitMessage: "Version \(Argument.version)", - push: true))