Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Skip Apple Silicon supporting flow on Linux platform. #197

Merged
merged 3 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request: {}

jobs:
build:
macOS:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -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
2 changes: 2 additions & 0 deletions Sources/MintKit/ProcessInfoExtensions.swift
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -14,4 +15,5 @@ extension ProcessInfo {
guard let identifier = String(bytes: data, encoding: .ascii) else { return nil }
return identifier.trimmingCharacters(in: .controlCharacters)
}
#endif
}
4 changes: 4 additions & 0 deletions Tests/MintTests/ProcessInfoExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -13,4 +15,6 @@ final class ProcessInfoExtensionTests: XCTestCase {
XCTAssertEqual(ProcessInfo.processInfo.machineHardwareName, "arm64")
}
#endif

#endif
}