From 3dc79409b9fbf9802ed3c21e7d9874764ea17389 Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:36:11 +0100 Subject: [PATCH 1/7] Upgrade to Swift 6.1: Update tools version, CI matrix, and fix unsafe pointer usage --- .github/workflows/ci.yaml | 4 +++- .gitignore | 2 ++ Package.swift | 2 +- Sources/NdArray/NdArray.swift | 12 ++++++++++-- Sources/NdArray/matrix/Matrix.swift | 6 +++++- Tests/NdArrayTests/test_support.swift | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99c78ec..eee89ec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,9 @@ jobs: strategy: matrix: swift-version: - - "5.9" + - "6.0" + - "6.1" + - "6.2" runs-on: macos-latest steps: - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index d21d9e8..23f8975 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ DerivedData/ **.log **.bak + +.DS_Store diff --git a/Package.swift b/Package.swift index 4f51e85..a2a3ae3 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.4 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Sources/NdArray/NdArray.swift b/Sources/NdArray/NdArray.swift index 397d5c4..965754f 100644 --- a/Sources/NdArray/NdArray.swift +++ b/Sources/NdArray/NdArray.swift @@ -186,7 +186,11 @@ open class NdArray: CustomDebugStringConvertible, for i in 0...stride) + row.withUnsafeBufferPointer { p in + if let base = p.baseAddress { + memcpy(dataStart + i * strides[0], base, colCount * MemoryLayout.stride) + } + } } case .F: for i in 0..: CustomDebugStringConvertible, for j in 0...stride) + aij.withUnsafeBufferPointer { p in + if let base = p.baseAddress { + memcpy(dataStart + i * strides[0] + j * strides[1], base, kCount * MemoryLayout.stride) + } + } } } case .F: diff --git a/Sources/NdArray/matrix/Matrix.swift b/Sources/NdArray/matrix/Matrix.swift index d1c4612..f49d857 100644 --- a/Sources/NdArray/matrix/Matrix.swift +++ b/Sources/NdArray/matrix/Matrix.swift @@ -33,7 +33,11 @@ open class Matrix: NdArray, Sequence { for i in 0...stride) + row.withUnsafeBufferPointer { p in + if let base = p.baseAddress { + memcpy(dataStart + i * strides[0], base, colCount * MemoryLayout.stride) + } + } } case .F: for i in 0..(_ expression1: @autoclosure () throws -> [T], _ expression2: @autoclosure () throws -> [T], accuracy: T, _ message: @autoclosure () -> String = "", - file: StaticString = #file, line: UInt = #line) rethrows where T: FloatingPoint { + file: StaticString = #filePath, line: UInt = #line) rethrows where T: FloatingPoint { let array1: [T] = try expression1() let array2: [T] = try expression2() XCTAssertEqual(array1.count, array2.count, file: file, line: line) From 8c99270e9720f6adaab3f03aca639af3546476f1 Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:39:43 +0100 Subject: [PATCH 2/7] Update Swift version badge in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f659fa3..b4c7f58 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NdArray -[![Swift Version](https://img.shields.io/badge/swift-5.9-blue.svg)](https://swift.org) +[![Swift Version](https://img.shields.io/badge/swift-6.2-blue.svg)](https://swift.org) ![Platform](https://img.shields.io/badge/platform-macOS|iOS|tvOS|whatchOS-lightgray.svg) ![Build](https://github.com/dastrobu/NdArray/actions/workflows/ci.yaml/badge.svg) @@ -711,4 +711,4 @@ Some features would be nice to have at some time but currently out of scope. ## Docs -Read the generated [docs](https://dastrobu.github.io/NdArray/documentation/ndarray). \ No newline at end of file +Read the generated [docs](https://dastrobu.github.io/NdArray/documentation/ndarray). From 382a8bc86ae819ece0e8261ec943879ebde7c68e Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:42:29 +0100 Subject: [PATCH 3/7] Remove obsolete XCTestManifests.swift --- Tests/NdArrayTests/XCTestManifests.swift | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 Tests/NdArrayTests/XCTestManifests.swift diff --git a/Tests/NdArrayTests/XCTestManifests.swift b/Tests/NdArrayTests/XCTestManifests.swift deleted file mode 100644 index c583586..0000000 --- a/Tests/NdArrayTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) -public func allTests() -> [XCTestCaseEntry] { - [ - testCase(NdArrayTests.allTests), - ] -} -#endif From b7ce845b25a5009d6c0502b88ddeaaf0f7252a6f Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:45:16 +0100 Subject: [PATCH 4/7] Update swift-actions/setup-swift to v3 --- .github/workflows/ci.yaml | 2 +- .github/workflows/docc.yaml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eee89ec..86ac6d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,7 +20,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: swift-actions/setup-swift@v1 + - uses: swift-actions/setup-swift@v3 with: swift-version: ${{ matrix.swift-version }} - run: swift test diff --git a/.github/workflows/docc.yaml b/.github/workflows/docc.yaml index 82a0801..6e31326 100644 --- a/.github/workflows/docc.yaml +++ b/.github/workflows/docc.yaml @@ -10,18 +10,18 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: swift-actions/setup-swift@v1 + - uses: swift-actions/setup-swift@v3 with: swift-version: "5.9" - name: generate-documentation # https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/generating-documentation-for-hosting-online/ run: > - swift package - --allow-writing-to-directory ./docs - generate-documentation - --output-path ./docs - --hosting-base-path NdArray - --disable-indexing + swift package + --allow-writing-to-directory ./docs + generate-documentation + --output-path ./docs + --hosting-base-path NdArray + --disable-indexing --transform-for-static-hosting - name: generate theme-settings.json run: echo '' > theme-settings.json From 84916af33e8ab9f00a6ff25427687a286215215b Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:50:28 +0100 Subject: [PATCH 5/7] Update GitHub Actions checkout action to v6 This update ensures that the CI and documentation generation workflows are using the latest stable version of the `actions/checkout` action. --- .github/workflows/ci.yaml | 10 +++++----- .github/workflows/docc.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86ac6d7..516838f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,7 +6,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: norio-nomura/action-swiftlint@3.2.1 with: args: --strict @@ -19,7 +19,7 @@ jobs: - "6.2" runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: swift-actions/setup-swift@v3 with: swift-version: ${{ matrix.swift-version }} @@ -27,15 +27,15 @@ jobs: iOS-build: runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - run: xcodebuild -scheme NdArray -destination 'platform=iOS Simulator,name=iPhone 13' tvOS-build: runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - run: xcodebuild -scheme NdArray -destination 'platform=tvOS Simulator,name=Apple TV' whatchOS-build: runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - run: xcodebuild -scheme NdArray -destination 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)' diff --git a/.github/workflows/docc.yaml b/.github/workflows/docc.yaml index 6e31326..6607c6b 100644 --- a/.github/workflows/docc.yaml +++ b/.github/workflows/docc.yaml @@ -9,7 +9,7 @@ jobs: generate-docs: runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: swift-actions/setup-swift@v3 with: swift-version: "5.9" From 22987d904ecb10b0c6a89b2b488b082482a3a2b2 Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:55:07 +0100 Subject: [PATCH 6/7] Update CI to use newer simulators and Swift versions Remove Swift 6.0 from CI matrix. Update iOS and watchOS simulator names to reflect newer hardware versions. --- .github/workflows/ci.yaml | 5 ++--- .github/workflows/docc.yaml | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 516838f..71ef29e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,6 @@ jobs: strategy: matrix: swift-version: - - "6.0" - "6.1" - "6.2" runs-on: macos-latest @@ -28,7 +27,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v6 - - run: xcodebuild -scheme NdArray -destination 'platform=iOS Simulator,name=iPhone 13' + - run: xcodebuild -scheme NdArray -destination 'platform=iOS Simulator,name=iPhone 16' tvOS-build: runs-on: macos-latest steps: @@ -38,4 +37,4 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v6 - - run: xcodebuild -scheme NdArray -destination 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)' + - run: xcodebuild -scheme NdArray -destination 'platform=watchOS Simulator,name=Apple Watch Series 11 (46mm)' diff --git a/.github/workflows/docc.yaml b/.github/workflows/docc.yaml index 6607c6b..68fa159 100644 --- a/.github/workflows/docc.yaml +++ b/.github/workflows/docc.yaml @@ -13,6 +13,7 @@ jobs: - uses: swift-actions/setup-swift@v3 with: swift-version: "5.9" + - name: generate-documentation # https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/generating-documentation-for-hosting-online/ run: > From 411ab24c1a69a490eeb8741fd173a901559e2634 Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Sat, 10 Jan 2026 00:03:20 +0100 Subject: [PATCH 7/7] Simplify Package.swift dependencies --- Package.swift | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Package.swift b/Package.swift index a2a3ae3..2f2c329 100644 --- a/Package.swift +++ b/Package.swift @@ -11,16 +11,10 @@ let package = Package( name: "NdArray", targets: ["NdArray"]), ], - dependencies: { + dependencies: [ // https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/ - var deps: [PackageDescription.Package.Dependency] = [] - #if swift(>=5.6.0) - deps.append( - .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0") - ) - #endif - return deps - }(), + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.5"), + ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on.