1
1
mirror of https://github.com/kean/Nuke.git synced 2024-11-28 12:04:01 +03:00

Compare commits

...

7 Commits

Author SHA1 Message Date
kean
4878846229 Remove @unchecked from ImagePipeline.Error Sendable conformance 2024-10-27 12:23:37 -04:00
kean
de39ec1f0d Increase deployment targets 2024-10-27 12:20:08 -04:00
kean
a4413f67dd Bump macOS deployment target to macOS 11 2024-10-27 12:15:47 -04:00
kean
9c025c6090 Update performance tests 2024-10-27 12:04:53 -04:00
kean
072f73277a Update ci.yml 2024-10-27 11:37:12 -04:00
kean
81e8412feb ImageRequest.Container is no longer Sendable 2024-10-27 10:55:35 -04:00
kean
b6209897cf Update how withLock is used 2024-10-27 10:51:54 -04:00
6 changed files with 50 additions and 47 deletions

View File

@ -10,22 +10,22 @@ on:
jobs: jobs:
ios-latest: ios-latest:
name: Unit Tests (iOS 17.4, Xcode 15.3) name: Unit Tests (iOS 18.0, Xcode 16.0)
runs-on: macOS-14 runs-on: macOS-15
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run Tests - name: Run Tests
run: | run: |
.scripts/test.sh -s "Nuke" -d "OS=17.4,name=iPhone 15 Pro" .scripts/test.sh -s "Nuke" -d "OS=18.0,name=iPhone 16 Pro"
.scripts/test.sh -s "NukeUI" -d "OS=17.4,name=iPhone 15 Pro" .scripts/test.sh -s "NukeUI" -d "OS=18.0,name=iPhone 16 Pro"
.scripts/test.sh -s "NukeExtensions" -d "OS=17.4,name=iPhone 15 Pro" .scripts/test.sh -s "NukeExtensions" -d "OS=18.0,name=iPhone 16 Pro"
macos-latest: macos-latest:
name: Unit Tests (macOS, Xcode 15.3) name: Unit Tests (macOS, Xcode 16.0)
runs-on: macOS-14 runs-on: macOS-15
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run Tests - name: Run Tests
@ -34,17 +34,17 @@ jobs:
.scripts/test.sh -s "NukeUI" -d "platform=macOS" .scripts/test.sh -s "NukeUI" -d "platform=macOS"
.scripts/test.sh -s "NukeExtensions" -d "platform=macOS" .scripts/test.sh -s "NukeExtensions" -d "platform=macOS"
tvos-latest: tvos-latest:
name: Unit Tests (tvOS 17.4, Xcode 15.3) name: Unit Tests (tvOS 18.0, Xcode 16.0)
runs-on: macOS-14 runs-on: macOS-15
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run Tests - name: Run Tests
run: | run: |
.scripts/test.sh -s "Nuke" -d "OS=17.4,name=Apple TV" .scripts/test.sh -s "Nuke" -d "OS=18.0,name=Apple TV"
.scripts/test.sh -s "NukeUI" -d "OS=17.4,name=Apple TV" .scripts/test.sh -s "NukeUI" -d "OS=18.0,name=Apple TV"
.scripts/test.sh -s "NukeExtensions" -d "OS=17.4,name=Apple TV" .scripts/test.sh -s "NukeExtensions" -d "OS=18.0,name=Apple TV"
# There is a problem with watchOS runners where they often fail to launch on CI # There is a problem with watchOS runners where they often fail to launch on CI
# #
# watchos-latest: # watchos-latest:
@ -59,27 +59,30 @@ jobs:
# .scripts/test.sh -s "Nuke" -d "OS=9.1,name=Apple Watch Series 8 (45mm)" # .scripts/test.sh -s "Nuke" -d "OS=9.1,name=Apple Watch Series 8 (45mm)"
# .scripts/test.sh -s "NukeUI" -d "OS=9.1,name=Apple Watch Series 8 (45mm)" # .scripts/test.sh -s "NukeUI" -d "OS=9.1,name=Apple Watch Series 8 (45mm)"
# .scripts/test.sh -s "Nuke Extensions" -d "OS=9.1,name=Apple Watch Series 8 (45mm)" # .scripts/test.sh -s "Nuke Extensions" -d "OS=9.1,name=Apple Watch Series 8 (45mm)"
ios-xcode-14-3-1:
name: Unit Tests (iOS 17.0, Xcode 15.0) # Nuke 13.0 supports only the latest version of Xcode (16).
runs-on: macOS-13 #
env: # ios-xcode-14-3-1:
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer # name: Unit Tests (iOS 17.0, Xcode 15.0)
steps: # runs-on: macOS-13
- uses: actions/checkout@v2 # env:
- name: Run Tests # DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
run: | # steps:
.scripts/test.sh -s "Nuke" -d "OS=17.0,name=iPhone 15 Pro" # - uses: actions/checkout@v2
.scripts/test.sh -s "NukeUI" -d "OS=17.0,name=iPhone 15 Pro" # - name: Run Tests
.scripts/test.sh -s "NukeExtensions" -d "OS=17.0,name=iPhone 15 Pro" # run: |
# .scripts/test.sh -s "Nuke" -d "OS=17.0,name=iPhone 15 Pro"
# .scripts/test.sh -s "NukeUI" -d "OS=17.0,name=iPhone 15 Pro"
# .scripts/test.sh -s "NukeExtensions" -d "OS=17.0,name=iPhone 15 Pro"
ios-thread-safety: ios-thread-safety:
name: Thread Safety Tests (TSan Enabled) name: Thread Safety Tests (TSan Enabled)
runs-on: macOS-14 runs-on: macOS-15
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run Tests - name: Run Tests
run: .scripts/test.sh -s "Nuke Thread Safety Tests" -d "OS=17.4,name=iPhone 15 Pro" run: .scripts/test.sh -s "Nuke Thread Safety Tests" -d "OS=18.0,name=iPhone 16 Pro"
# ios-memory-management-tests: # ios-memory-management-tests:
# name: Memory Management Tests # name: Memory Management Tests
# runs-on: macOS-13 # runs-on: macOS-13
@ -91,18 +94,18 @@ jobs:
# run: .scripts/test.sh -s "Nuke Memory Management Tests" -d "OS=14.4,name=iPhone 12 Pro" # run: .scripts/test.sh -s "Nuke Memory Management Tests" -d "OS=14.4,name=iPhone 12 Pro"
ios-performance-tests: ios-performance-tests:
name: Performance Tests name: Performance Tests
runs-on: macOS-14 runs-on: macOS-15
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run Tests - name: Run Tests
run: .scripts/test.sh -s "Nuke Performance Tests" -d "OS=17.4,name=iPhone 15 Pro" run: .scripts/test.sh -s "Nuke Performance Tests" -d "OS=18.0,name=iPhone 16 Pro"
swift-build: swift-build:
name: Swift Build (SPM) name: Swift Build (SPM)
runs-on: macOS-14 runs-on: macOS-15
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build - name: Build

