diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b669014e..7be614892 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,87 +15,92 @@ concurrency: cancel-in-progress: true jobs: - linux: + linux-build: + name: Linux (Swift ${{ matrix.swift }}) runs-on: ubuntu-20.04 strategy: matrix: swift: - - 4.0.3 - - 4.1.3 - - 4.2.4 + - '4.0' + - '4.1' + - '4.2' container: image: swift:${{ matrix.swift }} steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v1 # DO NOT UPDATE ∵ failure on older containers due to old glibc - run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc 3 - - run: swift build # generated linuxmain requires Swift 5 sadly + - run: swift build # can’t test ∵ generated linuxmain requires Swift 5 - linux-code-cov: - name: linux - runs-on: ubuntu-20.04 + linux-test: + name: Linux (Swift ${{ matrix.swift }}) + runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: swift: - '5.0' - - 5.1 - - 5.2 - - 5.3 - - 5.4 - - 5.5 - - 5.6 + - '5.1' + - '5.2' + - '5.3' + - '5.4' + - '5.5' + - '5.6' + - '5.7' + - '5.8' + - '5.9' + - '5.10' + - '6.0' container: image: swift:${{ matrix.swift }} steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v1 # DO NOT UPDATE ∵ failure on older containers due to old glibc - run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc 4 + if: ${{ matrix.swift < 6 }} - run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc 4.2 + if: ${{ matrix.swift < 6 }} - run: swift test --enable-code-coverage --parallel - name: Generate Coverage Report - if: ${{ matrix.swift < 5.4 }} # fails for SOME REASON + if: ${{ matrix.swift >= 6 }} run: | apt-get -qq update - apt-get -qq install llvm-10 curl - export b=$(swift build --show-bin-path) && llvm-cov-10 \ + apt-get -qq install llvm-18 curl + export b=$(swift build --show-bin-path) && llvm-cov-18 \ export -format lcov \ -instr-profile=$b/codecov/default.profdata \ --ignore-filename-regex='\.build/' \ $b/*.xctest \ > info.lcov + - uses: codecov/codecov-action@v1 with: file: ./info.lcov - - verify-linuxmain: - runs-on: macos-latest - name: linux (validate manifests) - steps: - - uses: actions/checkout@v4.1.7 - - run: swift test --generate-linuxmain - - run: git diff --exit-code + if: ${{ matrix.swift >= 6 }} test: - runs-on: macos-14 + runs-on: macos-latest + name: ${{ matrix.platform }} + continue-on-error: true strategy: matrix: - dst: - - "platform=macOS,arch=arm64,id=0000FE00-392BB8A41C01F642" - - "platform=iOS Simulator,OS=17.0.1,name=iPhone 14" - - "platform=tvOS Simulator,OS=17.2,name=Apple TV" + platform: + - macOS + - watchOS + - tvOS + - iOS + # - mac-catalyst + # - visionOS + # ^^ both are unavailable in the github-hosted runners steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 15.2 - - uses: actions/checkout@v4.1.7 - - uses: sersoft-gmbh/xcodebuild-action@v1 + - uses: actions/checkout@v4 + - uses: mxcl/xcodebuild@v3 with: - project: PromiseKit.xcodeproj - scheme: PromiseKit - destination: ${{ matrix.dst }} - action: test - enable-code-coverage: true + platform: ${{ matrix.platform }} + code-coverage: true - uses: codecov/codecov-action@v1 + test-android: + name: Android runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/Tests/A+/XCTestManifests.swift b/Tests/A+/XCTestManifests.swift index 47a695d91..0af7b7f28 100644 --- a/Tests/A+/XCTestManifests.swift +++ b/Tests/A+/XCTestManifests.swift @@ -1,7 +1,7 @@ #if !canImport(ObjectiveC) import XCTest -#if os(Linux) || os(Android) +#if os(Android) extension XCTestExpectation { func fulfill() { fulfill(#file, line: #line) diff --git a/Tests/CorePromise/CancellableErrorTests.swift b/Tests/CorePromise/CancellableErrorTests.swift index 3eb7212c9..871efa248 100644 --- a/Tests/CorePromise/CancellableErrorTests.swift +++ b/Tests/CorePromise/CancellableErrorTests.swift @@ -108,16 +108,17 @@ class CancellationTests: XCTestCase { #endif #if canImport(StoreKit) - do { - let err = SKError(.paymentCancelled) - XCTAssertTrue(err.isCancelled) - throw err - } catch { - XCTAssertTrue(error.isCancelled) + if #available(watchOS 6.2, *) { + do { + let err = SKError(.paymentCancelled) + XCTAssertTrue(err.isCancelled) + throw err + } catch { + XCTAssertTrue(error.isCancelled) + } + + XCTAssertFalse(SKError(.clientInvalid).isCancelled) } - - XCTAssertFalse(SKError(.clientInvalid).isCancelled) - #endif } diff --git a/Tests/JS-A+/AllTests.swift b/Tests/JS-A+/AllTests.swift index a1fd6445e..3b3f74877 100644 --- a/Tests/JS-A+/AllTests.swift +++ b/Tests/JS-A+/AllTests.swift @@ -5,7 +5,7 @@ // Created by Lois Di Qual on 2/28/18. // -#if swift(>=3.2) +#if swift(>=3.2) && !os(watchOS) import XCTest import PromiseKit diff --git a/Tests/JS-A+/JSAdapter.swift b/Tests/JS-A+/JSAdapter.swift index 6dcbe74c6..527064e16 100644 --- a/Tests/JS-A+/JSAdapter.swift +++ b/Tests/JS-A+/JSAdapter.swift @@ -5,6 +5,8 @@ // Created by Lois Di Qual on 3/2/18. // +#if !os(watchOS) + import Foundation import JavaScriptCore import PromiseKit @@ -51,3 +53,5 @@ enum JSAdapter { return object } } + +#endif diff --git a/Tests/JS-A+/JSPromise.swift b/Tests/JS-A+/JSPromise.swift index 70381fd86..041ddc675 100644 --- a/Tests/JS-A+/JSPromise.swift +++ b/Tests/JS-A+/JSPromise.swift @@ -5,6 +5,8 @@ // Created by Lois Di Qual on 3/1/18. // +#if !os(watchOS) + import Foundation import XCTest import PromiseKit @@ -92,3 +94,5 @@ class JSPromise: NSObject, JSPromiseProtocol { return JSPromise(promise: newPromise) } } + +#endif diff --git a/Tests/JS-A+/JSUtils.swift b/Tests/JS-A+/JSUtils.swift index d08a44b49..10e1a52f5 100644 --- a/Tests/JS-A+/JSUtils.swift +++ b/Tests/JS-A+/JSUtils.swift @@ -5,6 +5,8 @@ // Created by Lois Di Qual on 3/2/18. // +#if !os(watchOS) + import Foundation import JavaScriptCore @@ -114,3 +116,5 @@ extension String { } } #endif + +#endif diff --git a/Tests/JS-A+/MockNodeEnvironment.swift b/Tests/JS-A+/MockNodeEnvironment.swift index 82808fe51..3bfc339f4 100644 --- a/Tests/JS-A+/MockNodeEnvironment.swift +++ b/Tests/JS-A+/MockNodeEnvironment.swift @@ -5,7 +5,7 @@ // Created by Lois Di Qual on 3/1/18. // -#if swift(>=3.2) +#if swift(>=3.2) && !os(watchOS) import Foundation import JavaScriptCore