diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1c4521..b2731da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,20 +35,28 @@ jobs: strategy: matrix: swift: + - 5.3 - 5.4 - 5.5 steps: - uses: actions/checkout@v2 - name: Run tests - run: make test-linux-${{ matrix.swift }} + run: make test-linux SWIFT_VERSION=${{ matrix.swift }} windows: name: Windows runs-on: windows-latest + strategy: + matrix: + swift: + #- 5.3 + - 5.4 + - 5.5 timeout-minutes: 30 steps: - uses: actions/checkout@v2 - name: Install Swift & Run tests uses: MaxDesiatov/swift-windows-action@v1 with: - shell-action: swift test && swift build -c release + shell-action: swift test && swift build --configuration release + swift-version: ${{ matrix.swift }} diff --git a/Makefile b/Makefile index 4d9d11c..9e10a23 100644 --- a/Makefile +++ b/Makefile @@ -3,29 +3,25 @@ PLATFORM_MACOS = macOS PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p) PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 4 - 44mm +SWIFT_VERSION = 5.5 +ifeq ($(SWIFT_VERSION),5.3) +SWIFT_BUILD_ARGS = --enable-test-discovery +endif +SWIFT_TEST_ARGS = --parallel -test-all: test-linux-all test-swift test-platforms +test-all: test-linux test-swift test-platforms -test-linux-all: test-linux-5.4 test-linux-5.5 - -test-linux-5.4: - $(call test-linux,5.4) - -test-linux-5.5: - $(call test-linux,5.5) - -test-linux = docker run \ - --rm \ - -v "$(PWD):$(PWD)" \ - -w "$(PWD)" \ - swift:$(1) \ - bash -c 'make test-swift' +test-linux: + docker run \ + --rm \ + -v "$(PWD):$(PWD)" \ + -w "$(PWD)" \ + swift:$(SWIFT_VERSION) \ + bash -c 'make test-swift SWIFT_VERSION=$(SWIFT_VERSION)' test-swift: - swift test \ - --parallel - swift build \ - --configuration release + swift test $(SWIFT_BUILD_ARGS) $(SWIFT_TEST_ARGS) + swift build --configuration release $(SWIFT_BUILD_ARGS) test-platforms: xcodebuild test \ diff --git a/Sources/CustomDump/Conformances/Foundation.swift b/Sources/CustomDump/Conformances/Foundation.swift index 2d0a8b3..861ba66 100644 --- a/Sources/CustomDump/Conformances/Foundation.swift +++ b/Sources/CustomDump/Conformances/Foundation.swift @@ -5,8 +5,8 @@ import Foundation #endif // NB: Xcode 13 does not include macOS 12 SDK -// NB: Swift 5.5 does not include AttributedString in Linux (yet) -#if compiler(>=5.5) && !os(macOS) && !targetEnvironment(macCatalyst) && !os(Linux) +// NB: Swift 5.5 does not include AttributedString on other platforms (yet) +#if compiler(>=5.5) && !targetEnvironment(macCatalyst) && (os(iOS) || os(tvOS) || os(watchOS)) @available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) extension AttributedString: CustomDumpRepresentable { public var customDumpValue: Any { diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index 0bc62da..f7155d2 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -718,7 +718,7 @@ final class DumpTests: XCTestCase { func testFoundation() { var dump = "" - #if compiler(>=5.5) && !os(macOS) && !targetEnvironment(macCatalyst) && !os(Linux) + #if compiler(>=5.5) && !targetEnvironment(macCatalyst) && (os(iOS) || os(tvOS) || os(watchOS)) if #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) { dump = "" customDump( @@ -967,7 +967,7 @@ final class DumpTests: XCTestCase { DumpTests.(unknown context).(unknown context).BridgedError.thisIsFine(94) """ ) - #else + #elseif compiler(>=5.4) // Can't unwrap bridged Errors on Linux: https://bugs.swift.org/browse/SR-15191 XCTAssertNoDifference( dump.replacingOccurrences(