Skip to content

Commit

Permalink
Add compatibility CI (#81)
Browse files Browse the repository at this point in the history
* Add CI

* wip

* wip

* wip

* test

* wip
  • Loading branch information
stephencelis authored Jun 4, 2024
1 parent 3331558 commit 2cf8822
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ jobs:
config: ['debug', 'release']
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Run ${{ matrix.config }} tests
run: swift test -c ${{ matrix.config }}
- name: Run compatibility tests
run: make test-compatibility
if: ${{ matrix.config == 'debug' }}
9 changes: 9 additions & 0 deletions Example/Compatibility/App.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import SwiftUI

@main
struct CompatibilityApp: App {
var body: some Scene {
WindowGroup {
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Example/Compatibility/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
8 changes: 8 additions & 0 deletions Example/Compatibility/Compatibility.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Perception
import SwiftUI

@Observable class Model {}

func testUnqualifiedBindable() {
@Bindable var model = Model()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
152 changes: 152 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
CA114E932AE1FC29004844BE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA114E922AE1FC29004844BE /* ContentView.swift */; };
CA114E952AE1FC2A004844BE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CA114E942AE1FC2A004844BE /* Assets.xcassets */; };
CA114EBE2AE1FCD7004844BE /* Perception in Frameworks */ = {isa = PBXBuildFile; productRef = CA114EBD2AE1FCD7004844BE /* Perception */; };
DC40DDAC2C0F98DF00B70F53 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC40DDAB2C0F98DF00B70F53 /* App.swift */; };
DC40DDAE2C0F98DF00B70F53 /* Compatibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC40DDAD2C0F98DF00B70F53 /* Compatibility.swift */; };
DC40DDB02C0F98E100B70F53 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC40DDAF2C0F98E100B70F53 /* Assets.xcassets */; };
DC40DDB32C0F98E100B70F53 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC40DDB22C0F98E100B70F53 /* Preview Assets.xcassets */; };
DC40DDD42C0F991D00B70F53 /* Perception in Frameworks */ = {isa = PBXBuildFile; productRef = DC40DDD32C0F991D00B70F53 /* Perception */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -20,6 +25,11 @@
CA114E942AE1FC2A004844BE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
CA114EBA2AE1FC71004844BE /* swift-perception */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "swift-perception"; path = ..; sourceTree = "<group>"; };
CA114EBB2AE1FCCE004844BE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
DC40DDA92C0F98DF00B70F53 /* Compatibility.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Compatibility.app; sourceTree = BUILT_PRODUCTS_DIR; };
DC40DDAB2C0F98DF00B70F53 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
DC40DDAD2C0F98DF00B70F53 /* Compatibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Compatibility.swift; sourceTree = "<group>"; };
DC40DDAF2C0F98E100B70F53 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
DC40DDB22C0F98E100B70F53 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -31,6 +41,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
DC40DDA62C0F98DF00B70F53 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
DC40DDD42C0F991D00B70F53 /* Perception in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand All @@ -39,6 +57,7 @@
children = (
CA114EBA2AE1FC71004844BE /* swift-perception */,
CA114E8F2AE1FC29004844BE /* Example */,
DC40DDAA2C0F98DF00B70F53 /* Compatibility */,
CA114E8E2AE1FC29004844BE /* Products */,
CA114EBC2AE1FCD7004844BE /* Frameworks */,
);
Expand All @@ -48,6 +67,7 @@
isa = PBXGroup;
children = (
CA114E8D2AE1FC29004844BE /* Example.app */,
DC40DDA92C0F98DF00B70F53 /* Compatibility.app */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -70,6 +90,25 @@
name = Frameworks;
sourceTree = "<group>";
};
DC40DDAA2C0F98DF00B70F53 /* Compatibility */ = {
isa = PBXGroup;
children = (
DC40DDAB2C0F98DF00B70F53 /* App.swift */,
DC40DDAD2C0F98DF00B70F53 /* Compatibility.swift */,
DC40DDAF2C0F98E100B70F53 /* Assets.xcassets */,
DC40DDB12C0F98E100B70F53 /* Preview Content */,
);
path = Compatibility;
sourceTree = "<group>";
};
DC40DDB12C0F98E100B70F53 /* Preview Content */ = {
isa = PBXGroup;
children = (
DC40DDB22C0F98E100B70F53 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -93,6 +132,26 @@
productReference = CA114E8D2AE1FC29004844BE /* Example.app */;
productType = "com.apple.product-type.application";
};
DC40DDA82C0F98DF00B70F53 /* Compatibility */ = {
isa = PBXNativeTarget;
buildConfigurationList = DC40DDD02C0F98E100B70F53 /* Build configuration list for PBXNativeTarget "Compatibility" */;
buildPhases = (
DC40DDA52C0F98DF00B70F53 /* Sources */,
DC40DDA62C0F98DF00B70F53 /* Frameworks */,
DC40DDA72C0F98DF00B70F53 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = Compatibility;
packageProductDependencies = (
DC40DDD32C0F991D00B70F53 /* Perception */,
);
productName = Compatibility;
productReference = DC40DDA92C0F98DF00B70F53 /* Compatibility.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand All @@ -106,6 +165,9 @@
CA114E8C2AE1FC29004844BE = {
CreatedOnToolsVersion = 15.0;
};
DC40DDA82C0F98DF00B70F53 = {
CreatedOnToolsVersion = 15.4;
};
};
};
buildConfigurationList = CA114E882AE1FC29004844BE /* Build configuration list for PBXProject "Example" */;
Expand All @@ -122,6 +184,7 @@
projectRoot = "";
targets = (
CA114E8C2AE1FC29004844BE /* Example */,
DC40DDA82C0F98DF00B70F53 /* Compatibility */,
);
};
/* End PBXProject section */
Expand All @@ -135,6 +198,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
DC40DDA72C0F98DF00B70F53 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DC40DDB32C0F98E100B70F53 /* Preview Assets.xcassets in Resources */,
DC40DDB02C0F98E100B70F53 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -147,6 +219,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
DC40DDA52C0F98DF00B70F53 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DC40DDAE2C0F98DF00B70F53 /* Compatibility.swift in Sources */,
DC40DDAC2C0F98DF00B70F53 /* App.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -327,6 +408,64 @@
};
name = Release;
};
DC40DDCA2C0F98E100B70F53 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Compatibility/Preview Content\"";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Compatibility;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
DC40DDCB2C0F98E100B70F53 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Compatibility/Preview Content\"";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Compatibility;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand All @@ -348,13 +487,26 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
DC40DDD02C0F98E100B70F53 /* Build configuration list for PBXNativeTarget "Compatibility" */ = {
isa = XCConfigurationList;
buildConfigurations = (
DC40DDCA2C0F98E100B70F53 /* Debug */,
DC40DDCB2C0F98E100B70F53 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
CA114EBD2AE1FCD7004844BE /* Perception */ = {
isa = XCSwiftPackageProductDependency;
productName = Perception;
};
DC40DDD32C0F991D00B70F53 /* Perception */ = {
isa = XCSwiftPackageProductDependency;
productName = Perception;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = CA114E852AE1FC28004844BE /* Project object */;
Expand Down
15 changes: 13 additions & 2 deletions Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,23 @@
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CAA8084B2C0F9496000DE5B7"
BuildableName = "CompatibilityTests.app"
BlueprintIdentifier = "DC40DDB72C0F98E100B70F53"
BuildableName = "CompatibilityTests.xctest"
BlueprintName = "CompatibilityTests"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC40DDC12C0F98E100B70F53"
BuildableName = "CompatibilityUITests.xctest"
BlueprintName = "CompatibilityUITests"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.2,iPhone \d\+ Pro [^M])

test-compatibility:
xcodebuild \
-skipMacroValidation \
-project Example/Example.xcodeproj \
-scheme Compatibility \
-destination generic/platform="$(PLATFORM_IOS)"

format:
find . \
-path '*/Documentation.docc' -prune -o \
-name '*.swift' \
-not -path '*/.*' -print0 \
| xargs -0 swift format --ignore-unparsable-files --in-place

.PHONY: format
.PHONY: format test-compatibility

define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef

0 comments on commit 2cf8822

Please sign in to comment.