From f8e16b12dfc786722da0242d2dba2f6cb9782335 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 15 Aug 2022 14:00:53 +0100 Subject: [PATCH 1/7] Test with Xcode 14.0 and Swift 5.7 --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ef53a3e..79025bf2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,11 @@ jobs: macOS: "12" iOS: "15.5" tvOS: "15.4" + useCodecov: "false" + - xcode: "14.0" # Swift 5.6 + macOS: "12" + iOS: "16.0" + tvOS: "16.0" useCodecov: "true" runs-on: macos-${{ matrix.macOS }} From 88fbbb6b340b23796160549512cb73b9ef7b34cf Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 15 Aug 2022 14:06:58 +0100 Subject: [PATCH 2/7] Fix syntax in `test_xcodebuild.sh` --- test_xcodebuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_xcodebuild.sh b/test_xcodebuild.sh index af124837..d1f32fbf 100755 --- a/test_xcodebuild.sh +++ b/test_xcodebuild.sh @@ -11,7 +11,7 @@ xcodebuild test -scheme XMLCoder \ xcodebuild test -scheme XMLCoder \ -sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty -if [ "$CODECOV_JOB" = "true"] ; then +if [ "$CODECOV_JOB" = "true" ] ; then xcodebuild test -enableCodeCoverage YES -scheme XMLCoder \ -sdk macosx | xcpretty bash <(curl -s https://codecov.io/bash) From 014c194e99f23f9c0386b67579de39a10fc5a9d9 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 15 Aug 2022 15:13:27 +0100 Subject: [PATCH 3/7] Fix tests on iOS/tvOS 16+ --- .../AdvancedFeatures/ErrorContextTest.swift | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift b/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift index 11a9aa2f..82c28f7e 100644 --- a/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift +++ b/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift @@ -31,26 +31,34 @@ final class ErrorContextTest: XCTestCase { return } - #if os(Linux) && swift(<5.4) - // XML Parser returns a different column on Linux - // https://bugs.swift.org/browse/SR-11192 - XCTAssertEqual(ctx.debugDescription, """ + let column2 = """ + \(underlying.localizedDescription) \ + at line 1, column 2: + `` - """) - #elseif os(Windows) || os(Linux) - XCTAssertEqual(ctx.debugDescription, """ + """ + let column10 = """ \(underlying.localizedDescription) \ at line 1, column 10: `//>` - """) + """ + + #if (os(Linux) && swift(<5.4)) || os(iOS) + // XML Parser returns a different column on Linux and iOS 16+ + // https://bugs.swift.org/browse/SR-11192 + XCTAssertEqual(ctx.debugDescription, column7) + #elseif os(Windows) || os(Linux) + XCTAssertEqual(ctx.debugDescription, column10) #else - XCTAssertEqual(ctx.debugDescription, """ - \(underlying.localizedDescription) \ - at line 1, column 2: - ` Date: Mon, 15 Aug 2022 15:19:29 +0100 Subject: [PATCH 4/7] Fix issues with tests on macOS 12 and earlier --- Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift b/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift index 82c28f7e..dc93c73e 100644 --- a/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift +++ b/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift @@ -54,7 +54,7 @@ final class ErrorContextTest: XCTestCase { #elseif os(Windows) || os(Linux) XCTAssertEqual(ctx.debugDescription, column10) #else - if #available(iOS 16.0, tvOS 16.0, *) { + if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) { XCTAssertEqual(ctx.debugDescription, column7) } else { XCTAssertEqual(ctx.debugDescription, column2) @@ -108,7 +108,7 @@ final class ErrorContextTest: XCTestCase { // https://bugs.swift.org/browse/SR-11192 XCTAssertEqual(ctx.debugDescription, line4column1) #else - if #available(iOS 16.0, tvOS 16.0, *) { + if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) { XCTAssertEqual(ctx.debugDescription, line4column1) } else { XCTAssertEqual(ctx.debugDescription, line3column8) From 0234f2197a9e80bd84398cf223bbd4f7eb60cb79 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 15 Aug 2022 15:21:13 +0100 Subject: [PATCH 5/7] Update comment in `main.yml` --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79025bf2..e67caef3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: iOS: "15.5" tvOS: "15.4" useCodecov: "false" - - xcode: "14.0" # Swift 5.6 + - xcode: "14.0" # Swift 5.7 macOS: "12" iOS: "16.0" tvOS: "16.0" From da3247da7e09285c74a8eb267ef6686ea95f1ab9 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 15 Aug 2022 15:47:57 +0100 Subject: [PATCH 6/7] Remove redundant `|| os(iOS)` condition --- Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift b/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift index dc93c73e..2bf69a72 100644 --- a/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift +++ b/Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift @@ -47,7 +47,7 @@ final class ErrorContextTest: XCTestCase { `//>` """ - #if (os(Linux) && swift(<5.4)) || os(iOS) + #if os(Linux) && swift(<5.4) // XML Parser returns a different column on Linux and iOS 16+ // https://bugs.swift.org/browse/SR-11192 XCTAssertEqual(ctx.debugDescription, column7) From bb947b19c504869205bd2edf2b925ce276708a14 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 15 Aug 2022 16:18:25 +0100 Subject: [PATCH 7/7] Only run tvOS tests when its simulator is present --- test_xcodebuild.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test_xcodebuild.sh b/test_xcodebuild.sh index d1f32fbf..92fe1533 100755 --- a/test_xcodebuild.sh +++ b/test_xcodebuild.sh @@ -8,8 +8,11 @@ sudo xcode-select --switch /Applications/$1.app/Contents/Developer xcodebuild -version xcodebuild test -scheme XMLCoder \ -sdk iphonesimulator -destination "$IOS_DEVICE" | xcpretty -xcodebuild test -scheme XMLCoder \ - -sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty + +if $(xcodebuild -showdestinations -scheme XMLCoder | grep 'platform:tvOS.* OS:'); then + xcodebuild test -scheme XMLCoder \ + -sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty +fi if [ "$CODECOV_JOB" = "true" ] ; then xcodebuild test -enableCodeCoverage YES -scheme XMLCoder \