From c64ad0839f863544b185a65565bddf7ab1b79cbe Mon Sep 17 00:00:00 2001 From: Justin Bergen Date: Sat, 27 Jun 2026 16:40:20 -0600 Subject: [PATCH 1/4] CI: Build DocC catalog on every PR (#22) Add a partial GitHub Actions workflow with a DocC generation job that runs on every PR and push to master. The check fails on documentation warnings and uploads the rendered archive as a PR artifact. Closes #22 --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..92c5746 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + push: + branches: [master] + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + docc: + name: DocC catalog + runs-on: macos-15 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + + - name: Select Xcode + run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + + - name: Verify Swift version + run: swift --version + + - name: Build DocC catalog + run: swift package generate-documentation --target ReliaBLE --warnings-as-errors + + - name: Upload DocC archive + uses: actions/upload-artifact@v4 + with: + name: ReliaBLE.doccarchive + path: .build/plugins/Swift-DocC/outputs/ReliaBLE.doccarchive + if-no-files-found: error \ No newline at end of file From 2791b3bfdf355b85e1a34899f81b87cac6b1fc2d Mon Sep 17 00:00:00 2001 From: Justin Bergen Date: Sat, 27 Jun 2026 16:41:44 -0600 Subject: [PATCH 2/4] Fix broken DocC link to internal PeripheralManager (#22) The public Peripheral initializer doc comment referenced the internal PeripheralManager type, causing generate-documentation to fail. Replace the symbol link with plain prose so the new CI DocC check passes. --- Sources/ReliaBLE/Models/Peripheral.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ReliaBLE/Models/Peripheral.swift b/Sources/ReliaBLE/Models/Peripheral.swift index 650a5c7..1b3d216 100644 --- a/Sources/ReliaBLE/Models/Peripheral.swift +++ b/Sources/ReliaBLE/Models/Peripheral.swift @@ -68,7 +68,7 @@ public class Peripheral: Identifiable, Hashable { /// Create a peripheral with a unique identifier and optional CoreBluetooth peripheral data. The integrating app /// should use this initializer to create a `Peripheral` instance when it has a unique identifier for a peripheral - /// but has not yet discovered the peripheral with CoreBluetooth. The ``PeripheralManager`` will update the instance + /// but has not yet discovered the peripheral with CoreBluetooth. ReliaBLE will update the instance /// with CoreBluetooth data when the peripheral is discovered. /// - Parameters: /// - id: Unique identifier for the peripheral as set by the integrating app. From 34841193b68699dde88ac53d3769c7116d2a060e Mon Sep 17 00:00:00 2001 From: Justin Bergen Date: Sat, 27 Jun 2026 16:43:32 -0600 Subject: [PATCH 3/4] Zip DocC archive before artifact upload (#22) DocC output includes filenames with colons (e.g. operator docs) that upload-artifact rejects on NTFS-safe paths. Zip the .doccarchive bundle before uploading so PR reviewers can still download a preview. --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92c5746..2b1cfe5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,12 @@ jobs: - name: Build DocC catalog run: swift package generate-documentation --target ReliaBLE --warnings-as-errors + - name: Archive DocC output + run: ditto -c -k --sequesterRsrc --keepParent .build/plugins/Swift-DocC/outputs/ReliaBLE.doccarchive ReliaBLE.doccarchive.zip + - name: Upload DocC archive uses: actions/upload-artifact@v4 with: name: ReliaBLE.doccarchive - path: .build/plugins/Swift-DocC/outputs/ReliaBLE.doccarchive + path: ReliaBLE.doccarchive.zip if-no-files-found: error \ No newline at end of file From 7a7e60eec1ba05ec46ccdbaa1846b49466c06066 Mon Sep 17 00:00:00 2001 From: Justin Bergen Date: Sat, 27 Jun 2026 16:54:15 -0600 Subject: [PATCH 4/4] Address Copilot PR review feedback (#22) - Correct Peripheral init docs to point at discoveredPeripherals publisher - Write DocC output to ./docc-output via --output-path instead of .build plugin path - Add Xcode 16.4 existence check with installed-version diagnostics - Ignore docc-output/ build directory --- .github/workflows/ci.yml | 19 ++++++++++++++----- .gitignore | 1 + Sources/ReliaBLE/Models/Peripheral.swift | 8 ++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b1cfe5..50234c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,20 +18,29 @@ jobs: - uses: actions/checkout@v4 - name: Select Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + run: | + if [ ! -d /Applications/Xcode_16.4.app ]; then + echo "Xcode 16.4 not found. Installed Xcode versions:" + ls /Applications | grep Xcode || true + exit 1 + fi + sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - name: Verify Swift version run: swift --version - name: Build DocC catalog - run: swift package generate-documentation --target ReliaBLE --warnings-as-errors + run: | + swift package --allow-writing-to-directory ./docc-output \ + generate-documentation --target ReliaBLE --warnings-as-errors \ + --output-path ./docc-output - name: Archive DocC output - run: ditto -c -k --sequesterRsrc --keepParent .build/plugins/Swift-DocC/outputs/ReliaBLE.doccarchive ReliaBLE.doccarchive.zip + run: ditto -c -k --sequesterRsrc --keepParent docc-output ReliaBLE-docs.zip - name: Upload DocC archive uses: actions/upload-artifact@v4 with: - name: ReliaBLE.doccarchive - path: ReliaBLE.doccarchive.zip + name: ReliaBLE-docs + path: ReliaBLE-docs.zip if-no-files-found: error \ No newline at end of file diff --git a/.gitignore b/.gitignore index acd741b..70a8d53 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ Packages/ .swiftpm .build/ +docc-output/ DerivedData/ # CocoaPods diff --git a/Sources/ReliaBLE/Models/Peripheral.swift b/Sources/ReliaBLE/Models/Peripheral.swift index 1b3d216..ede255d 100644 --- a/Sources/ReliaBLE/Models/Peripheral.swift +++ b/Sources/ReliaBLE/Models/Peripheral.swift @@ -66,10 +66,10 @@ public class Peripheral: Identifiable, Hashable { /// The timestamp when the peripheral was last seen public internal(set) var lastSeen: Date? - /// Create a peripheral with a unique identifier and optional CoreBluetooth peripheral data. The integrating app - /// should use this initializer to create a `Peripheral` instance when it has a unique identifier for a peripheral - /// but has not yet discovered the peripheral with CoreBluetooth. ReliaBLE will update the instance - /// with CoreBluetooth data when the peripheral is discovered. + /// Creates a peripheral with a unique identifier and optional CoreBluetooth discovery data. + /// + /// Prefer observing ``ReliaBLEManager/discoveredPeripherals`` for devices discovered during scanning. + /// ReliaBLE updates only the ``Peripheral`` instances it manages internally and emits through that publisher. /// - Parameters: /// - id: Unique identifier for the peripheral as set by the integrating app. /// - peripheral: Reference to the CoreBluetooth `CBPeripheral` object