diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 5ed7dee..e7aa5a2 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -28,3 +28,5 @@ jobs: uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 with: coveragereports: HealthKitOnOMH.xcresult + secrets: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.swiftlint.yml b/.swiftlint.yml index 57ce227..d1b41b7 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -141,8 +141,6 @@ only_rules: - implicitly_unwrapped_optional # Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status - inclusive_language - # If defer is at the end of its parent scope, it will be executed right where it is anyway. - - inert_defer # Prefer using Set.isDisjoint(with:) over Set.intersection(_:).isEmpty. - is_disjoint # Discouraged explicit usage of the default separator. @@ -329,8 +327,6 @@ only_rules: - unowned_variable_capture # Catch statements should not declare error variables without type casting. - untyped_error_in_catch - # Unused reference in a capture list should be removed. - - unused_capture_list # Unused parameter in a closure should be replaced with _. - unused_closure_parameter # Unused control flow label should be removed. diff --git a/Package.swift b/Package.swift index 278a963..65a114b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.8 +// swift-tools-version:6.0 // // This source file is part of the HealthKitOnOMH open source project @@ -8,6 +8,7 @@ // SPDX-License-Identifier: MIT // +import class Foundation.ProcessInfo import PackageDescription @@ -21,19 +22,39 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/StanfordBDHG/OMHModels.git", .upToNextMajor(from: "0.1.0")) - ], + ] + swiftLintPackage(), targets: [ .target( name: "HealthKitOnOMH", dependencies: [ .product(name: "OMHModels", package: "OMHModels") - ] + ], + plugins: [] + swiftLintPlugin() ), .testTarget( name: "HealthKitOnOMHTests", dependencies: [ .target(name: "HealthKitOnOMH") - ] + ], + plugins: [] + swiftLintPlugin() ) ] ) + + +func swiftLintPlugin() -> [Target.PluginUsage] { + // Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app` + if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil { + [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")] + } else { + [] + } +} + +func swiftLintPackage() -> [PackageDescription.Package.Dependency] { + if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil { + [.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")] + } else { + [] + } +}