Skip to content

Commit

Permalink
Update CI (#1)
Browse files Browse the repository at this point in the history
* Update CI

* Add .codecov file
  • Loading branch information
Kyle-Ye authored Dec 21, 2023
1 parent 52266b7 commit a5b0df5
Show file tree
Hide file tree
Showing 32 changed files with 176 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- Tests
15 changes: 11 additions & 4 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ jobs:
xcode-version: ${{ matrix.xcode-version }}
- name: Swift version
run: swift --version
- name: Run tests against Apple's AttributeGraph
- name: Run tests against Apple's AttributeGraph on macOS
run: |
swift test \
-c debug \
-Xswiftc -warnings-as-errors \
--build-path .build-compatibility-test-debug
env:
OPENGRAPH_COMPATIBILITY_TEST: 1
OPENGRAPH_COMPATIBILITY_TEST: 1
# FIXME: macOS 13 CI issue. Can't reproduce on macOS 14 locally
# - name: Run tests against Apple's AttributeGraph on macOS
# run: |
# xcodebuild test \
# -scheme OpenGraph-Package \
# -sdk macosx \
# -destination "platform=macOS"
# env:
# OPENGRAPH_COMPATIBILITY_TEST: 1
10 changes: 8 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ let openGraphTestTarget = Target.testTarget(
]
)
let openGraphCompatibilityTestTarget = Target.testTarget(
name: "OpenGraphCompatibilityTests"
name: "OpenGraphCompatibilityTests",
exclude: ["README.md"]
)

