Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Jun 14, 2024
1 parent cc86299 commit c0021e5
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 16 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ on:

jobs:
build:
name: MacOS
runs-on: macos-13
name: macOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Select Xcode 15.2
run: sudo xcode-select -s /Applications/Xcode_15.2.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: make test-swift

ubuntu:
strategy:
matrix:
swift:
- '5.9'
- '5.10'
name: Ubuntu (Swift ${{ matrix.swift }})
runs-on: ubuntu-latest
container: swift:${{ matrix.swift }}
Expand All @@ -35,7 +35,7 @@ jobs:
run: swift test -c release --parallel

windows:
name: Windows (Swift ${{ matrix.swfit }}, ${{ matrix.config }})
name: Windows (Swift ${{ matrix.swift }}, ${{ matrix.config }})
strategy:
matrix:
os: [windows-latest]
Expand All @@ -45,8 +45,8 @@ jobs:
steps:
- uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.9.1-release
tag: 5.9.1-RELEASE
branch: swift-5.10-release
tag: 5.10-RELEASE
- uses: actions/checkout@v4
- name: Build
run: swift build -c ${{ matrix.config }}
Expand Down
9 changes: 8 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version: 5.9

import PackageDescription

Expand Down Expand Up @@ -35,6 +35,13 @@ let package = Package(
]
)

for target in package.targets {
target.swiftSettings = target.swiftSettings ?? []
target.swiftSettings!.append(contentsOf: [
.enableExperimentalFeature("StrictConcurrency")
])
}

#if !os(Windows)
// DocC needs to be ported to Windows
// https://github.com/thebrowsercompany/swift-build/issues/39
Expand Down
45 changes: 45 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// swift-tools-version: 6.0

import PackageDescription

let package = Package(
name: "swift-identified-collections",
products: [
.library(
name: "IdentifiedCollections",
targets: ["IdentifiedCollections"]
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-collections", from: "1.0.2"),
.package(url: "https://github.com/apple/swift-collections-benchmark", from: "0.0.2"),
],
targets: [
.target(
name: "IdentifiedCollections",
dependencies: [
.product(name: "OrderedCollections", package: "swift-collections")
]
),
.testTarget(
name: "IdentifiedCollectionsTests",
dependencies: ["IdentifiedCollections"]
),
.executableTarget(
name: "swift-identified-collections-benchmark",
dependencies: [
"IdentifiedCollections",
.product(name: "CollectionsBenchmark", package: "swift-collections-benchmark"),
]
),
],
swiftLanguageVersions: [.v6]
)

#if !os(Windows)
// DocC needs to be ported to Windows
// https://github.com/thebrowsercompany/swift-build/issues/39
package.dependencies.append(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
)
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#if swift(>=5.5)
extension IdentifiedArray: @unchecked Sendable
where ID: Sendable, Element: Sendable {}
#endif
extension IdentifiedArray: @unchecked Sendable
where ID: Sendable, Element: Sendable {}
9 changes: 7 additions & 2 deletions Sources/swift-identified-collections-benchmark/main.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import CollectionsBenchmark
import IdentifiedCollections

@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
extension Int: Identifiable { public var id: Self { self } }
#if $RetroactiveAttribute
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
extension Int: @retroactive Identifiable { public var id: Self { self } }
#else
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
extension Int: Identifiable { public var id: Self { self } }
#endif

if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
var benchmark = Benchmark(title: "Identified Collections Benchmark")
Expand Down
6 changes: 5 additions & 1 deletion Tests/IdentifiedCollectionsTests/IdentifiedArrayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import XCTest

@testable import IdentifiedCollections

extension Int: Identifiable { public var id: Self { self } }
#if $RetroactiveAttribute
extension Int: @retroactive Identifiable { public var id: Self { self } }
#else
extension Int: Identifiable { public var id: Self { self } }
#endif

private struct User: Equatable, Identifiable {
let id: Int
Expand Down

0 comments on commit c0021e5

Please sign in to comment.