Skip to content

Commit 2dc1682

Browse files
authored
Fix CI workflows and test matrix (#66)
* Fix format workflow permissions * Fix CI simulator selection and snapshots * Test Mac Catalyst in CI Add a Mac Catalyst test target to the full Makefile matrix. Keep iOS snapshot and fixture-backed selection tests out of Catalyst because they depend on UIKit snapshots or iOS-recorded fixtures. * Use macOS 26 for CI workflows Run the current Xcode CI, demo, and format jobs on macOS 26 with Xcode 26.5. Keep the Xcode 16.4 compatibility job on macOS 15 because that image still provides the older Xcode.
1 parent 664b108 commit 2dc1682

18 files changed

Lines changed: 99 additions & 60 deletions

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ concurrency:
3232
jobs:
3333
test:
3434
name: Test All Platforms
35-
runs-on: macos-15
35+
runs-on: macos-26
3636
steps:
3737
- uses: actions/checkout@v4
38-
- name: Select Xcode 26.0
39-
run: sudo xcode-select -s /Applications/Xcode_26.0.app
38+
- name: Select Xcode 26.5
39+
run: sudo xcode-select -s /Applications/Xcode_26.5.app
4040
- name: Skip macro validation
4141
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
4242
- name: Run tests
4343
run: make test
4444

4545
build-demo:
4646
name: Build TextualDemo
47-
runs-on: macos-15
47+
runs-on: macos-26
4848
steps:
4949
- uses: actions/checkout@v4
50-
- name: Select Xcode 26.0
51-
run: sudo xcode-select -s /Applications/Xcode_26.0.app
50+
- name: Select Xcode 26.5
51+
run: sudo xcode-select -s /Applications/Xcode_26.5.app
5252
- name: Skip macro validation
5353
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
5454
- name: Build demo

.github/workflows/format.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ concurrency:
1212
jobs:
1313
swift_format:
1414
name: swift-format
15-
runs-on: macos-15
15+
runs-on: macos-26
16+
permissions:
17+
contents: write
1618
steps:
17-
- uses: actions/checkout@v4
18-
- name: Select Xcode 26.0
19-
run: sudo xcode-select -s /Applications/Xcode_26.0.app
19+
- uses: actions/checkout@v5
20+
- name: Select Xcode 26.5
21+
run: sudo xcode-select -s /Applications/Xcode_26.5.app
2022
- name: Format
2123
run: make format
22-
- uses: stefanzweifel/git-auto-commit-action@v4
24+
- uses: stefanzweifel/git-auto-commit-action@v5
2325
with:
2426
commit_message: Run swift-format
2527
branch: main
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,50 @@
1-
IOS_VERSION = 26.0
2-
TVOS_VERSION = 26.0
3-
WATCHOS_VERSION = 26.0
4-
VISIONOS_VERSION = 26.0
1+
IOS_DEVICE = iPhone
2+
TVOS_DEVICE = TV
3+
WATCHOS_DEVICE = Watch
4+
VISIONOS_DEVICE = Vision
55

6-
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS $(IOS_VERSION),iPhone \d\+ Pro [^M])
6+
IOS_SIMULATOR = $(call udid_for,$(IOS_DEVICE))
7+
TVOS_SIMULATOR = $(call udid_for,$(TVOS_DEVICE))
8+
WATCHOS_SIMULATOR = $(call udid_for,$(WATCHOS_DEVICE))
9+
VISIONOS_SIMULATOR = $(call udid_for,$(VISIONOS_DEVICE))
10+
11+
PLATFORM_IOS = iOS Simulator,id=$(IOS_SIMULATOR)
712
PLATFORM_MACOS = macOS
8-
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS $(TVOS_VERSION),TV)
9-
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS $(WATCHOS_VERSION),Watch)
10-
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS $(VISIONOS_VERSION),Vision)
13+
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
14+
PLATFORM_TVOS = tvOS Simulator,id=$(TVOS_SIMULATOR)
15+
PLATFORM_WATCHOS = watchOS Simulator,id=$(WATCHOS_SIMULATOR)
16+
PLATFORM_VISIONOS = visionOS Simulator,id=$(VISIONOS_SIMULATOR)
1117

1218
default: test
1319

14-
test: test-macos test-ios test-tvos test-watchos test-visionos
20+
test: test-macos test-maccatalyst test-ios test-tvos test-watchos test-visionos
1521

1622
test-macos:
1723
@echo "Testing macOS..."
1824
xcodebuild test -scheme Textual -destination platform="$(PLATFORM_MACOS)"
1925

26+
test-maccatalyst:
27+
@echo "Testing Mac Catalyst..."
28+
xcodebuild test -scheme Textual -destination platform="$(PLATFORM_MAC_CATALYST)"
29+
2030
test-ios:
21-
@echo "Testing iOS $(IOS_VERSION)..."
31+
@echo "Testing iOS..."
32+
$(call require_simulator,$(IOS_SIMULATOR),$(IOS_DEVICE))
2233
xcodebuild test -scheme Textual -destination platform="$(PLATFORM_IOS)"
2334

2435
test-tvos:
25-
@echo "Testing tvOS $(TVOS_VERSION)..."
36+
@echo "Testing tvOS..."
37+
$(call require_simulator,$(TVOS_SIMULATOR),$(TVOS_DEVICE))
2638
xcodebuild test -scheme Textual -destination platform="$(PLATFORM_TVOS)"
2739

