From 2d63f44179bf9b997ba70881e6e446898e54e8cb Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 2 Nov 2020 01:32:14 +0900 Subject: [PATCH 1/3] add test workflow in linux platform --- .github/workflows/swift.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 From 7eb995bfd22e8b5899d204c70096b24122d60f05 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 2 Nov 2020 01:25:03 +0900 Subject: [PATCH 2/3] make `ProcessInfo.machineHardwareName` only available on macOS platform --- Sources/MintKit/ProcessInfoExtensions.swift | 2 ++ 1 file changed, 2 insertions(+) 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 } From cfc5e1bbdae02bc2c6d5102775ab141eecb6c51d Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 2 Nov 2020 01:31:44 +0900 Subject: [PATCH 3/3] make tests also --- Tests/MintTests/ProcessInfoExtensionTests.swift | 4 ++++ 1 file changed, 4 insertions(+) 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 }