Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Xcode 16 and add Swift 6 toolchain support on macOS #118

Merged
merged 15 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
xcode-version: "15.3" # Swift 5.10
os: [macos-14]
xcode-version: ["16.0"]
release: [2024]
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -46,15 +46,19 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-14]
xcode-version: ["16.0"]
release: [2024]
ios-version: ["18.0"]
include:
- os: macos-14
xcode-version: "15.3" # Swift 5.10
- ios-version: "18.0"
ios-simulator-name: "iPhone 16 Pro"
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -68,7 +72,7 @@ jobs:
xcodebuild test \
-scheme OpenSwiftUI \
-configuration Debug \
-destination "platform=iOS-Simulator" \
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
-skipMacroValidation \
-skipPackagePluginValidation
env:
Expand All @@ -78,7 +82,7 @@ jobs:
xcodebuild test \
-scheme OpenSwiftUI \
-configuration Debug \
-destination "platform=iOS-Simulator" \
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
-skipMacroValidation \
-skipPackagePluginValidation
env:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ jobs:
fail-fast: false
matrix:
os: [macos-14]
xcode-version: [15.3]
xcode-version: [16.0]
release: [2021, 2024]
ios-version: ["18.0"]
include:
- ios-version: "18.0"
ios-simulator-name: "iPhone 16 Pro"
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 0
Expand All @@ -31,19 +34,19 @@ jobs:
xcode-version: ${{ matrix.xcode-version }}
- name: Swift version
run: swift --version
- name: Build in release mode
- name: Build test target in debug mode
run: |
xcodebuild build \
-scheme OpenSwiftUI \
-configuration Debug \
-destination "platform=iOS-Simulator" \
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
-skipMacroValidation \
-skipPackagePluginValidation
- name: Build and run tests in debug mode
- name: Run test target in debug mode
run: |
xcodebuild test \
-scheme OpenSwiftUI \
-configuration Debug \
-destination "platform=iOS-Simulator" \
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \
-skipMacroValidation \
-skipPackagePluginValidation
3 changes: 1 addition & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ jobs:
fail-fast: false
matrix:
os: [macos-14]
xcode-version: [15.3]
xcode-version: [16.0]
release: [2021, 2024]
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 0
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["5.10"]
# swift_version: ["5.10"]
container: ["swift:5.10-jammy", "swiftlang/swift:nightly-6.0-jammy"]
include:
- container: "swiftlang/swift:nightly-6.0-jammy"
continue-on-error: true
runs-on: ubuntu-22.04
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 0
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 1
container: swift:${{ matrix.swift_version }}-jammy
# container: swift:${{ matrix.swift_version }}-jammy
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- name: Building and running tests in debug mode with coverage
Expand All @@ -35,14 +40,21 @@ jobs:
-instr-profile=.build-test-debug/debug/codecov/default.profdata \
.build-test-debug/debug/OpenSwiftUIPackageTests.xctest \
> coverage.txt
continue-on-error: ${{ matrix.continue-on-error }}
id: debug-test
- name: Building and running tests in release mode
run: |
swift test \
-c release \
--filter OpenSwiftUITests \
-Xswiftc -warnings-as-errors \
--build-path .build-test-release
continue-on-error: ${{ matrix.continue-on-error }}
id: release-test
if: steps.debug-test.outcome == 'success'
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
continue-on-error: true
if: steps.debug-test.outcome == 'success'
6 changes: 5 additions & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["5.10.0-RELEASE"]
swift_version: ["5.10.0-RELEASE", "6.0-SNAPSHOT-2024-08-30-a"]
os: [ubuntu-22.04]
extra_params: [""]
include:
- swift_version: "6.0-SNAPSHOT-2024-08-30-a"
continue-on-error: true
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
Expand All @@ -30,6 +33,7 @@ jobs:
- name: build
run: |
swift build --triple wasm32-unknown-wasi ${{ matrix.extra_params }}
continue-on-error: ${{ matrix.continue-on-error }}
# Blocked by upstream support for WASM. See https://github.com/apple/swift-testing/issues/228
# - name: test
# run: |
Expand Down
22 changes: 2 additions & 20 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
{
"originHash" : "9749b5257cf4f28f086bdeac0424718c7ae499aeea22fdc45686fac00d8d561d",
"originHash" : "cdf36bf15198d7bcb885a48608be3523149b364fdff48359b2fb61e43ce7833b",
"pins" : [
{
"identity" : "opengraph",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "58961e8c7fb7528a89dcd77a3a28a950f1791f1f"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "fa8f95c2d536d6620cc2f504ebe8a6167c9fc2dd",
"version" : "510.0.1"
}
},
{
"identity" : "swift-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-testing",
"state" : {
"revision" : "8097dd8bcf7f2ed85f8aa8883635ce413012f53b",
"version" : "0.6.0"
"revision" : "ec8ca116219e95b227937898835af5b49a011d71"
}
}
],
Expand Down
53 changes: 14 additions & 39 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.10
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

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

