Skip to content

Commit

Permalink
Migrate to Swift 5️⃣.9️⃣
Browse files Browse the repository at this point in the history
Migrate CI to macOS 14 image and Xcode 15.2 which contains Swift 5.9,
and migrate Danger CI to run on ubuntu 22.04.

https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#xcode

## Changes

- Update Xcode references to 15.2 and Swift references to 5.9.

- Update destination device to iPhone 15 Pro.

- Improve SwiftLint setup and fix warnings.

- Update `README.md`.

- Apply Xcode's recommended project settings.
  • Loading branch information
p4checo committed Apr 16, 2024
1 parent 59bc699 commit 3584cac
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 22 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:
- master

env:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#xcode
DEVELOPER_DIR: /Applications/Xcode_14.0.app/Contents/Developer
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest"
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#xcode
DEVELOPER_DIR: "/Applications/Xcode_15.2.app/Contents/Developer"
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest"

jobs:
env-details:
name: Environment details
runs-on: macos-12
runs-on: macos-14-arm64
steps:
- name: xcode version
run: xcodebuild -version -sdk
Expand All @@ -30,7 +30,7 @@ jobs:
build-test:
name: Build and Test
runs-on: macos-12
runs-on: macos-14-arm64
env:
WORKSPACE: Alicerce.xcworkspace
SCHEME: Alicerce
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:

swiftpm:
name: SwiftPM Build
runs-on: macos-12
runs-on: macos-14-arm64
env:
WORKSPACE: Alicerce.xcworkspace
SCHEME: "Alicerce (SPM)"
Expand All @@ -87,7 +87,7 @@ jobs:
cocoapods:
name: CocoaPods Verification
runs-on: macos-12
runs-on: macos-14-arm64
steps:
- name: git checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:

carthage:
name: Carthage Verification
runs-on: macos-12
runs-on: macos-14-arm64
steps:
- name: git checkout
uses: actions/checkout@v2
Expand All @@ -126,7 +126,7 @@ jobs:

release-github:
name: GitHub Release
runs-on: macos-12
runs-on: macos-14-arm64
needs: [build-test, swiftpm, cocoapods, carthage]
if: startsWith(github.ref, 'refs/tags/')
steps:
Expand All @@ -145,7 +145,7 @@ jobs:
release-cocoapods:
name: CocoaPods Release
runs-on: macos-12
runs-on: macos-14-arm64
needs: [build-test, swiftpm, cocoapods, carthage]
if: startsWith(github.ref, 'refs/tags/')
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/danger-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

Danger:
name: Danger Swift
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Danger
Expand Down
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ excluded:
reporter: "xcode"
disabled_rules:
- closure_parameter_position
- blanket_disable_command
- todo
- unused_optional_binding
- nesting
Expand Down Expand Up @@ -43,7 +44,6 @@ function_body_length:
error: 150
number_separator:
minimum_length: 5
empty_count: warning
superfluous_disable_command: warning
implicit_return:
included:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Alicerce.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/Mindera/Alicerce.git', :tag => "#{s.version}" }

s.module_name = 'Alicerce'
s.swift_version = '5.7'
s.swift_version = '5.9'

s.ios.deployment_target = '13.0'