View File

@ -1,13 +1,13 @@
// swift-tools-version:5.9 // swift-tools-version:6.0
import PackageDescription import PackageDescription
let package = Package( let package = Package(
name: "Nuke", name: "Nuke",
platforms: [ platforms: [
.iOS(.v13), .iOS(.v14),
.tvOS(.v13), .tvOS(.v14),
.macOS(.v10_15), .macOS(.v11),
.watchOS(.v6), .watchOS(.v7),
.visionOS(.v1), .visionOS(.v1),
], ],
products: [ products: [

View File

@ -28,7 +28,7 @@ import AppKit
/// ) /// )
/// let image = try await pipeline.image(for: request) /// let image = try await pipeline.image(for: request)
/// ``` /// ```
public struct ImageRequest: CustomStringConvertible, Sendable, ExpressibleByStringLiteral { public struct ImageRequest: CustomStringConvertible, @unchecked Sendable, ExpressibleByStringLiteral {
// MARK: Options // MARK: Options
/// The relative priority of the request. The priority affects the order in /// The relative priority of the request. The priority affects the order in
@ -437,7 +437,7 @@ public struct ImageRequest: CustomStringConvertible, Sendable, ExpressibleByStri
extension ImageRequest { extension ImageRequest {
/// Just like many Swift built-in types, ``ImageRequest`` uses CoW approach to /// Just like many Swift built-in types, ``ImageRequest`` uses CoW approach to
/// avoid memberwise retain/releases when ``ImageRequest`` is passed around. /// avoid memberwise retain/releases when ``ImageRequest`` is passed around.
private final class Container: @unchecked Sendable { private final class Container {
// It's beneficial to put resource before priority and options because // It's beneficial to put resource before priority and options because
// of the resource size/stride of 9/16. Priority (1 byte) and Options // of the resource size/stride of 9/16. Priority (1 byte) and Options
// (2 bytes) slot just right in the remaining space. // (2 bytes) slot just right in the remaining space.

View File

@ -30,14 +30,14 @@ public final class ImageTask: Hashable {
/// The priority of the task. The priority can be updated dynamically even /// The priority of the task. The priority can be updated dynamically even
/// for a task that is already running. /// for a task that is already running.
public nonisolated var priority: ImageRequest.Priority { public nonisolated var priority: ImageRequest.Priority {
get { nonisolatedState.withLock { $0.priority } } get { nonisolatedState.withLock(\.priority) }
set { setPriority(newValue) } set { setPriority(newValue) }
} }
/// Returns the current download progress. Returns zeros before the download /// Returns the current download progress. Returns zeros before the download
/// is started and the expected size of the resource is known. /// is started and the expected size of the resource is known.
public nonisolated var currentProgress: Progress { public nonisolated var currentProgress: Progress {
nonisolatedState.withLock { $0.progress } nonisolatedState.withLock(\.progress)
} }
/// The download progress. /// The download progress.
@ -74,7 +74,7 @@ public final class ImageTask: Hashable {
/// Returns `true` if the task cancellation is initiated. /// Returns `true` if the task cancellation is initiated.
public nonisolated var isCancelling: Bool { public nonisolated var isCancelling: Bool {
nonisolatedState.withLock { $0.isCancelling } nonisolatedState.withLock(\.isCancelling)
} }
// MARK: - Async/Await // MARK: - Async/Await

View File

@ -6,7 +6,7 @@ import Foundation
extension ImagePipeline { extension ImagePipeline {
/// Represents all possible image pipeline errors. /// Represents all possible image pipeline errors.
public enum Error: Swift.Error, CustomStringConvertible, @unchecked Sendable { public enum Error: Swift.Error, CustomStringConvertible, Sendable {
/// Returned if data not cached and ``ImageRequest/Options-swift.struct/returnCacheDataDontLoad`` option is specified. /// Returned if data not cached and ``ImageRequest/Options-swift.struct/returnCacheDataDontLoad`` option is specified.
case dataMissingInCache case dataMissingInCache
/// Data loader failed to load image data with a wrapped error. /// Data loader failed to load image data with a wrapped error.

View File

@ -18,7 +18,7 @@ class ImagePipelinePerfomanceTests: XCTestCase {
var finished: Int = 0 var finished: Int = 0
let semaphore = DispatchSemaphore(value: 0) let semaphore = DispatchSemaphore(value: 0)
for request in requests { for request in requests {
pipeline.loadImage(with: request, queue: callbackQueue, progress: nil) { _ in pipeline.loadImage(with: request, progress: nil) { _ in
finished += 1 finished += 1
if finished == requests.count { if finished == requests.count {
semaphore.signal() semaphore.signal()