From 6687b2131a87a2765e95486efd5c17462265a92a Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:11:39 +0100 Subject: [PATCH 01/26] Fix existential warning --- .../Presentation/Backup/BackupImportFlowViewModel.swift | 4 ++-- .../Presentation/Backup/BackupKeyDecryptorViewModel.swift | 2 +- .../Presentation/Detail/EncryptedItemDetailViewModel.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Vault/Sources/VaultFeed/Presentation/Backup/BackupImportFlowViewModel.swift b/Vault/Sources/VaultFeed/Presentation/Backup/BackupImportFlowViewModel.swift index 060912ad9..ceb4b2ef0 100644 --- a/Vault/Sources/VaultFeed/Presentation/Backup/BackupImportFlowViewModel.swift +++ b/Vault/Sources/VaultFeed/Presentation/Backup/BackupImportFlowViewModel.swift @@ -105,7 +105,7 @@ public final class BackupImportFlowViewModel { case let .readyToImport(applicationPayload): payloadState = .ready(applicationPayload, UUID()) } - } catch let error as LocalizedError { + } catch let error as any LocalizedError { payloadState = .error(.init(localizedError: error)) } catch { payloadState = .error(PresentationError( @@ -140,7 +140,7 @@ public final class BackupImportFlowViewModel { try await dataModel.importOverride(payload: payload) } importState = .success - } catch let error as LocalizedError { + } catch let error as any LocalizedError { importState = .error(.init(localizedError: error)) } catch { importState = .error(PresentationError( diff --git a/Vault/Sources/VaultFeed/Presentation/Backup/BackupKeyDecryptorViewModel.swift b/Vault/Sources/VaultFeed/Presentation/Backup/BackupKeyDecryptorViewModel.swift index 347a3c866..b99ed0d17 100644 --- a/Vault/Sources/VaultFeed/Presentation/Backup/BackupKeyDecryptorViewModel.swift +++ b/Vault/Sources/VaultFeed/Presentation/Backup/BackupKeyDecryptorViewModel.swift @@ -91,7 +91,7 @@ public final class BackupKeyDecryptorViewModel { ) decryptionKeyState = .validDecryptionKey decryptedVaultSubject.send(vaultApplicationPayload) - } catch let error as LocalizedError { + } catch let error as any LocalizedError { decryptionKeyState = .error(.init(localizedError: error)) } catch { decryptionKeyState = .error(PresentationError( diff --git a/Vault/Sources/VaultFeed/Presentation/Detail/EncryptedItemDetailViewModel.swift b/Vault/Sources/VaultFeed/Presentation/Detail/EncryptedItemDetailViewModel.swift index fbb3a5430..3da23f946 100644 --- a/Vault/Sources/VaultFeed/Presentation/Detail/EncryptedItemDetailViewModel.swift +++ b/Vault/Sources/VaultFeed/Presentation/Detail/EncryptedItemDetailViewModel.swift @@ -81,7 +81,7 @@ public final class EncryptedItemDetailViewModel { case let .decrypted(item): state = .decrypted(item, generatedPassword) } - } catch let localized as LocalizedError { + } catch let localized as any LocalizedError { state = .decryptionError(PresentationError(localizedError: localized)) } catch { state = .decryptionError(PresentationError( From 4a8ffb9492c3df37c7515418dbda991bf27085af Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:15:58 +0100 Subject: [PATCH 02/26] Fix linter errors --- .../OTPCode/OTPCodeTimerUpdater.swift | 2 +- .../VaultFeed/Storage/VaultDataModel.swift | 2 +- .../SwiftData/PersistedLocalVaultStore.swift | 4 ++-- .../VaultKeygenSpeedtest/Speedtest.swift | 2 +- .../TimerBar/CodeTimerHorizontalBarView.swift | 22 +++++++++---------- .../VaultAutofillConfigurationView.swift | 4 ++-- .../DefaultsStoredTests.swift | 2 +- .../VaultCoreTests/OTPAuthDigitsTests.swift | 2 +- .../URI/OTPAuthURIEncoderTests.swift | 2 +- .../BackupImportScanningHandlerTests.swift | 2 +- 10 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Vault/Sources/VaultFeed/Presentation/OTPCode/OTPCodeTimerUpdater.swift b/Vault/Sources/VaultFeed/Presentation/OTPCode/OTPCodeTimerUpdater.swift index c566e432b..2d6daf757 100644 --- a/Vault/Sources/VaultFeed/Presentation/OTPCode/OTPCodeTimerUpdater.swift +++ b/Vault/Sources/VaultFeed/Presentation/OTPCode/OTPCodeTimerUpdater.swift @@ -14,7 +14,7 @@ public protocol OTPCodeTimerUpdater: AnyObject { /// Controller for producing timers for a given code, according to a clock. @MainActor -public final class OTPCodeTimerUpdaterImpl: OTPCodeTimerUpdater, Sendable { +public final class OTPCodeTimerUpdaterImpl: OTPCodeTimerUpdater { private let timerStateSubject: CurrentValueSubject private let period: UInt64 private let timerTask = SharedMutex?>(nil) diff --git a/Vault/Sources/VaultFeed/Storage/VaultDataModel.swift b/Vault/Sources/VaultFeed/Storage/VaultDataModel.swift index ac60b7866..9d0b3d8eb 100644 --- a/Vault/Sources/VaultFeed/Storage/VaultDataModel.swift +++ b/Vault/Sources/VaultFeed/Storage/VaultDataModel.swift @@ -12,7 +12,7 @@ import VaultKeygen /// This is isolated to the main actor for the purposes of UI interop. @MainActor @Observable -public final class VaultDataModel: Sendable { +public final class VaultDataModel { public enum State { case base, loaded, loading } diff --git a/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift b/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift index 1f3d7145f..960e6a316 100644 --- a/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift +++ b/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift @@ -73,9 +73,9 @@ extension PersistedLocalVaultStore: VaultStoreReader { let searchingTagIds = tags.map(\.id).reducedToSet() // Returns the number of tags matched by this item. let tagsMatchingSearch = #Expression { item in - item.tags.filter { tag in + item.tags.count(where: { tag in searchingTagIds.contains(tag.id) - }.count + }) } // Performs an "AND" query by checking if the number of tags matched equals // the number of tags we are searching for. diff --git a/Vault/Sources/VaultKeygenSpeedtest/Speedtest.swift b/Vault/Sources/VaultKeygenSpeedtest/Speedtest.swift index c3deb8b27..b044d2848 100644 --- a/Vault/Sources/VaultKeygenSpeedtest/Speedtest.swift +++ b/Vault/Sources/VaultKeygenSpeedtest/Speedtest.swift @@ -15,7 +15,7 @@ import VaultKeygen @main struct KeygenSpeedtest { - public static func main() throws { + static func main() throws { print("🚧 Build configuration:", buildConfigString()) try benchmark(keyDeriver: VaultKeyDeriver.Item.Fast.v1, description: "Item Fast") diff --git a/Vault/Sources/VaultiOS/Views/TimerBar/CodeTimerHorizontalBarView.swift b/Vault/Sources/VaultiOS/Views/TimerBar/CodeTimerHorizontalBarView.swift index 0ea13e2e7..b89241a16 100644 --- a/Vault/Sources/VaultiOS/Views/TimerBar/CodeTimerHorizontalBarView.swift +++ b/Vault/Sources/VaultiOS/Views/TimerBar/CodeTimerHorizontalBarView.swift @@ -49,21 +49,19 @@ struct CodeTimerHorizontalBarView: View { resetTimerBarAnimation = .init(qos: .userInteractive) { withAnimation( .linear(duration: animateReset ? 0.15 : 0), - completionCriteria: .removed, - { - currentFractionCompleted = timerState.animationState.initialFraction(currentTime: clock.currentTime) - }, - completion: { - if case let .animate(state) = timerState.animationState { - timerAnimation = .init(qos: .userInteractive) { - withAnimation(.linear(duration: state.remainingTime(at: clock.currentTime))) { - currentFractionCompleted = 0 - } + completionCriteria: .removed + ) { + currentFractionCompleted = timerState.animationState.initialFraction(currentTime: clock.currentTime) + } completion: { + if case let .animate(state) = timerState.animationState { + timerAnimation = .init(qos: .userInteractive) { + withAnimation(.linear(duration: state.remainingTime(at: clock.currentTime))) { + currentFractionCompleted = 0 } - timerAnimation?.perform() } + timerAnimation?.perform() } - ) + } } resetTimerBarAnimation?.perform() } diff --git a/Vault/Sources/VaultiOSAutofill/Views/VaultAutofillConfigurationView.swift b/Vault/Sources/VaultiOSAutofill/Views/VaultAutofillConfigurationView.swift index 09abad973..a8625f753 100644 --- a/Vault/Sources/VaultiOSAutofill/Views/VaultAutofillConfigurationView.swift +++ b/Vault/Sources/VaultiOSAutofill/Views/VaultAutofillConfigurationView.swift @@ -4,11 +4,11 @@ import VaultiOS struct VaultAutofillConfigurationView: View { @State private var viewModel: VaultAutofillConfigurationViewModel - public init(viewModel: VaultAutofillConfigurationViewModel) { + init(viewModel: VaultAutofillConfigurationViewModel) { self.viewModel = viewModel } - public var body: some View { + var body: some View { ScrollView { container .padding(.vertical, 16) diff --git a/Vault/Tests/FoundationExtensionsTests/DefaultsStoredTests.swift b/Vault/Tests/FoundationExtensionsTests/DefaultsStoredTests.swift index 24a31daff..4129a0305 100644 --- a/Vault/Tests/FoundationExtensionsTests/DefaultsStoredTests.swift +++ b/Vault/Tests/FoundationExtensionsTests/DefaultsStoredTests.swift @@ -33,7 +33,7 @@ final class DefaultsStoredTests { } @Test - func test_wrappedValue_setsValueInDefaults() throws { + func wrappedValue_setsValueInDefaults() throws { let key: Key = .init("test3") let coolNumberInitial = 4567 try defaults.set(coolNumberInitial, for: key) diff --git a/Vault/Tests/VaultCoreTests/OTPAuthDigitsTests.swift b/Vault/Tests/VaultCoreTests/OTPAuthDigitsTests.swift index 1bf20b527..6be417605 100644 --- a/Vault/Tests/VaultCoreTests/OTPAuthDigitsTests.swift +++ b/Vault/Tests/VaultCoreTests/OTPAuthDigitsTests.swift @@ -4,7 +4,7 @@ import VaultCore struct OTPAuthDigitsTests { @Test - func test_description_encodesToSimpleDigits() { + func description_encodesToSimpleDigits() { let digits = OTPAuthDigits(value: 123) #expect("\(digits)" == "123") diff --git a/Vault/Tests/VaultCoreTests/URI/OTPAuthURIEncoderTests.swift b/Vault/Tests/VaultCoreTests/URI/OTPAuthURIEncoderTests.swift index f9038578b..90a9cf2d8 100644 --- a/Vault/Tests/VaultCoreTests/URI/OTPAuthURIEncoderTests.swift +++ b/Vault/Tests/VaultCoreTests/URI/OTPAuthURIEncoderTests.swift @@ -6,7 +6,7 @@ struct OTPAuthURIEncoderTests { let sut = OTPAuthURIEncoder() @Test - func test_encodeScheme_isOtpauth() throws { + func encodeScheme_isOtpauth() throws { let code = makeCode(type: .totp()) let encoded = try sut.encode(code: code) diff --git a/Vault/Tests/VaultFeedTests/CodeScanner/BackupImportScanningHandlerTests.swift b/Vault/Tests/VaultFeedTests/CodeScanner/BackupImportScanningHandlerTests.swift index 008049bfc..db43fffa6 100644 --- a/Vault/Tests/VaultFeedTests/CodeScanner/BackupImportScanningHandlerTests.swift +++ b/Vault/Tests/VaultFeedTests/CodeScanner/BackupImportScanningHandlerTests.swift @@ -94,7 +94,7 @@ struct BackupImportScanningHandlerTests { } @Test - func test_decodeInvalidFullDataEndsWithUnrecoverableError() throws { + func decodeInvalidFullDataEndsWithUnrecoverableError() throws { let result1 = sut.decode(data: """ { "G":{"ID":10,"N":2,"I":0}, From fbc58e95967a2c1c5e586f8a715cfcb16118cb3d Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:21:13 +0100 Subject: [PATCH 03/26] Reenable CI --- .github/workflows/validate-all.yml | 53 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 26d409d86..1e83ef391 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -9,35 +9,36 @@ on: env: IOS_PLATFORM: iOS Simulator - IOS_DEVICE: iPhone 15 - IOS_VERSION: 17.4 + IOS_DEVICE: iPhone 17 Pro + IOS_VERSION: 26.0 + XCODE_VERSION: 26 jobs: - # TODO: enable when swiftlint supports a linux binary in its artifact bundle - # lint: - # name: Lint - # timeout-minutes: 2 - # runs-on: ubuntu-latest - # defaults: - # run: - # working-directory: ./Vault - # - # steps: - # - uses: actions/checkout@v4 - # - name: Lint Sources - # run: make lint + lint: + name: Lint + timeout-minutes: 2 + runs-on: macos-26 + defaults: + run: + working-directory: ./Vault + + steps: + - uses: actions/checkout@v4 + - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Lint Sources + run: make lint + + build: + name: Build + timeout-minutes: 5 + runs-on: macos-26 + + steps: + - uses: actions/checkout@v4 + - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Build App + run: xcodebuild -workspace Vault.xcworkspace -scheme VaultApp -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build - # build: - # name: Build - # timeout-minutes: 5 - # runs-on: macos-14 - # - # steps: - # - uses: actions/checkout@v4 - # - run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer - # - name: Build App - # run: xcodebuild -workspace Vault.xcworkspace -scheme VaultApp -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build - # # test: # name: Test # timeout-minutes: 30 From 6270bb2a3717a20e4e7f1d26c295e56845f63ac3 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:40:32 +0100 Subject: [PATCH 04/26] Fix CryptoEngineTests compilation --- Vault/Tests/CryptoEngineTests/DataHelpersTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vault/Tests/CryptoEngineTests/DataHelpersTests.swift b/Vault/Tests/CryptoEngineTests/DataHelpersTests.swift index 6e47f358c..79a64a983 100644 --- a/Vault/Tests/CryptoEngineTests/DataHelpersTests.swift +++ b/Vault/Tests/CryptoEngineTests/DataHelpersTests.swift @@ -28,12 +28,12 @@ struct DataHelpersTests { @Test func int64ToData_interpretsAsLittleEndian() { let number: UInt64 = 1 - #expect(number.data.bytes == [1, 0, 0, 0, 0, 0, 0, 0]) + #expect(Array(number.data) == [1, 0, 0, 0, 0, 0, 0, 0]) } @Test func byteString_interpretsUTF8StringValues() { let value = Data(byteString: "1234") - #expect(value.bytes == [49, 50, 51, 52]) + #expect(Array(value) == [49, 50, 51, 52]) } } From a5fe304571a4c518728216bab41e8803128c7557 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:40:51 +0100 Subject: [PATCH 05/26] Fix FoundationExtensionTests compilation + warnings --- Vault/Sources/TestHelpers/SuspendForever.swift | 4 ++-- .../FoundationExtensionsTests/PendingValueTests.swift | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Vault/Sources/TestHelpers/SuspendForever.swift b/Vault/Sources/TestHelpers/SuspendForever.swift index 633031900..01cc5d2c5 100644 --- a/Vault/Sources/TestHelpers/SuspendForever.swift +++ b/Vault/Sources/TestHelpers/SuspendForever.swift @@ -5,10 +5,10 @@ import Foundation /// This is achieved by awaiting on a stream that never yields any values. /// /// - throws: `CancellationError` if the task this is in is cancelled. -public func suspendForever() async throws -> Never { +public func suspendForever() async throws { let stream = AsyncStream { _ in } for await _ in stream { - return fatalError("Unreachable") + fatalError("Unreachable") } // The stream will only exit without a value in the case that it's been cancelled. // Propagate the cancellation. diff --git a/Vault/Tests/FoundationExtensionsTests/PendingValueTests.swift b/Vault/Tests/FoundationExtensionsTests/PendingValueTests.swift index 8f8e82fbe..c0566a398 100644 --- a/Vault/Tests/FoundationExtensionsTests/PendingValueTests.swift +++ b/Vault/Tests/FoundationExtensionsTests/PendingValueTests.swift @@ -218,14 +218,14 @@ extension PendingValueTests { /// Without this, you might acidentally call `fulfill`/`reject` before await, and thus the value will be cached. private func awaitValueInBackground( on sut: SUT, - action: () async -> Void + action: @Sendable () async -> Void ) async throws -> Result { let startedWaiting = Pending.signal() let finishedWaiting = Pending.signal() - var result: Result? let task = Task.detached(priority: .high) { await startedWaiting.fulfill() + let result: Result do { let value = try await sut.wait() result = .success(value) @@ -233,6 +233,7 @@ extension PendingValueTests { result = .failure(error) } await finishedWaiting.fulfill() + return result } try await startedWaiting.wait(timeout: .seconds(1)) @@ -242,8 +243,8 @@ extension PendingValueTests { try await finishedWaiting.wait(timeout: .seconds(1)) - task.cancel() - return try #require(result) + defer { task.cancel() } + return await task.value } private func awaitNoValueProduced(on sut: SUT) async { From 5547124ba8f40a9e5f2eca6dfc98918af744bbfc Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:53:16 +0100 Subject: [PATCH 06/26] Fix PersistedLocalVaultStore predicate compiler error --- .../SwiftData/PersistedLocalVaultStore.swift | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift b/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift index 960e6a316..13ca0d282 100644 --- a/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift +++ b/Vault/Sources/VaultFeed/Storage/VaultStore/SwiftData/PersistedLocalVaultStore.swift @@ -71,17 +71,14 @@ extension PersistedLocalVaultStore: VaultStoreReader { return .true } else { let searchingTagIds = tags.map(\.id).reducedToSet() - // Returns the number of tags matched by this item. - let tagsMatchingSearch = #Expression { item in - item.tags.count(where: { tag in - searchingTagIds.contains(tag.id) - }) - } - // Performs an "AND" query by checking if the number of tags matched equals - // the number of tags we are searching for. - let searchingTagsCount = searchingTagIds.count + // Performs an "AND" query by checking if all searched tags are present in the item's tags. + // We convert the set to an array to use filter, which is supported in SwiftData predicates. + // An item matches if the count of its tags that match our search equals the search count. + let searchingTagsArray = Array(searchingTagIds) return #Predicate { item in - tagsMatchingSearch.evaluate(item) == searchingTagsCount + item.tags.count(where: { tag in + searchingTagsArray.contains(tag.id) + }) == searchingTagsArray.count } } } From dac1e29efd65854a1da050d372422e1ae87a9db6 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:57:16 +0100 Subject: [PATCH 07/26] Xcode version explicit --- .github/workflows/validate-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 1e83ef391..274f8c693 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -11,7 +11,7 @@ env: IOS_PLATFORM: iOS Simulator IOS_DEVICE: iPhone 17 Pro IOS_VERSION: 26.0 - XCODE_VERSION: 26 + XCODE_VERSION: 26.0 jobs: lint: From 8ed8999c28a470330592f417d9098d6f94f1451d Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 11:58:12 +0100 Subject: [PATCH 08/26] Quote delimit version strings --- .github/workflows/validate-all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 274f8c693..151513e7e 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -10,8 +10,8 @@ on: env: IOS_PLATFORM: iOS Simulator IOS_DEVICE: iPhone 17 Pro - IOS_VERSION: 26.0 - XCODE_VERSION: 26.0 + IOS_VERSION: "26.0" + XCODE_VERSION: "26.0" jobs: lint: From 562f0a17d035cd34baf6d17412b2264c379be306 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:00:05 +0100 Subject: [PATCH 09/26] Build runs on CI_iOS scheme --- .github/workflows/validate-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 151513e7e..844d4257c 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -37,7 +37,7 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - name: Build App - run: xcodebuild -workspace Vault.xcworkspace -scheme VaultApp -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build + run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build # test: # name: Test From 9a03fc0ca82cbcf1ecf5b49f53d85286b0ba5b4d Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:02:29 +0100 Subject: [PATCH 10/26] Prevent corrupt SPM cache --- .github/workflows/validate-all.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 844d4257c..f07bdbf45 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -25,6 +25,8 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Clear SPM Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm - name: Lint Sources run: make lint @@ -36,6 +38,8 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Clear SPM Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm - name: Build App run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build From a2b43cb216de6634aff11bbf743cde2001d5a7a2 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:03:10 +0100 Subject: [PATCH 11/26] Improved step names --- .github/workflows/validate-all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index f07bdbf45..89865ac43 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -27,7 +27,7 @@ jobs: - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - name: Clear SPM Cache run: rm -rf ~/Library/Caches/org.swift.swiftpm - - name: Lint Sources + - name: Check Linting & Formatting run: make lint build: @@ -40,7 +40,7 @@ jobs: - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - name: Clear SPM Cache run: rm -rf ~/Library/Caches/org.swift.swiftpm - - name: Build App + - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build # test: From 0b8321d0d2c38ad10d568e627cd8fbe1bf787e25 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:05:00 +0100 Subject: [PATCH 12/26] cache spm packages --- .github/workflows/validate-all.yml | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 89865ac43..450184a5a 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -25,8 +25,21 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear SPM Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm + + - name: Cache SPM Dependencies + uses: actions/cache@v4 + with: + path: | + Vault/.build + ~/Library/Caches/org.swift.swiftpm/repositories + ~/Library/Caches/org.swift.swiftpm/configuration + key: ${{ runner.os }}-spm-lint-${{ hashFiles('Vault/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm-lint- + + - name: Clear Binary Artifacts Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Check Linting & Formatting run: make lint @@ -38,8 +51,21 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear SPM Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm + + - name: Cache SPM Dependencies + uses: actions/cache@v4 + with: + path: | + ~/Library/Caches/org.swift.swiftpm/repositories + ~/Library/Caches/org.swift.swiftpm/configuration + ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-xcode-build-${{ hashFiles('Vault/Package.resolved', '**/*.xcodeproj/project.pbxproj') }} + restore-keys: | + ${{ runner.os }}-xcode-build- + + - name: Clear Binary Artifacts Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build From ae33f3af6a9c47f11c616e00c0f0455501b5078c Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:12:03 +0100 Subject: [PATCH 13/26] Update README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index bd36b4ed9..131787fe6 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ There is purposely no automatic or online backup, so you never need to worry abo There's a few ways that you can use Vault to store your data: 1. Super secret data - - Store data you really don't want to be accessed in encrypted notes, like cryptocurrency private keys. Hide them and add a killcode so, if under duress, you can wipe them with plausible deniability. Restore from a backup when you get home. 2. Store OTP codes From 0f8c2d47e3bb1309539baaa904ea659aa1ed7596 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:15:14 +0100 Subject: [PATCH 14/26] Improve cache clear --- .github/workflows/validate-all.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 450184a5a..cdbca3723 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -26,6 +26,9 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Clear Binary Artifacts Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Cache SPM Dependencies uses: actions/cache@v4 with: @@ -37,9 +40,6 @@ jobs: restore-keys: | ${{ runner.os }}-spm-lint- - - name: Clear Binary Artifacts Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts - - name: Check Linting & Formatting run: make lint @@ -52,6 +52,9 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Clear Binary Artifacts Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Cache SPM Dependencies uses: actions/cache@v4 with: @@ -63,9 +66,6 @@ jobs: restore-keys: | ${{ runner.os }}-xcode-build- - - name: Clear Binary Artifacts Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts - - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build From ae36c051b3a650b0b3ec6bff3cc999f8a3c050e7 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:17:32 +0100 Subject: [PATCH 15/26] Try again --- .github/workflows/validate-all.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index cdbca3723..791014716 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -40,6 +40,9 @@ jobs: restore-keys: | ${{ runner.os }}-spm-lint- + - name: Clear Binary Artifacts Before Lint + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Check Linting & Formatting run: make lint @@ -66,8 +69,11 @@ jobs: restore-keys: | ${{ runner.os }}-xcode-build- + - name: Clear Binary Artifacts Before Build + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Build CI_iOS - run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet build + run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -skipPackagePluginValidation build # test: # name: Test From 459dea151bac78ad4c77ef4ab3956712fd26065b Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:21:31 +0100 Subject: [PATCH 16/26] Try again --- .github/workflows/validate-all.yml | 48 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 791014716..116e1a59b 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -26,22 +26,24 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear Binary Artifacts Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Clear SPM Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm - - name: Cache SPM Dependencies + - name: Cache SPM Repositories Only uses: actions/cache@v4 with: - path: | - Vault/.build - ~/Library/Caches/org.swift.swiftpm/repositories - ~/Library/Caches/org.swift.swiftpm/configuration - key: ${{ runner.os }}-spm-lint-${{ hashFiles('Vault/Package.resolved') }} + path: ~/Library/Caches/org.swift.swiftpm/repositories + key: ${{ runner.os }}-spm-repos-${{ hashFiles('Vault/Package.resolved') }} restore-keys: | - ${{ runner.os }}-spm-lint- + ${{ runner.os }}-spm-repos- - - name: Clear Binary Artifacts Before Lint - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Cache Vault Build + uses: actions/cache@v4 + with: + path: Vault/.build + key: ${{ runner.os }}-vault-build-${{ hashFiles('Vault/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-vault-build- - name: Check Linting & Formatting run: make lint @@ -55,22 +57,24 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear Binary Artifacts Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Clear SPM Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm - - name: Cache SPM Dependencies + - name: Cache SPM Repositories Only uses: actions/cache@v4 with: - path: | - ~/Library/Caches/org.swift.swiftpm/repositories - ~/Library/Caches/org.swift.swiftpm/configuration - ~/Library/Developer/Xcode/DerivedData - key: ${{ runner.os }}-xcode-build-${{ hashFiles('Vault/Package.resolved', '**/*.xcodeproj/project.pbxproj') }} + path: ~/Library/Caches/org.swift.swiftpm/repositories + key: ${{ runner.os }}-spm-repos-${{ hashFiles('Vault/Package.resolved') }} restore-keys: | - ${{ runner.os }}-xcode-build- + ${{ runner.os }}-spm-repos- - - name: Clear Binary Artifacts Before Build - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + - name: Cache Xcode DerivedData + uses: actions/cache@v4 + with: + path: ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-xcode-derived-${{ hashFiles('Vault/Package.resolved', '**/*.xcodeproj/project.pbxproj') }} + restore-keys: | + ${{ runner.os }}-xcode-derived- - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -skipPackagePluginValidation build From 27de114b3e4522b076e18fdc307e7be670d91fbf Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:23:40 +0100 Subject: [PATCH 17/26] Try again --- .github/workflows/validate-all.yml | 40 ++++++++++++++++-------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 116e1a59b..34b796387 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -26,8 +26,10 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear SPM Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm + - name: Clear SPM Cache Completely + run: | + rm -rf ~/Library/Caches/org.swift.swiftpm + mkdir -p ~/Library/Caches/org.swift.swiftpm/repositories - name: Cache SPM Repositories Only uses: actions/cache@v4 @@ -37,13 +39,13 @@ jobs: restore-keys: | ${{ runner.os }}-spm-repos- - - name: Cache Vault Build - uses: actions/cache@v4 - with: - path: Vault/.build - key: ${{ runner.os }}-vault-build-${{ hashFiles('Vault/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-vault-build- + - name: Verify No Artifacts + run: | + ls -la ~/Library/Caches/org.swift.swiftpm/ || true + if [ -d ~/Library/Caches/org.swift.swiftpm/artifacts ]; then + echo "ERROR: artifacts directory exists!" + rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + fi - name: Check Linting & Formatting run: make lint @@ -57,8 +59,10 @@ jobs: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear SPM Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm + - name: Clear SPM Cache Completely + run: | + rm -rf ~/Library/Caches/org.swift.swiftpm + mkdir -p ~/Library/Caches/org.swift.swiftpm/repositories - name: Cache SPM Repositories Only uses: actions/cache@v4 @@ -68,13 +72,13 @@ jobs: restore-keys: | ${{ runner.os }}-spm-repos- - - name: Cache Xcode DerivedData - uses: actions/cache@v4 - with: - path: ~/Library/Developer/Xcode/DerivedData - key: ${{ runner.os }}-xcode-derived-${{ hashFiles('Vault/Package.resolved', '**/*.xcodeproj/project.pbxproj') }} - restore-keys: | - ${{ runner.os }}-xcode-derived- + - name: Verify No Artifacts + run: | + ls -la ~/Library/Caches/org.swift.swiftpm/ || true + if [ -d ~/Library/Caches/org.swift.swiftpm/artifacts ]; then + echo "ERROR: artifacts directory exists!" + rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + fi - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -skipPackagePluginValidation build From 873a9eaabba0891654315e0443d4dba23060b63f Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:32:28 +0100 Subject: [PATCH 18/26] Try again --- .github/workflows/validate-all.yml | 44 ------------------------------ 1 file changed, 44 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 34b796387..93872337f 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -25,28 +25,6 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - - name: Clear SPM Cache Completely - run: | - rm -rf ~/Library/Caches/org.swift.swiftpm - mkdir -p ~/Library/Caches/org.swift.swiftpm/repositories - - - name: Cache SPM Repositories Only - uses: actions/cache@v4 - with: - path: ~/Library/Caches/org.swift.swiftpm/repositories - key: ${{ runner.os }}-spm-repos-${{ hashFiles('Vault/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm-repos- - - - name: Verify No Artifacts - run: | - ls -la ~/Library/Caches/org.swift.swiftpm/ || true - if [ -d ~/Library/Caches/org.swift.swiftpm/artifacts ]; then - echo "ERROR: artifacts directory exists!" - rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts - fi - - name: Check Linting & Formatting run: make lint @@ -58,28 +36,6 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - - name: Clear SPM Cache Completely - run: | - rm -rf ~/Library/Caches/org.swift.swiftpm - mkdir -p ~/Library/Caches/org.swift.swiftpm/repositories - - - name: Cache SPM Repositories Only - uses: actions/cache@v4 - with: - path: ~/Library/Caches/org.swift.swiftpm/repositories - key: ${{ runner.os }}-spm-repos-${{ hashFiles('Vault/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm-repos- - - - name: Verify No Artifacts - run: | - ls -la ~/Library/Caches/org.swift.swiftpm/ || true - if [ -d ~/Library/Caches/org.swift.swiftpm/artifacts ]; then - echo "ERROR: artifacts directory exists!" - rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts - fi - - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -skipPackagePluginValidation build From 5043284228469def40a138ccf619d53d67f84907 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:46:22 +0100 Subject: [PATCH 19/26] Try fix cache again --- .github/workflows/validate-all.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 93872337f..07537d3af 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -25,6 +25,9 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Clear SPM Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm + working-directory: . - name: Check Linting & Formatting run: make lint @@ -36,6 +39,8 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + - name: Clear SPM Cache + run: rm -rf ~/Library/Caches/org.swift.swiftpm - name: Build CI_iOS run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -skipPackagePluginValidation build From 06b99dbf509963087900cc3e22db96224d4c08ac Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:54:36 +0100 Subject: [PATCH 20/26] Attempt fix dupe package --- Vault/Package.swift | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Vault/Package.swift b/Vault/Package.swift index 20f12b68e..22f902945 100644 --- a/Vault/Package.swift +++ b/Vault/Package.swift @@ -279,17 +279,21 @@ let package = Package( description: "Formats Swift source files using swiftformat and swiftlint" ), permissions: [.writeToPackageDirectory(reason: "Format source code")] - ) + ), + dependencies: [ + "swiftformat", + "SwiftLintBinaryForFormatting", + ] + ), + .binaryTarget( + name: "SwiftLintBinaryForFormatting", + url: "https://github.com/realm/SwiftLint/releases/download/\(swiftLintVersion)/SwiftLintBinary-macos.artifactbundle.zip", + checksum: swiftLintChecksum ), .binaryTarget( name: "swiftformat", url: "https://github.com/nicklockwood/SwiftFormat/releases/download/\(swiftFormatVersion)/swiftformat.artifactbundle.zip", checksum: swiftFormatChecksum ), - .binaryTarget( - name: "swiftlint", - url: "https://github.com/realm/SwiftLint/releases/download/\(swiftLintVersion)/SwiftLintBinary-macos.artifactbundle.zip", - checksum: swiftLintChecksum - ), ] ) From e3e3d8525e1e8a9403343bbb503b2afbc4b0c8de Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 12:59:03 +0100 Subject: [PATCH 21/26] Remove duplicate package error --- Vault/Makefile | 2 ++ Vault/Package.swift | 8 +---- Vault/Plugins/FormatLint/Plugin.swift | 48 --------------------------- 3 files changed, 3 insertions(+), 55 deletions(-) diff --git a/Vault/Makefile b/Vault/Makefile index 913182f13..cd099e389 100644 --- a/Vault/Makefile +++ b/Vault/Makefile @@ -6,10 +6,12 @@ benchmark-keygen: .PHONY: format format: + swift package plugin --allow-writing-to-package-directory swiftlint --fix --quiet ./Sources swift package --allow-writing-to-package-directory format --sources=./ .PHONY: lint lint: + swift package plugin swiftlint --strict --quiet ./Sources swift package --allow-writing-to-package-directory format --lint --sources=./ .PHONY: clean diff --git a/Vault/Package.swift b/Vault/Package.swift index 22f902945..c183de1d5 100644 --- a/Vault/Package.swift +++ b/Vault/Package.swift @@ -276,20 +276,14 @@ let package = Package( capability: .command( intent: .custom( verb: "format", - description: "Formats Swift source files using swiftformat and swiftlint" + description: "Formats Swift source files using swiftformat only" ), permissions: [.writeToPackageDirectory(reason: "Format source code")] ), dependencies: [ "swiftformat", - "SwiftLintBinaryForFormatting", ] ), - .binaryTarget( - name: "SwiftLintBinaryForFormatting", - url: "https://github.com/realm/SwiftLint/releases/download/\(swiftLintVersion)/SwiftLintBinary-macos.artifactbundle.zip", - checksum: swiftLintChecksum - ), .binaryTarget( name: "swiftformat", url: "https://github.com/nicklockwood/SwiftFormat/releases/download/\(swiftFormatVersion)/swiftformat.artifactbundle.zip", diff --git a/Vault/Plugins/FormatLint/Plugin.swift b/Vault/Plugins/FormatLint/Plugin.swift index 3c2f8a43d..d86f29373 100644 --- a/Vault/Plugins/FormatLint/Plugin.swift +++ b/Vault/Plugins/FormatLint/Plugin.swift @@ -9,8 +9,6 @@ struct FormatLintPlugin: CommandPlugin { let formatLintContext = try makeFormatLintContext(context: context, arguments: arguments) let start = Date() - // Lint before formatting so any formatting that results in lint errors is surfaced and we can address it. - try formatLintContext.runSwiftLint() try formatLintContext.runSwiftFormat() let end = Date() let elapsed = end.timeIntervalSince(start) @@ -32,7 +30,6 @@ struct FormatLintPlugin: CommandPlugin { .format } return try FormatLintContext( - swiftlint: context.tool(named: "swiftlint"), swiftformat: context.tool(named: "swiftformat"), workDirectory: context.pluginWorkDirectoryURL, swiftSourcesDirectory: swiftSources, @@ -42,40 +39,12 @@ struct FormatLintPlugin: CommandPlugin { } struct FormatLintContext { - var swiftlint: PluginContext.Tool var swiftformat: PluginContext.Tool var workDirectory: URL var swiftSourcesDirectory: String var action: Action } -extension FormatLintContext { - func makeSwiftLintArgs() -> [String] { - var swiftLintArguments = [String]() - swiftLintArguments += ["--cache-path", workDirectory.appending(path: "swiftlint.cache").path()] - swiftLintArguments += ["--quiet"] - switch action { - case .format: - swiftLintArguments += ["--fix"] - case .lint: - swiftLintArguments += ["--strict"] - } - swiftLintArguments += [swiftSourcesDirectory] - return swiftLintArguments - } - - func runSwiftLint() throws { - print("🔍 swiftlint: \(action.swiftLintVerb.lowercased())") - try runProcess( - url: swiftlint.url, - arguments: makeSwiftLintArgs(), - exitCodeHandler: swiftLintExitCodeHandler(code:) - ) - } -} - -// MARK: - swiftformat - extension FormatLintContext { func makeSwiftFormatArgs() -> [String] { var swiftFormatArguments = [String]() @@ -110,13 +79,6 @@ enum Action { case .lint: "Checking" } } - - var swiftLintVerb: String { - switch self { - case .format: "Fixing" - case .lint: "Linting" - } - } } enum CommandError: Error { @@ -149,13 +111,3 @@ func swiftFormatExitCodeHandler(code: Int32) throws { throw CommandError.unknownError(exitCode: code) } } - -func swiftLintExitCodeHandler(code: Int32) throws { - switch code { - case 0: - print("☑️ swiftlint done") - default: - print("❌ swiftlint failure") - throw CommandError.exitWithError - } -} From cdfcdb1fe12c6c9ef108b8e83f08522818b81709 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 13:04:23 +0100 Subject: [PATCH 22/26] Download iOS runtime --- .github/workflows/validate-all.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 07537d3af..e5771d232 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -33,12 +33,24 @@ jobs: build: name: Build - timeout-minutes: 5 + timeout-minutes: 10 runs-on: macos-26 steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + + - name: Cache iOS Runtime + uses: actions/cache@v4 + id: runtime-cache + with: + path: ~/Library/Caches/com.apple.dt.Xcode/Downloads + key: ${{ runner.os }}-ios-runtime-${{ env.IOS_VERSION }} + + - name: Download iOS Runtime + if: steps.runtime-cache.outputs.cache-hit != 'true' + run: sudo xcodebuild -downloadPlatform iOS -buildVersion ${{ env.IOS_VERSION }} + - name: Clear SPM Cache run: rm -rf ~/Library/Caches/org.swift.swiftpm - name: Build CI_iOS From a27085231b27ee6d0fd5649a7fd2f0f2c1c11f7b Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 13:20:16 +0100 Subject: [PATCH 23/26] Build macOS CI --- .github/workflows/validate-all.yml | 54 ++++++----------- .../xcshareddata/xcschemes/CI_iOS.xcscheme | 3 + .../xcshareddata/xcschemes/CI_macOS.xcscheme | 59 +++++++++++++++++++ .../TestHelpers/PDFDocument+Snapshot.swift | 3 + .../CI/macOS_SupportedTests.xctestplan | 52 ++++++++++++++++ 5 files changed, 136 insertions(+), 35 deletions(-) create mode 100644 Vault/.swiftpm/xcode/xcshareddata/xcschemes/CI_macOS.xcscheme create mode 100644 Vault/TestPlans/CI/macOS_SupportedTests.xctestplan diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index e5771d232..7351f5539 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -8,9 +8,6 @@ on: branches: [main] env: - IOS_PLATFORM: iOS Simulator - IOS_DEVICE: iPhone 17 Pro - IOS_VERSION: "26.0" XCODE_VERSION: "26.0" jobs: @@ -25,9 +22,17 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - name: Clear SPM Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm - working-directory: . + + - name: Cache SPM Dependencies + uses: actions/cache@v4 + with: + path: | + ~/Library/Caches/org.swift.swiftpm/repositories + Vault/.build + key: ${{ runner.os }}-spm-lint-${{ hashFiles('Vault/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm-lint- + - name: Check Linting & Formatting run: make lint @@ -39,35 +44,14 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - - name: Cache iOS Runtime + + - name: Cache SPM Dependencies uses: actions/cache@v4 - id: runtime-cache with: - path: ~/Library/Caches/com.apple.dt.Xcode/Downloads - key: ${{ runner.os }}-ios-runtime-${{ env.IOS_VERSION }} - - - name: Download iOS Runtime - if: steps.runtime-cache.outputs.cache-hit != 'true' - run: sudo xcodebuild -downloadPlatform iOS -buildVersion ${{ env.IOS_VERSION }} - - - name: Clear SPM Cache - run: rm -rf ~/Library/Caches/org.swift.swiftpm - - name: Build CI_iOS - run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -skipPackagePluginValidation build + path: ~/Library/Caches/org.swift.swiftpm/repositories + key: ${{ runner.os }}-spm-${{ hashFiles('Vault/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- - # test: - # name: Test - # timeout-minutes: 30 - # runs-on: ubuntu-latest - # # runs-on: macos-14 - # - # steps: - # # We currently don't run tests in CI due to cost. - # # This can be re-enabled when the repo is made public! - # - name: Skip Testing - # run: true - # - uses: actions/checkout@v4 - # - run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer - # - name: Run all Tests - # run: xcodebuild -workspace Vault.xcworkspace -scheme CI_iOS -destination 'platform=${{ env.IOS_PLATFORM }},name=${{ env.IOS_DEVICE }},OS=${{ env.IOS_VERSION }}' -skipMacroValidation -quiet test + - name: Build CI_macOS + run: xcodebuild -workspace Vault.xcworkspace -scheme CI_macOS -destination 'platform=macOS' -skipMacroValidation -skipPackagePluginValidation build diff --git a/Vault/.swiftpm/xcode/xcshareddata/xcschemes/CI_iOS.xcscheme b/Vault/.swiftpm/xcode/xcshareddata/xcschemes/CI_iOS.xcscheme index 90a9c4a1a..22f8cb2e7 100644 --- a/Vault/.swiftpm/xcode/xcshareddata/xcschemes/CI_iOS.xcscheme +++ b/Vault/.swiftpm/xcode/xcshareddata/xcschemes/CI_iOS.xcscheme @@ -28,6 +28,9 @@ reference = "container:TestPlans/CI/iOSAllTests.xctestplan" default = "YES"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Vault/Sources/TestHelpers/PDFDocument+Snapshot.swift b/Vault/Sources/TestHelpers/PDFDocument+Snapshot.swift index c8b2c64a1..4e95883d0 100644 --- a/Vault/Sources/TestHelpers/PDFDocument+Snapshot.swift +++ b/Vault/Sources/TestHelpers/PDFDocument+Snapshot.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import Foundation import PDFKit import SnapshotTesting @@ -36,3 +37,5 @@ extension PDFDocument { } } } + +#endif diff --git a/Vault/TestPlans/CI/macOS_SupportedTests.xctestplan b/Vault/TestPlans/CI/macOS_SupportedTests.xctestplan new file mode 100644 index 000000000..2051c455c --- /dev/null +++ b/Vault/TestPlans/CI/macOS_SupportedTests.xctestplan @@ -0,0 +1,52 @@ +{ + "configurations" : [ + { + "id" : "D213A255-37DA-4E13-8AB8-3AD0E9C299FE", + "name" : "Configuration 1", + "options" : { + + } + } + ], + "defaultOptions" : { + "testTimeoutsEnabled" : true + }, + "testTargets" : [ + { + "target" : { + "containerPath" : "container:", + "identifier" : "VaultCoreTests", + "name" : "VaultCoreTests" + } + }, + { + "target" : { + "containerPath" : "container:", + "identifier" : "FoundationExtensionsTests", + "name" : "FoundationExtensionsTests" + } + }, + { + "target" : { + "containerPath" : "container:", + "identifier" : "CryptoEngineTests", + "name" : "CryptoEngineTests" + } + }, + { + "target" : { + "containerPath" : "container:", + "identifier" : "VaultKeygenTests", + "name" : "VaultKeygenTests" + } + }, + { + "target" : { + "containerPath" : "container:", + "identifier" : "VaultKeygenSpeedtestCompileTests", + "name" : "VaultKeygenSpeedtestCompileTests" + } + } + ], + "version" : 1 +} From b5d3dcba837405a3052507f7233cbbb0c4819d4d Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 13:23:16 +0100 Subject: [PATCH 24/26] Remove macOS explicit platform --- .github/workflows/validate-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 7351f5539..b429580bb 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -54,4 +54,4 @@ jobs: ${{ runner.os }}-spm- - name: Build CI_macOS - run: xcodebuild -workspace Vault.xcworkspace -scheme CI_macOS -destination 'platform=macOS' -skipMacroValidation -skipPackagePluginValidation build + run: xcodebuild -workspace Vault.xcworkspace -scheme CI_macOS -skipMacroValidation -skipPackagePluginValidation build From ed99e02cc3f0798ede12769d9ffb7d46d791d396 Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 13:26:17 +0100 Subject: [PATCH 25/26] Test scheme --- .github/workflows/validate-all.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index b429580bb..2ab416b5c 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -36,8 +36,8 @@ jobs: - name: Check Linting & Formatting run: make lint - build: - name: Build + test: + name: Test timeout-minutes: 10 runs-on: macos-26 @@ -53,5 +53,8 @@ jobs: restore-keys: | ${{ runner.os }}-spm- - - name: Build CI_macOS - run: xcodebuild -workspace Vault.xcworkspace -scheme CI_macOS -skipMacroValidation -skipPackagePluginValidation build + - name: Clear SPM Artifacts + run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + + - name: Test CI_macOS + run: xcodebuild test -workspace Vault.xcworkspace -scheme CI_macOS -skipMacroValidation -skipPackagePluginValidation From 8c986af373b2573517f0ac096f38f8dfefd4022c Mon Sep 17 00:00:00 2001 From: Bradley Mackey Date: Tue, 21 Oct 2025 13:26:54 +0100 Subject: [PATCH 26/26] Disable testing --- .github/workflows/validate-all.yml | 45 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/validate-all.yml b/.github/workflows/validate-all.yml index 2ab416b5c..e314f00cc 100644 --- a/.github/workflows/validate-all.yml +++ b/.github/workflows/validate-all.yml @@ -36,25 +36,26 @@ jobs: - name: Check Linting & Formatting run: make lint - test: - name: Test - timeout-minutes: 10 - runs-on: macos-26 - - steps: - - uses: actions/checkout@v4 - - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer - - - name: Cache SPM Dependencies - uses: actions/cache@v4 - with: - path: ~/Library/Caches/org.swift.swiftpm/repositories - key: ${{ runner.os }}-spm-${{ hashFiles('Vault/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - - - name: Clear SPM Artifacts - run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts - - - name: Test CI_macOS - run: xcodebuild test -workspace Vault.xcworkspace -scheme CI_macOS -skipMacroValidation -skipPackagePluginValidation + # Don't test for now to save CI time + # test: + # name: Test + # timeout-minutes: 10 + # runs-on: macos-26 + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer + # + # - name: Cache SPM Dependencies + # uses: actions/cache@v4 + # with: + # path: ~/Library/Caches/org.swift.swiftpm/repositories + # key: ${{ runner.os }}-spm-${{ hashFiles('Vault/Package.resolved') }} + # restore-keys: | + # ${{ runner.os }}-spm- + # + # - name: Clear SPM Artifacts + # run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts + # + # - name: Test CI_macOS + # run: xcodebuild test -workspace Vault.xcworkspace -scheme CI_macOS -skipMacroValidation -skipPackagePluginValidation