diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 06aae63..c1dbf29 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -5,7 +5,7 @@ on: pull_request: {} jobs: - build: + macOS: runs-on: macOS-latest steps: - uses: actions/checkout@v2 @@ -15,3 +15,14 @@ jobs: run: swift build - name: Run tests run: swift test 2>&1 | xcpretty + linux: + runs-on: ubuntu-latest + container: swift:5.2 + steps: + - uses: actions/checkout@v2 + - name: Resolve + run: swift package resolve + - name: Build + run: swift build + - name: Run tests + run: swift test 2>&1 diff --git a/Sources/MintKit/ProcessInfoExtensions.swift b/Sources/MintKit/ProcessInfoExtensions.swift index d762fd1..fcbfa7f 100644 --- a/Sources/MintKit/ProcessInfoExtensions.swift +++ b/Sources/MintKit/ProcessInfoExtensions.swift @@ -1,6 +1,7 @@ import Foundation extension ProcessInfo { + #if os(macOS) /// Returns a `String` representing the machine hardware name or nil if there was an error invoking `uname(_:)` or decoding the response. /// /// Return value is the equivalent to running `$ uname -m` in shell. @@ -14,4 +15,5 @@ extension ProcessInfo { guard let identifier = String(bytes: data, encoding: .ascii) else { return nil } return identifier.trimmingCharacters(in: .controlCharacters) } + #endif } diff --git a/Tests/MintTests/ProcessInfoExtensionTests.swift b/Tests/MintTests/ProcessInfoExtensionTests.swift index 5b4c56a..72c1181 100644 --- a/Tests/MintTests/ProcessInfoExtensionTests.swift +++ b/Tests/MintTests/ProcessInfoExtensionTests.swift @@ -2,6 +2,8 @@ import XCTest final class ProcessInfoExtensionTests: XCTestCase { + #if os(macOS) + #if arch(x86_64) func testMachineHardwareName_Intel() { XCTAssertEqual(ProcessInfo.processInfo.machineHardwareName, "x86_64") @@ -13,4 +15,6 @@ final class ProcessInfoExtensionTests: XCTestCase { XCTAssertEqual(ProcessInfo.processInfo.machineHardwareName, "arm64") } #endif + + #endif }