let package = Package(
Expand Down Expand Up @@ -66,14 +67,19 @@ package.targets.append(attributeGraphTarget)
let compatibilityTest = ProcessInfo.processInfo.environment["OPENGRAPH_COMPATIBILITY_TEST"] != nil
if compatibilityTest {
openGraphCompatibilityTestTarget.dependencies.append("AttributeGraph")

var swiftSettings: [SwiftSetting] = (openGraphCompatibilityTestTarget.swiftSettings ?? [])
swiftSettings.append(.define("OPENGRAPH_COMPATIBILITY_TEST"))
openGraphCompatibilityTestTarget.swiftSettings = swiftSettings

var linkerSettings = openGraphCompatibilityTestTarget.linkerSettings ?? []
linkerSettings.append(.unsafeFlags([systemFrameworkSearchFlag, "/System/Library/PrivateFrameworks/"], .when(platforms: [.macOS])))
linkerSettings.append(.linkedFramework("AttributeGraph", .when(platforms: [.macOS])))
openGraphCompatibilityTestTarget.linkerSettings = linkerSettings
} else {
openGraphCompatibilityTestTarget.dependencies.append("OpenGraph")
}


// Remove this when swift-testing is 1.0.0
let useSwiftTesting = ProcessInfo.processInfo.environment["OPENGRAPH_USE_SWIFT_TESTING"] != nil
if useSwiftTesting {
Expand Down
6 changes: 4 additions & 2 deletions Sources/AttributeGraph.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>macos-arm64e</string>
<string>macos-arm64e-arm64-x86_64</string>
<key>LibraryPath</key>
<string>AttributeGraph.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64e</string>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
Expand All @@ -30,7 +32,7 @@
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64-x86_64-simulator</string>
<key>LibraryPath</key>
<string>AttributeGraph.framework</string>
<key>SupportedArchitectures</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
// swift-module-flags: -target arm64-apple-macos12.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name AttributeGraph
// swift-module-flags-ignorable: -enable-bare-slash-regex
@_exported import AttributeGraph
import Foundation
import Swift
import _Concurrency
import _StringProcessing
@frozen @propertyWrapper @dynamicMemberLookup public struct Attribute<Value> : Swift.Hashable, Swift.Equatable, Swift.CustomStringConvertible {
public var identifier: AttributeGraph.AGAttribute
public var wrappedValue: Value {
get
set
}

@inlinable public init(identifier: AttributeGraph.AGAttribute) {
self.identifier = identifier
}

@inlinable public init(_ attribute: AttributeGraph.Attribute<Value>) {
self = attribute
}

public subscript<Member>(dynamicMember keyPath: Swift.KeyPath<Value, Member>) -> AttributeGraph.Attribute<Member> {
get
}

public subscript<Member>(keyPath: Swift.KeyPath<Value, Member>) -> AttributeGraph.Attribute<Member> {
get
}

public var description: Swift.String {
get
}
public static func == (lhs: AttributeGraph.Attribute<Value>, rhs: AttributeGraph.Attribute<Value>) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public protocol _AttributeBody {
static func _destroySelf(_ value: Swift.UnsafeMutableRawPointer)
static var _hasDestroySelf: Swift.Bool { get }
static func _updateDefault(_ value: Swift.UnsafeMutableRawPointer)
static var comparisonMode: AGComparisonMode { get }
}
extension AttributeGraph._AttributeBody {
public static func _destroySelf(_ value: Swift.UnsafeMutableRawPointer)
public static var _hasDestroySelf: Swift.Bool {
get
}
public static func _updateDefault(_ value: Swift.UnsafeMutableRawPointer)
public static var comparisonMode: AGComparisonMode { get }
}
public protocol Rule : AttributeGraph._AttributeBody {
associatedtype Value
static var initialValue: Self.Value? { get }
var value: Self.Value { get }
}
extension AttributeGraph.Rule {
public static var initialValue: Self.Value? {
get
}
}
public func compareValues<A>(_ lhs: A, _ rhs: A, mode: AGComparisonMode = ._3) -> Swift.Bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
// swift-module-flags: -target x86_64-apple-macos12.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name AttributeGraph
// swift-module-flags-ignorable: -enable-bare-slash-regex
@_exported import AttributeGraph
import Foundation
import Swift
import _Concurrency
import _StringProcessing
@frozen @propertyWrapper @dynamicMemberLookup public struct Attribute<Value> : Swift.Hashable, Swift.Equatable, Swift.CustomStringConvertible {
public var identifier: AttributeGraph.AGAttribute
public var wrappedValue: Value {
get
set
}

@inlinable public init(identifier: AttributeGraph.AGAttribute) {
self.identifier = identifier
}

@inlinable public init(_ attribute: AttributeGraph.Attribute<Value>) {
self = attribute
}

public subscript<Member>(dynamicMember keyPath: Swift.KeyPath<Value, Member>) -> AttributeGraph.Attribute<Member> {
get
}

public subscript<Member>(keyPath: Swift.KeyPath<Value, Member>) -> AttributeGraph.Attribute<Member> {
get
}

public var description: Swift.String {
get
}
public static func == (lhs: AttributeGraph.Attribute<Value>, rhs: AttributeGraph.Attribute<Value>) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public protocol _AttributeBody {
static func _destroySelf(_ value: Swift.UnsafeMutableRawPointer)
static var _hasDestroySelf: Swift.Bool { get }
static func _updateDefault(_ value: Swift.UnsafeMutableRawPointer)
static var comparisonMode: AGComparisonMode { get }
}
extension AttributeGraph._AttributeBody {
public static func _destroySelf(_ value: Swift.UnsafeMutableRawPointer)
public static var _hasDestroySelf: Swift.Bool {
get
}
public static func _updateDefault(_ value: Swift.UnsafeMutableRawPointer)
public static var comparisonMode: AGComparisonMode { get }
}
public protocol Rule : AttributeGraph._AttributeBody {
associatedtype Value
static var initialValue: Self.Value? { get }
var value: Self.Value { get }
}
extension AttributeGraph.Rule {
public static var initialValue: Self.Value? {
get
}
}
public func compareValues<A>(_ lhs: A, _ rhs: A, mode: AGComparisonMode = ._3) -> Swift.Bool

This file was deleted.

Binary file not shown.
12 changes: 12 additions & 0 deletions Sources/OpenGraphCompatibility/GraphShims.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// GraphShims.swift
//
//
// Created by Kyle on 2023/12/21.
//

#if OPENGRAPH_COMPATIBILITY_TEST
@_exported import AttributeGraph
#else
@_exported import OpenGraph
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AGCompareValuesTests.swift
// OGCompareValuesTests.swift
//
//
// Created by Kyle on 2023/12/20.
Expand All @@ -12,7 +12,7 @@ import AttributeGraph
import OpenGraph
#endif

final class AGCompareValuesTests: XCTestCase {
final class OGCompareValuesTests: XCTestCase {
override func setUp() async throws {
#if !OPENGRAPH_COMPATIBILITY_TEST
throw XCTSkip("OG implementation for compareValues is not ready")
Expand Down
5 changes: 5 additions & 0 deletions Tests/OpenGraphCompatibilityTests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Test public API of OpenGraph and run it against with AttributeGraph on Apple Platform.

The current supported OS
- macOS 13 (CI Supported)
- macOS 14 (GitHub Runner not ready)
- iOS 15 ~ 17 on Simulator (CI is not supported)

```swift
#if OPENGRAPH_COMPATIBILITY_TEST
import AttributeGraph
Expand Down

0 comments on commit a5b0df5

Please sign in to comment.