Skip to content

Commit

Permalink
Merge pull request #19 from MFB-Technologies-Inc/feature/xcode-16-and…
Browse files Browse the repository at this point in the history
…-swift-6-fixes

Feature/xcode 16 and swift 6 fixes
  • Loading branch information
r-jarvis authored Jun 14, 2024
2 parents 9a0c6a0 + 49e48b2 commit 5f8547b
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 70 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ on:

jobs:
lint:
runs-on: macos-latest
runs-on: macos-14
environment: default
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Format lint
run: swiftformat --lint .
- name: Install swiftlint
run: brew update && brew install swiftlint
- name: Lint
run: swiftlint .
macos-test:
Expand All @@ -28,13 +30,14 @@ jobs:
xcode: '15.3' # Swift 5.10
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Run Tests
run: swift test --enable-code-coverage --parallel
- name: Swift Coverage Report
run: xcrun llvm-cov export -format="lcov" .build/debug/NetworkServicePackageTests.xctest/Contents/MacOS//NetworkServicePackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true # optional (default = false)
136 changes: 71 additions & 65 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,66 @@ import PackageDescription
let package = Package(
name: "NetworkService",
platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)],
products: Product.products,
dependencies: Package.Dependency.dependencies,
targets: Target.targets
products: Product.products(),
dependencies: Package.Dependency.dependencies(),
targets: Target.targets()
)

extension Product {
static let products: [Product] = [
.library(
name: "NetworkService",
targets: ["NetworkService"]
),
.library(
name: "NetworkServiceTestHelper",
targets: ["NetworkServiceTestHelper"]
),
]
static func products() -> [Product] {
[
.library(
name: "NetworkService",
targets: ["NetworkService"]
),
.library(
name: "NetworkServiceTestHelper",
targets: ["NetworkServiceTestHelper"]
),
]
}
}

extension Target {
static let targets: [Target] = [
.target(
name: "NetworkService",
dependencies: [
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "HTTPTypesFoundation", package: "swift-http-types"),
],
swiftSettings: .shared
),
.testTarget(
name: "NetworkServiceTests",
dependencies: [
.product(name: "CustomDump", package: "swift-custom-dump"),
"NetworkService",
.product(name: "OHHTTPStubs", package: "OHHTTPStubs"),
.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"),
],
swiftSettings: .shared
),
.target(
name: "NetworkServiceTestHelper",
dependencies: [
"NetworkService",
.product(name: "CombineSchedulers", package: "combine-schedulers"),
],
swiftSettings: .shared
),
.testTarget(
name: "NetworkServiceTestHelperTests",
dependencies: [
"NetworkServiceTestHelper",
.product(name: "CombineSchedulers", package: "combine-schedulers"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: .shared
),
]
static func targets() -> [Target] {
[
.target(
name: "NetworkService",
dependencies: [
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "HTTPTypesFoundation", package: "swift-http-types"),
],
swiftSettings: .shared
),
.testTarget(
name: "NetworkServiceTests",
dependencies: [
.product(name: "CustomDump", package: "swift-custom-dump"),
"NetworkService",
.product(name: "OHHTTPStubs", package: "OHHTTPStubs"),
.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"),
],
swiftSettings: .shared
),
.target(
name: "NetworkServiceTestHelper",
dependencies: [
"NetworkService",
.product(name: "CombineSchedulers", package: "combine-schedulers"),
],
swiftSettings: .shared
),
.testTarget(
name: "NetworkServiceTestHelperTests",
dependencies: [
"NetworkServiceTestHelper",
.product(name: "CombineSchedulers", package: "combine-schedulers"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: .shared
),
]
}
}

extension [SwiftSetting] {
Expand All @@ -71,19 +75,21 @@ extension [SwiftSetting] {
}

extension Package.Dependency {
static let dependencies: [Package.Dependency] = [
.package(
url: "https://github.com/AliSoftware/OHHTTPStubs.git",
from: "9.1.0"
),
.package(
url: "https://github.com/pointfreeco/combine-schedulers.git",
from: "1.0.0"
),
.package(
url: "https://github.com/apple/swift-http-types.git",
from: "1.0.0"
),
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "1.0.0"),
]
static func dependencies() -> [Package.Dependency] {
[
.package(
url: "https://github.com/AliSoftware/OHHTTPStubs.git",
from: "9.1.0"
),
.package(
url: "https://github.com/pointfreeco/combine-schedulers.git",
from: "1.0.0"
),
.package(
url: "https://github.com/apple/swift-http-types.git",
from: "1.0.0"
),
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "1.0.0"),
]
}
}
2 changes: 1 addition & 1 deletion Sources/NetworkServiceTestHelper/MockOutput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import NetworkService

/// A type erasing protocol for `MockNetworkService`'s output queue. Allows a heterogenous array.
public protocol MockOutput {
public protocol MockOutput: Sendable {
var output: Result<Data, NetworkService.Failure> { get }
}

Expand Down

0 comments on commit 5f8547b

Please sign in to comment.