Expand Down
20 changes: 18 additions & 2 deletions Alicerce.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
0A006D412BCEFD2100339B67 /* carthage.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = carthage.sh; path = script/carthage.sh; sourceTree = "<group>"; };
0A01F88520B34A9000BA7C4D /* AmazonRootCA4.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AmazonRootCA4.cer; sourceTree = "<group>"; };
0A01F88D20B370F300BA7C4D /* MinderaAlicerceRootCA.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = MinderaAlicerceRootCA.cer; sourceTree = "<group>"; };
0A01F89320B383EB00BA7C4D /* DigiCertGlobalRootG2.pub */ = {isa = PBXFileReference; lastKnownFileType = file; path = DigiCertGlobalRootG2.pub; sourceTree = "<group>"; };
Expand Down Expand Up @@ -791,6 +792,7 @@
OBJ_6 /* Package.swift */,
A0163F5526B94F2900C67CC7 /* Dangerfile.swift */,
0A3C2D021EA7E1B500EFB7D4 /* Alicerce.podspec */,
0A006D412BCEFD2100339B67 /* carthage.sh */,
0AA4EBA72645E96900616FB3 /* Gemfile */,
0AFB453C251143ED00698CBB /* Documentation */,
);
Expand Down Expand Up @@ -1681,8 +1683,9 @@
OBJ_1 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1240;
LastUpgradeCheck = 1520;
ORGANIZATIONNAME = Mindera;
TargetAttributes = {
0A266F801ED59DC7009CD0D7 = {
Expand Down Expand Up @@ -1819,7 +1822,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: Swiftlint is not installed\"\nfi\n";
shellScript = "if [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which swiftlint > /dev/null; then\n echo \"Running SwiftLint '$(swiftlint --version)' from '$PWD'...\"\n swiftlint\nelse\n echo \"😱 Error: 'swiftlint' is not installed! Please install it via 'brew install swiftlint'!\" >&2\n exit 1\nfi\n\n\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -2299,11 +2302,13 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand All @@ -2327,6 +2332,8 @@
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.18.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.mindera.Alicerce;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2361,12 +2368,14 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand All @@ -2385,6 +2394,8 @@
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.18.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.mindera.Alicerce;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2559,6 +2570,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = SwiftLint;
Expand All @@ -2570,6 +2582,7 @@
buildSettings = {
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
PRODUCT_NAME = SwiftLint;
};
name = Release;
Expand Down Expand Up @@ -2602,6 +2615,7 @@
ENABLE_NS_ASSERTIONS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -2650,6 +2664,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = s;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand All @@ -2662,6 +2677,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
WARNING_CFLAGS = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version: 5.9

import PackageDescription

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/Mindera/Alicerce/blob/master/LICENSE)
[![release](https://img.shields.io/github/release/Mindera/Alicerce.svg)](https://github.com/Mindera/Alicerce/releases)
![platforms](https://img.shields.io/badge/platforms-iOS-lightgrey.svg)
[![Swift 5.7](https://img.shields.io/badge/Swift-5.7-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![Swift 5.9](https://img.shields.io/badge/Swift-5.9-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods](https://img.shields.io/cocoapods/v/Alicerce.svg)](https://cocoapods.org/)
[![SwiftPM](https://img.shields.io/badge/SwiftPM-compatible-orange.svg)](#swift-package-manager)
Expand Down Expand Up @@ -50,7 +50,13 @@ TODO

## Compatibility ✅

### `0.18.0` ... `master`
### `master`

- iOS 13.0+
- Xcode 15.0
- Swift 5.9

### `0.18.0`

- iOS 13.0+
- Xcode 14.0
Expand Down
3 changes: 2 additions & 1 deletion Sources/Persistence/DiskMemoryPersistenceStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import AlicerceLogging

public extension Persistence {

// swiftlint:disable:next type_body_length
final class DiskMemoryPersistenceStack: NSObject, PersistenceStack {

public typealias Key = String
Expand Down Expand Up @@ -500,7 +501,7 @@ extension Persistence.DiskMemoryPersistenceStack: NSCacheDelegate {
}
}

fileprivate final class DiskMemoryBlockOperation: BlockOperation {
private final class DiskMemoryBlockOperation: BlockOperation {

required init(qos: QualityOfService = .default, block: @escaping () -> Swift.Void) {
super.init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class Route_TrieRouter_RouteTests: XCTestCase {
// MARK: - failure

func testRoute_WithInvalidRouteURL_ShouldFail() {
guard #unavailable(iOS 17, macOS 14) else {
// Since iOS 17, macOS 14 that both `URL` and `URLComponents` conform to RFC 3986, so we can't create a
// `URL` that would fail to create a `URLComponents` (triggering the `.invalidRoute(.invalidURL)` error).
// https://stackoverflow.com/a/55627352/1921751
return
}

let router = TestRouter()

Expand Down
2 changes: 1 addition & 1 deletion script/carthage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
# For Xcode 12+ make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.

XCODE_VERSION_MAJ=1400 # should mirror XCODE_VERSION_MAJOR - update accordingly
XCODE_VERSION_MAJ=1500 # should mirror XCODE_VERSION_MAJOR - update accordingly

echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_${XCODE_VERSION_MAJ} = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
Expand Down

0 comments on commit 3584cac

Please sign in to comment.