Skip to content

Commit

Permalink
Swift 6 Native Builds (Alamofire#3880)
Browse files Browse the repository at this point in the history
### Goals ⚽
This PR tracks the implementation of full concurrency checking when
building in Swift 6 mode. It's unknown whether all of these changes will
be fully backward compatible.

### Implementation Details 🚧
This PR largely consists of `Sendable` annotations, with a few logic
changes to fix actual safety issues.

### Testing Details 🔍
Tests updated with needed annotations, but mutation warnings need a
larger overall refactor.
  • Loading branch information
jshier authored Oct 10, 2024
1 parent 5716278 commit 7500a8e
Show file tree
Hide file tree
Showing 82 changed files with 1,491 additions and 840 deletions.
150 changes: 65 additions & 85 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ jobs:
fail-fast: false
matrix:
include:
- xcode: "Xcode_15.4"
- xcode: "Xcode_16.0"
runsOn: firebreak
name: "macOS 14, Xcode 16.0, Swift 6.0"
testPlan: "macOS"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_15.4"
runsOn: macOS-14
name: "macOS 14, Xcode 15.4, Swift 5.10"
testPlan: "macOS"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_15.2"
runsOn: firebreak
runsOn: macOS-14
name: "macOS 14, Xcode 15.2, Swift 5.9.2"
testPlan: "macOS"
outputFilter: xcbeautify --renderer github-actions
Expand All @@ -51,21 +56,6 @@ jobs:
name: "macOS 14, Xcode 15.0.1, Swift 5.9.0"
testPlan: "macOS"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_14.3.1"
runsOn: macOS-13
name: "macOS 13, Xcode 14.3.1, Swift 5.8.0"
testPlan: "macOS"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_14.2"
runsOn: macOS-12
name: "macOS 12, Xcode 14.2, Swift 5.7.2"
testPlan: "macOS"
outputFilter: xcpretty
- xcode: "Xcode_14.1"
runsOn: macOS-12
name: "macOS 12, Xcode 14.1, Swift 5.7.1"
testPlan: "macOS"
outputFilter: xcpretty
steps:
- uses: actions/checkout@v4
- name: ${{ matrix.name }}
Expand All @@ -84,21 +74,21 @@ jobs:
fail-fast: false
matrix:
include:
- xcode: "Xcode_16.0"
name: "Catalyst 16.0"
runsOn: firebreak
- xcode: "Xcode_15.4"
name: "Catalyst 15.4"
runsOn: firebreak
runsOn: macOS-14
- xcode: "Xcode_15.2"
name: "Catalyst 15.2"
runsOn: firebreak
runsOn: macOS-14
- xcode: "Xcode_15.1"
name: "Catalyst 15.1"
runsOn: macOS-14
- xcode: "Xcode_15.0.1"
name: "Catalyst 15.0"
runsOn: macOS-14
- xcode: "Xcode_14.3.1"
name: "Catalyst 14.3.1"
runsOn: macOS-13
steps:
- uses: actions/checkout@v4
- name: Install Firewalk
Expand All @@ -115,26 +105,26 @@ jobs:
fail-fast: false
matrix:
include:
- destination: "OS=18.0,name=iPhone 16 Pro"
name: "iOS 18.0"
testPlan: "iOS"
xcode: "Xcode_16.0"
runsOn: firebreak
- destination: "OS=17.5,name=iPhone 15 Pro"
name: "iOS 17.5"
testPlan: "iOS"
xcode: "Xcode_15.4"
runsOn: firebreak
runsOn: macOS-14
- destination: "OS=17.2,name=iPhone 15 Pro"
name: "iOS 17.2"
testPlan: "iOS"
xcode: "Xcode_15.2"
runsOn: firebreak
runsOn: macOS-14
- destination: "OS=17.0,name=iPhone 15 Pro"
name: "iOS 17.0"
testPlan: "iOS"
xcode: "Xcode_15.0.1"
runsOn: macOS-14
- destination: "OS=16.4,name=iPhone 14 Pro"
name: "iOS 16.4"
testPlan: "iOS"
xcode: "Xcode_14.3.1"
runsOn: macOS-13
steps:
- uses: actions/checkout@v4
- name: Install Firewalk
Expand All @@ -151,26 +141,26 @@ jobs:
fail-fast: false
matrix:
include:
- destination: "OS=18.0,name=Apple TV"
name: "tvOS 18.0"
testPlan: "tvOS"
xcode: "Xcode_16.0"
runsOn: firebreak
- destination: "OS=17.5,name=Apple TV"
name: "tvOS 17.5"
testPlan: "tvOS"
xcode: "Xcode_15.4"
runsOn: firebreak
runsOn: macOS-14
- destination: "OS=17.2,name=Apple TV"
name: "tvOS 17.2"
testPlan: "tvOS"
xcode: "Xcode_15.2"
runsOn: firebreak
runsOn: macOS-14
- destination: "OS=17.0,name=Apple TV"
name: "tvOS 17.0"
testPlan: "tvOS"
xcode: "Xcode_15.0.1"
runsOn: macOS-14
- destination: "OS=16.4,name=Apple TV"
name: "tvOS 16.4"
testPlan: "tvOS"
xcode: "Xcode_14.3.1"
runsOn: macOS-13
steps:
- uses: actions/checkout@v4
- name: Install Firewalk
Expand All @@ -187,6 +177,12 @@ jobs:
fail-fast: false
matrix:
include:
- destination: "OS=2.0,name=Apple Vision Pro"
name: "visionOS 2.0"
testPlan: "visionOS"
scheme: "Alamofire visionOS"
xcode: "Xcode_16.0"
runsOn: firebreak
- destination: "OS=1.2,name=Apple Vision Pro"
name: "visionOS 1.2"
testPlan: "visionOS"
Expand Down Expand Up @@ -215,26 +211,26 @@ jobs:
fail-fast: false
matrix:
include:
- destination: "OS=11.0,name=Apple Watch Series 10 (46mm)"
name: "watchOS 11.0"
testPlan: "watchOS"
xcode: "Xcode_16.0"
runsOn: firebreak
- destination: "OS=10.5,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.5"
testPlan: "watchOS"
xcode: "Xcode_15.4"
runsOn: firebreak
runsOn: macOS-14
- destination: "OS=10.2,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.2"
testPlan: "watchOS"
xcode: "Xcode_15.2"
runsOn: firebreak
runsOn: macOS-14
- destination: "OS=10.0,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.0"
testPlan: "watchOS"
xcode: "Xcode_15.0.1"
runsOn: macOS-14
- destination: "OS=9.4,name=Apple Watch Series 8 (45mm)"
name: "watchOS 9.4"
testPlan: "watchOS"
xcode: "Xcode_14.3.1"
runsOn: macOS-13
steps:
- uses: actions/checkout@v4
- name: Install Firewalk
Expand All @@ -251,12 +247,16 @@ jobs:
fail-fast: false
matrix:
include:
- xcode: "Xcode_15.4"
- xcode: "Xcode_16.0"
runsOn: firebreak
name: "macOS 14, SPM 6.0 Test"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_15.4"
runsOn: macOS-14
name: "macOS 14, SPM 5.10 Test"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_15.2"
runsOn: firebreak
runsOn: macOS-14
name: "macOS 14, SPM 5.9.2 Test"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_15.1"
Expand All @@ -267,40 +267,22 @@ jobs:
runsOn: macOS-14
name: "macOS 14, SPM 5.9.0 Test"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_14.3.1"
runsOn: macOS-13
name: "macOS 13, SPM 5.8.0 Test"
outputFilter: xcbeautify --renderer github-actions
- xcode: "Xcode_14.2"
runsOn: macOS-12
name: "macOS 12, SPM 5.7.2 Test"
outputFilter: xcpretty
- xcode: "Xcode_14.1"
runsOn: macOS-12
name: "macOS 12, SPM 5.7.1 Test"
outputFilter: xcpretty
steps:
- uses: actions/checkout@v4
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk || brew upgrade alamofire/alamofire/firewalk xcbeautify && firewalk &
- name: Test SPM
run: swift test -c debug 2>&1 | ${{ matrix.outputFilter }}
run: set -o pipefail && swift test -c debug 2>&1 | ${{ matrix.outputFilter }}
Linux:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: swift:5.8-focal
- image: swift:5.8-jammy
- image: swift:5.8-rhel-ubi9
- image: swift:5.9-focal
- image: swift:5.9-jammy
- image: swift:5.9-rhel-ubi9
- image: swift:5.10-focal
- image: swift:5.10-jammy
- image: swift:5.10-rhel-ubi9
- image: swift:6.0-focal
- image: swift:6.0-jammy
- image: swift:6.0-rhel-ubi9
- image: swiftlang/swift:nightly-focal
- image: swiftlang/swift:nightly-jammy
container:
Expand All @@ -310,15 +292,19 @@ jobs:
- uses: actions/checkout@v4
- name: ${{ matrix.image }}
run: swift build --build-tests -c debug
# Disabled to find consistently updated builder.
# Android:
# name: Android
# uses: hggz/swift-android-sdk/.github/workflows/sdks.yml@ci
# strategy:
# fail-fast: false
# with:
# target-repo: ${{ github.repository }}
# checkout-hash: ${{ github.sha }}
Android:
name: Android
strategy:
fail-fast: false
runs-on: macos-13
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Build for Android"
uses: skiptools/swift-android-action@v1
with:
swift-build-flags: "--build-tests -c debug"
run-tests: false
Windows:
name: ${{ matrix.name }}
runs-on: windows-latest
Expand All @@ -327,15 +313,9 @@ jobs:
fail-fast: false
matrix:
include:
- branch: swift-5.8-release
tag: 5.8-RELEASE
name: Windows Swift 5.8
- branch: swift-5.9-release
tag: 5.9-RELEASE
name: Windows Swift 5.9
- branch: swift-5.10-release
tag: 5.10-RELEASE
name: Windows Swift 5.10
- branch: swift-6.0-release
tag: 6.0-RELEASE
name: Windows Swift 6.0
steps:
- name: Setup
uses: compnerd/gha-setup-swift@main
Expand Down
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# file options

--symlinks ignore
--swiftversion 5.7
--swiftversion 5.9

# format options

Expand Down
93 changes: 93 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/Alamofire-Package.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Alamofire"
BuildableName = "Alamofire"
BlueprintName = "Alamofire"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AlamofireDynamic"
BuildableName = "AlamofireDynamic"
BlueprintName = "AlamofireDynamic"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AlamofireTests"
BuildableName = "AlamofireTests"
BlueprintName = "AlamofireTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Alamofire"
BuildableName = "Alamofire"
BlueprintName = "Alamofire"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Loading

0 comments on commit 7500a8e

Please sign in to comment.