2840
test-watchos:
29-
@echo "Testing watchOS $(WATCHOS_VERSION)..."
41+
@echo "Testing watchOS..."
42+
$(call require_simulator,$(WATCHOS_SIMULATOR),$(WATCHOS_DEVICE))
3043
xcodebuild test -scheme Textual -destination platform="$(PLATFORM_WATCHOS)"
3144

3245
test-visionos:
33-
@echo "Testing visionOS $(PLATFORM_VISIONOS)..."
46+
@echo "Testing visionOS..."
47+
$(call require_simulator,$(VISIONOS_SIMULATOR),$(VISIONOS_DEVICE))
3448
xcodebuild test -scheme Textual -destination platform="$(PLATFORM_VISIONOS)"
3549

3650
format:
@@ -51,8 +65,12 @@ build-demo:
5165
@echo "Building TextualDemo for macOS..."
5266
xcodebuild build -workspace Textual.xcworkspace -scheme TextualDemo -destination platform="$(PLATFORM_MACOS)" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
5367

54-
.PHONY: format test bundle-prism build-demo
68+
.PHONY: format test test-macos test-maccatalyst test-ios test-tvos test-watchos test-visionos bundle-prism build-demo
5569

5670
define udid_for
57-
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
71+
$(shell xcrun simctl list --json devices available '$(1)' | jq -r '[.devices | to_entries | sort_by(.key) | reverse | .[].value | select(length > 0) | .[0]][0].udid // empty')
72+
endef
73+
74+
define require_simulator
75+
@test "$(1)" != "" || (echo "No available simulator found matching '$(2)'" >&2; exit 1)
5876
endef

Package.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ let package = Package(
3030
.process("Internal/Highlighter/Prism")
3131
],
3232
swiftSettings: [
33-
.define("TEXTUAL_ENABLE_LINKS", .when(platforms: [.macOS, .macCatalyst, .iOS, .watchOS, .visionOS])),
34-
.define("TEXTUAL_ENABLE_TEXT_SELECTION", .when(platforms: [.macOS, .macCatalyst, .iOS, .visionOS])),
33+
.define(
34+
"TEXTUAL_ENABLE_LINKS",
35+
.when(platforms: [.macOS, .macCatalyst, .iOS, .watchOS, .visionOS])),
36+
.define(
37+
"TEXTUAL_ENABLE_TEXT_SELECTION",
38+
.when(platforms: [.macOS, .macCatalyst, .iOS, .visionOS])),
3539
]
3640
),
3741
.testTarget(
@@ -46,7 +50,9 @@ let package = Package(
4650
],
4751
resources: [.copy("Fixtures")],
4852
swiftSettings: [
49-
.define("TEXTUAL_ENABLE_TEXT_SELECTION", .when(platforms: [.macOS, .macCatalyst, .iOS, .visionOS]))
53+
.define(
54+
"TEXTUAL_ENABLE_TEXT_SELECTION",
55+
.when(platforms: [.macOS, .macCatalyst, .iOS, .visionOS]))
5056
]
5157
),
5258
]

Tests/TextualTests/Helpers/Snapshotting+TextLayoutCollection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if TEXTUAL_ENABLE_TEXT_SELECTION && os(iOS)
1+
#if TEXTUAL_ENABLE_TEXT_SELECTION && os(iOS) && !targetEnvironment(macCatalyst)
22
import SnapshotTesting
33
import SwiftUI
44

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#if os(iOS) && !targetEnvironment(macCatalyst)
2+
import SnapshotTesting
3+
import SwiftUI
4+
5+
extension Snapshotting where Value: SwiftUI.View, Format == UIImage {
6+
@MainActor
7+
static func textualImage(layout: SwiftUISnapshotLayout) -> Snapshotting {
8+
.image(
9+
precision: 0.995,
10+
perceptualPrecision: 0.98,
11+
layout: layout
12+
)
13+
}
14+
}
15+
#endif

Tests/TextualTests/Helpers/TextSelectionModel+Fixture.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
}
1919

20-
#if os(iOS)
20+
#if os(iOS) && !targetEnvironment(macCatalyst)
2121
extension TextSelectionModel {
2222
@MainActor static func recordFixture<Content: View>(
2323
for content: Content,

Tests/TextualTests/Internal/TextInteraction/TextLayoutCollectionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(iOS)
1+
#if os(iOS) && !targetEnvironment(macCatalyst)
22
import SwiftUI
33
import Testing
44
import SnapshotTesting

Tests/TextualTests/Internal/TextInteraction/TextSelectionModelTests+macOS.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if TEXTUAL_ENABLE_TEXT_SELECTION
1+
#if TEXTUAL_ENABLE_TEXT_SELECTION && !targetEnvironment(macCatalyst)
22
import Foundation
33
import SwiftUI
44
import Testing

Tests/TextualTests/Internal/TextInteraction/TextSelectionModelTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if TEXTUAL_ENABLE_TEXT_SELECTION
1+
#if TEXTUAL_ENABLE_TEXT_SELECTION && !targetEnvironment(macCatalyst)
22
import Foundation
33
import SwiftUI
44
import Testing

0 commit comments

Comments
 (0)