diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f831472..991b68a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,12 +1,12 @@ { "name": "Swift", - "image": "swift:5.9.1", + "image": "swift:6.0", "features": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "false", "username": "vscode", - "userUid": "1000", - "userGid": "1000", + "userUid": "1001", + "userGid": "1001", "upgradePackages": "false" }, "ghcr.io/devcontainers/features/git:1": { diff --git a/.github/workflows/swift.yml b/.github/workflows/swift-5.9.yml similarity index 68% rename from .github/workflows/swift.yml rename to .github/workflows/swift-5.9.yml index b021b75..66f9bb8 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift-5.9.yml @@ -1,4 +1,4 @@ -name: Unit Test +name: Test Swift 5.9 on: push: @@ -8,11 +8,11 @@ on: jobs: build: - + container: swift:5.9 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build - run: swift build -v + run: swift build - name: Run tests - run: swift test -v + run: swift test diff --git a/.github/workflows/swift-6.0.yml b/.github/workflows/swift-6.0.yml new file mode 100644 index 0000000..a6b7b99 --- /dev/null +++ b/.github/workflows/swift-6.0.yml @@ -0,0 +1,18 @@ +name: Test Swift 6.0 + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + container: swift:6.0 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build + run: swift build + - name: Run tests + run: swift test diff --git a/Package.swift b/Package.swift index c70ff14..f2ceb2c 100644 --- a/Package.swift +++ b/Package.swift @@ -25,7 +25,8 @@ let package = Package( .testTarget( name: "DataDogLogTests", dependencies: ["DataDogLog"]), - ] + ], + swiftLanguageVersions: [.version("6"), .v5] ) #if os(Linux) diff --git a/Sources/DataDogLog/Internal/Extensions/String+Timestamp.swift b/Sources/DataDogLog/Internal/Extensions/String+Timestamp.swift index c020a1a..dd1696a 100644 --- a/Sources/DataDogLog/Internal/Extensions/String+Timestamp.swift +++ b/Sources/DataDogLog/Internal/Extensions/String+Timestamp.swift @@ -4,8 +4,11 @@ extension String { static var timestamp: String { var buffer = [Int8](repeating: 0, count: 255) var timestamp = time(nil) - let localTime = localtime(×tamp) + guard let localTime = localtime(×tamp) else { + return "" + } strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime) + return buffer.withUnsafeBufferPointer { $0.withMemoryRebound(to: CChar.self) { String(cString: $0.baseAddress!) diff --git a/Sources/DataDogLog/Internal/NetworkClient.swift b/Sources/DataDogLog/Internal/NetworkClient.swift index d2cfe65..b39daa1 100644 --- a/Sources/DataDogLog/Internal/NetworkClient.swift +++ b/Sources/DataDogLog/Internal/NetworkClient.swift @@ -24,7 +24,7 @@ final class NetworkClient: Sendable { deinit { #if os(Linux) - client.shutdown() + client.shutdown { _ in } #endif }