Skip to content

Commit aa2cb35

Browse files
authored
Update Xcode 16 and add Swift 6 toolchain support on macOS (#118)
* Update Xcode 16 for GitHub action CI * Update CI config and fix warning for Swift 6 compiler * Fix VersionSeedTests warning on Swift 6 compiler * Update iOS simulator destination * Update Swift 6 nightly for Linux and WASM * Fix WASM and Ubuntu dock issue * Fix Switch warning on iOS * Fix macOS 2024 target issue * Fix breaking change on Testing+Bug * Fix crash issue on iOS 18 * Add 'continue-on-error' for nightly Swift versions in Ubuntu and wasm workflows * Fix EnvironmentValuesTest on iOS 18 * Fix Semantics multi thread access issue * Fix iOS CI config
1 parent d80c8e6 commit aa2cb35

File tree

27 files changed

+474
-125
lines changed

27 files changed

+474
-125
lines changed

.github/workflows/compatibility_tests.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
include:
16-
- os: macos-14
17-
xcode-version: "15.3" # Swift 5.10
15+
os: [macos-14]
16+
xcode-version: ["16.0"]
17+
release: [2024]
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
OPENSWIFTUI_WERROR: 1
21-
OPENSWIFTUI_SWIFT_TESTING: 1
2221
OPENGRAPH_ATTRIBUTEGRAPH: 1
2322
OPENSWIFTUI_SWIFT_LOG: 0
23+
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
2424
steps:
2525
- uses: actions/checkout@v4
2626
- name: Setup Xcode
@@ -46,15 +46,19 @@ jobs:
4646
strategy:
4747
fail-fast: false
4848
matrix:
49+
os: [macos-14]
50+
xcode-version: ["16.0"]
51+
release: [2024]
52+
ios-version: ["18.0"]
4953
include:
50-
- os: macos-14
51-
xcode-version: "15.3" # Swift 5.10
54+
- ios-version: "18.0"
55+
ios-simulator-name: "iPhone 16 Pro"
5256
runs-on: ${{ matrix.os }}
5357
env:
5458
OPENSWIFTUI_WERROR: 1
55-
OPENSWIFTUI_SWIFT_TESTING: 1
5659
OPENGRAPH_ATTRIBUTEGRAPH: 1
5760
OPENSWIFTUI_SWIFT_LOG: 0
61+
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
5862
steps:
5963
- uses: actions/checkout@v4
6064
- name: Setup Xcode
@@ -68,7 +72,7 @@ jobs:
6872
xcodebuild test \
6973
-scheme OpenSwiftUI \
7074
-configuration Debug \
71-
-destination "platform=iOS-Simulator" \
75+
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
7276
-skipMacroValidation \
7377
-skipPackagePluginValidation
7478
env:
@@ -78,7 +82,7 @@ jobs:
7882
xcodebuild test \
7983
-scheme OpenSwiftUI \
8084
-configuration Debug \
81-
-destination "platform=iOS-Simulator" \
85+
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
8286
-skipMacroValidation \
8387
-skipPackagePluginValidation
8488
env:

.github/workflows/ios.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [macos-14]
16-
xcode-version: [15.3]
16+
xcode-version: [16.0]
1717
release: [2021, 2024]
18+
ios-version: ["18.0"]
19+
include:
20+
- ios-version: "18.0"
21+
ios-simulator-name: "iPhone 16 Pro"
1822
runs-on: ${{ matrix.os }}
1923
env:
2024
OPENSWIFTUI_WERROR: 1
21-
OPENSWIFTUI_SWIFT_TESTING: 1
2225
OPENGRAPH_ATTRIBUTEGRAPH: 1
2326
OPENSWIFTUI_COMPATIBILITY_TEST: 0
2427
OPENSWIFTUI_SWIFT_LOG: 0
@@ -31,19 +34,19 @@ jobs:
3134
xcode-version: ${{ matrix.xcode-version }}
3235
- name: Swift version
3336
run: swift --version
34-
- name: Build in release mode
37+
- name: Build test target in debug mode
3538
run: |
3639
xcodebuild build \
3740
-scheme OpenSwiftUI \
3841
-configuration Debug \
39-
-destination "platform=iOS-Simulator" \
42+
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
4043
-skipMacroValidation \
4144
-skipPackagePluginValidation
42-
- name: Build and run tests in debug mode
45+
- name: Run test target in debug mode
4346
run: |
4447
xcodebuild test \
4548
-scheme OpenSwiftUI \
4649
-configuration Debug \
47-
-destination "platform=iOS-Simulator" \
50+
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
4851
-skipMacroValidation \
4952
-skipPackagePluginValidation

.github/workflows/macos.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [macos-14]
16-
xcode-version: [15.3]
16+
xcode-version: [16.0]
1717
release: [2021, 2024]
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
OPENSWIFTUI_WERROR: 1
21-
OPENSWIFTUI_SWIFT_TESTING: 1
2221
OPENGRAPH_ATTRIBUTEGRAPH: 1
2322
OPENSWIFTUI_COMPATIBILITY_TEST: 0
2423
OPENSWIFTUI_SWIFT_LOG: 0

.github/workflows/ubuntu.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
swift_version: ["5.10"]
15+
# swift_version: ["5.10"]
16+
container: ["swift:5.10-jammy", "swiftlang/swift:nightly-6.0-jammy"]
17+
include:
18+
- container: "swiftlang/swift:nightly-6.0-jammy"
19+
continue-on-error: true
1620
runs-on: ubuntu-22.04
1721
env:
1822
OPENSWIFTUI_WERROR: 1
1923
OPENSWIFTUI_SWIFT_TESTING: 1
2024
OPENGRAPH_ATTRIBUTEGRAPH: 0
2125
OPENSWIFTUI_COMPATIBILITY_TEST: 0
2226
OPENSWIFTUI_SWIFT_LOG: 1
23-
container: swift:${{ matrix.swift_version }}-jammy
27+
# container: swift:${{ matrix.swift_version }}-jammy
28+
container: ${{ matrix.container }}
2429
steps:
2530
- uses: actions/checkout@v4
2631
- name: Building and running tests in debug mode with coverage
@@ -35,14 +40,21 @@ jobs:
3540
-instr-profile=.build-test-debug/debug/codecov/default.profdata \
3641
.build-test-debug/debug/OpenSwiftUIPackageTests.xctest \
3742
> coverage.txt
43+
continue-on-error: ${{ matrix.continue-on-error }}
44+
id: debug-test
3845
- name: Building and running tests in release mode
3946
run: |
4047
swift test \
4148
-c release \
4249
--filter OpenSwiftUITests \
4350
-Xswiftc -warnings-as-errors \
4451
--build-path .build-test-release
52+
continue-on-error: ${{ matrix.continue-on-error }}
53+
id: release-test
54+
if: steps.debug-test.outcome == 'success'
4555
- uses: codecov/codecov-action@v3
4656
with:
4757
token: ${{ secrets.CODECOV_TOKEN }}
4858
verbose: true
59+
continue-on-error: true
60+
if: steps.debug-test.outcome == 'success'

.github/workflows/wasm.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
swift_version: ["5.10.0-RELEASE"]
15+
swift_version: ["5.10.0-RELEASE", "6.0-SNAPSHOT-2024-08-30-a"]
1616
os: [ubuntu-22.04]
1717
extra_params: [""]
18+
include:
19+
- swift_version: "6.0-SNAPSHOT-2024-08-30-a"
20+
continue-on-error: true
1821
runs-on: ${{ matrix.os }}
1922
env:
2023
OPENSWIFTUI_WERROR: 1
@@ -30,6 +33,7 @@ jobs:
3033
- name: build
3134
run: |
3235
swift build --triple wasm32-unknown-wasi ${{ matrix.extra_params }}
36+
continue-on-error: ${{ matrix.continue-on-error }}
3337
# Blocked by upstream support for WASM. See https://github.com/apple/swift-testing/issues/228
3438
# - name: test
3539
# run: |

Package.resolved

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.10
1+
// swift-tools-version: 6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import Foundation
@@ -25,17 +25,20 @@ let systemFrameworkSearchFlag = isXcodeEnv ? "-iframework" : "-Fsystem"
2525

2626
let releaseVersion = Context.environment["OPENSWIFTUI_TARGET_RELEASE"].flatMap { Int($0) } ?? 2021
2727
let platforms: [SupportedPlatform] = switch releaseVersion {
28-
case 2024:
29-
#if swift(>=6.0)
28+
case 2024: // iOS 18.0
29+
// FIXME: non-Darwin platform nightly Swift 6 compiler have not add the latest OS yet
30+
#if canImport(Darwin)
3031
[
3132
.iOS(.v18),
32-
.macOS(.v15),
33+
// FIXME: temporary lower the requirement since there is no macOS 15 CI yet.
34+
// .macOS(.v15),
35+
.macOS(.v14),
3336
.macCatalyst(.v18),
3437
.tvOS(.v18),
3538
.watchOS(.v10),
3639
.visionOS(.v2),
3740
]
38-
#else // FIXME: Remove when we bump to Swift 6.0
41+
#else
3942
[
4043
.iOS(.v17),
4144
.macOS(.v14),
@@ -68,6 +71,8 @@ var sharedSwiftSettings: [SwiftSetting] = [
6871
.enableExperimentalFeature("AccessLevelOnImport"),
6972
.define("OPENSWIFTUI_SUPPRESS_DEPRECATED_WARNINGS"),
7073
.define("OPENSWIFTUI_RELEASE_\(releaseVersion)"),
74+
.swiftLanguageMode(.v5),
75+
.enableUpcomingFeature("BareSlashRegexLiterals"),
7176
]
7277

7378
if releaseVersion >= 2021 {
@@ -122,14 +127,6 @@ let openSwiftUITestTarget = Target.testTarget(
122127
exclude: ["README.md"],
123128
swiftSettings: sharedSwiftSettings
124129
)
125-
let openSwiftUITempTestTarget = Target.testTarget(
126-
name: "OpenSwiftUITempTests",
127-
dependencies: [
128-
"OpenSwiftUI",
129-
],
130-
exclude: ["README.md"],
131-
swiftSettings: sharedSwiftSettings
132-
)
133130
let openSwiftUICompatibilityTestTarget = Target.testTarget(
134131
name: "OpenSwiftUICompatibilityTests",
135132
exclude: ["README.md"],
@@ -180,6 +177,10 @@ let package = Package(
180177
openSwiftUICoreTarget,
181178
openSwiftUITarget,
182179
openSwiftUIExtensionTarget,
180+
181+
openSwiftUICoreTestTarget,
182+
openSwiftUITestTarget,
183+
openSwiftUICompatibilityTestTarget,
183184
]
184185
)
185186

@@ -212,21 +213,13 @@ extension Target {
212213
swiftSettings.append(.define("OPENSWIFTUI_SWIFT_LOG"))
213214
self.swiftSettings = swiftSettings
214215
}
215-
216-
func addSwiftTestingSettings() {
217-
dependencies.append(.product(name: "Testing", package: "swift-testing"))
218-
var swiftSettings = swiftSettings ?? []
219-
swiftSettings.append(.define("OPENSWIFTUI_SWIFT_TESTING"))
220-
self.swiftSettings = swiftSettings
221-
}
222216
}
223217

224218
if attributeGraphCondition {
225219
openSwiftUICoreTarget.addAGSettings()
226220
openSwiftUITarget.addAGSettings()
227221
openSwiftUICoreTestTarget.addAGSettings()
228222
openSwiftUITestTarget.addAGSettings()
229-
openSwiftUITempTestTarget.addAGSettings()
230223
openSwiftUICompatibilityTestTarget.addAGSettings()
231224
}
232225

@@ -256,24 +249,6 @@ if swiftLogCondition {
256249
openSwiftUITarget.addSwiftLogSettings()
257250
}
258251

259-
// Remove the check when swift-testing reaches 1.0.0
260-
let swiftTestingCondition = envEnable("OPENSWIFTUI_SWIFT_TESTING", default: true)
261-
if swiftTestingCondition {
262-
package.dependencies.append(
263-
// Fix it to be 0.3.0 before we bump to Swift 5.10
264-
.package(url: "https://github.com/apple/swift-testing", exact: "0.6.0")
265-
)
266-
openSwiftUICoreTestTarget.addSwiftTestingSettings()
267-
openSwiftUITestTarget.addSwiftTestingSettings()
268-
openSwiftUITempTestTarget.addSwiftTestingSettings()
269-
openSwiftUICompatibilityTestTarget.addSwiftTestingSettings()
270-
271-
package.targets.append(openSwiftUICoreTestTarget)
272-
package.targets.append(openSwiftUITestTarget)
273-
package.targets.append(openSwiftUITempTestTarget)
274-
package.targets.append(openSwiftUICompatibilityTestTarget)
275-
}
276-
277252
let compatibilityTestCondition = envEnable("OPENSWIFTUI_COMPATIBILITY_TEST")
278253
if compatibilityTestCondition {
279254
var swiftSettings: [SwiftSetting] = (openSwiftUICompatibilityTestTarget.swiftSettings ?? [])

0 commit comments

Comments
 (0)