let releaseVersion = Context.environment["OPENSWIFTUI_TARGET_RELEASE"].flatMap { Int($0) } ?? 2021
let platforms: [SupportedPlatform] = switch releaseVersion {
case 2024:
#if swift(>=6.0)
case 2024: // iOS 18.0
// FIXME: non-Darwin platform nightly Swift 6 compiler have not add the latest OS yet
#if canImport(Darwin)
[
.iOS(.v18),
.macOS(.v15),
// FIXME: temporary lower the requirement since there is no macOS 15 CI yet.
// .macOS(.v15),
.macOS(.v14),
.macCatalyst(.v18),
.tvOS(.v18),
.watchOS(.v10),
.visionOS(.v2),
]
#else // FIXME: Remove when we bump to Swift 6.0
#else
[
.iOS(.v17),
.macOS(.v14),
Expand Down Expand Up @@ -68,6 +71,8 @@ var sharedSwiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("AccessLevelOnImport"),
.define("OPENSWIFTUI_SUPPRESS_DEPRECATED_WARNINGS"),
.define("OPENSWIFTUI_RELEASE_\(releaseVersion)"),
.swiftLanguageMode(.v5),
.enableUpcomingFeature("BareSlashRegexLiterals"),
]

if releaseVersion >= 2021 {
Expand Down Expand Up @@ -122,14 +127,6 @@ let openSwiftUITestTarget = Target.testTarget(
exclude: ["README.md"],
swiftSettings: sharedSwiftSettings
)
let openSwiftUITempTestTarget = Target.testTarget(
name: "OpenSwiftUITempTests",
dependencies: [
"OpenSwiftUI",
],
exclude: ["README.md"],
swiftSettings: sharedSwiftSettings
)
let openSwiftUICompatibilityTestTarget = Target.testTarget(
name: "OpenSwiftUICompatibilityTests",
exclude: ["README.md"],
Expand Down Expand Up @@ -180,6 +177,10 @@ let package = Package(
openSwiftUICoreTarget,
openSwiftUITarget,
openSwiftUIExtensionTarget,

openSwiftUICoreTestTarget,
openSwiftUITestTarget,
openSwiftUICompatibilityTestTarget,
]
)

Expand Down Expand Up @@ -212,21 +213,13 @@ extension Target {
swiftSettings.append(.define("OPENSWIFTUI_SWIFT_LOG"))
self.swiftSettings = swiftSettings
}

func addSwiftTestingSettings() {
dependencies.append(.product(name: "Testing", package: "swift-testing"))
var swiftSettings = swiftSettings ?? []
swiftSettings.append(.define("OPENSWIFTUI_SWIFT_TESTING"))
self.swiftSettings = swiftSettings
}
}

if attributeGraphCondition {
openSwiftUICoreTarget.addAGSettings()
openSwiftUITarget.addAGSettings()
openSwiftUICoreTestTarget.addAGSettings()
openSwiftUITestTarget.addAGSettings()
openSwiftUITempTestTarget.addAGSettings()
openSwiftUICompatibilityTestTarget.addAGSettings()
}

Expand Down Expand Up @@ -256,24 +249,6 @@ if swiftLogCondition {
openSwiftUITarget.addSwiftLogSettings()
}

// Remove the check when swift-testing reaches 1.0.0
let swiftTestingCondition = envEnable("OPENSWIFTUI_SWIFT_TESTING", default: true)
if swiftTestingCondition {
package.dependencies.append(
// Fix it to be 0.3.0 before we bump to Swift 5.10
.package(url: "https://github.com/apple/swift-testing", exact: "0.6.0")
)
openSwiftUICoreTestTarget.addSwiftTestingSettings()
openSwiftUITestTarget.addSwiftTestingSettings()
openSwiftUITempTestTarget.addSwiftTestingSettings()
openSwiftUICompatibilityTestTarget.addSwiftTestingSettings()

package.targets.append(openSwiftUICoreTestTarget)
package.targets.append(openSwiftUITestTarget)
package.targets.append(openSwiftUITempTestTarget)
package.targets.append(openSwiftUICompatibilityTestTarget)
}

let compatibilityTestCondition = envEnable("OPENSWIFTUI_COMPATIBILITY_TEST")
if compatibilityTestCondition {
var swiftSettings: [SwiftSetting] = (openSwiftUICompatibilityTestTarget.swiftSettings ?? [])
Expand Down
Loading
Loading