mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 11:33:13 +00:00
Merge pull request #509 from GreyTeardrop/apple-silicon-github-hosted-runner
Apple silicon GitHub hosted runner
This commit is contained in:
commit
ec503a13e9
16 changed files with 30 additions and 29 deletions
9
.github/workflows/build-test.yml
vendored
9
.github/workflows/build-test.yml
vendored
|
@ -28,13 +28,10 @@ jobs:
|
||||||
|
|
||||||
name: Build, Test, and Lint
|
name: Build, Test, and Lint
|
||||||
|
|
||||||
# GitHub provided runners (in case we need to switch back)
|
# https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source
|
||||||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
|
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
|
||||||
# runs-on: macos-latest
|
# https://github.com/mas-cli/mas/actions/runners
|
||||||
|
runs-on: macos-14
|
||||||
# https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow
|
|
||||||
# https://github.com/mas-cli/mas/settings/actions/runners
|
|
||||||
runs-on: [self-hosted, macOS]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# https://github.com/actions/checkout#usage
|
# https://github.com/actions/checkout#usage
|
||||||
|
|
|
@ -71,7 +71,11 @@ let package = Package(
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://github.com/apple/swift-format#matching-swift-format-to-your-swift-version-swift-57-and-earlier
|
// https://github.com/apple/swift-format#matching-swift-format-to-your-swift-version-swift-57-and-earlier
|
||||||
#if compiler(>=5.7)
|
#if compiler(>=5.8)
|
||||||
|
package.dependencies += [
|
||||||
|
.package(url: "https://github.com/apple/swift-format", .branch("release/5.9"))
|
||||||
|
]
|
||||||
|
#elseif compiler(>=5.7)
|
||||||
package.dependencies += [
|
package.dependencies += [
|
||||||
.package(url: "https://github.com/apple/swift-format", .branch("release/5.7"))
|
.package(url: "https://github.com/apple/swift-format", .branch("release/5.7"))
|
||||||
]
|
]
|
||||||
|
|
|
@ -81,12 +81,12 @@ private func download(_ appID: UInt64, purchase: Bool = false) -> Promise<Void>
|
||||||
return Promise<SSPurchase> { seal in
|
return Promise<SSPurchase> { seal in
|
||||||
let purchase = SSPurchase(adamId: appID, account: storeAccount, purchase: purchase)
|
let purchase = SSPurchase(adamId: appID, account: storeAccount, purchase: purchase)
|
||||||
purchase.perform { purchase, _, error, response in
|
purchase.perform { purchase, _, error, response in
|
||||||
if let error = error {
|
if let error {
|
||||||
seal.reject(MASError.purchaseFailed(error: error as NSError?))
|
seal.reject(MASError.purchaseFailed(error: error as NSError?))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
guard response?.downloads.isEmpty == false, let purchase = purchase else {
|
guard response?.downloads.isEmpty == false, let purchase else {
|
||||||
print("No downloads")
|
print("No downloads")
|
||||||
seal.reject(MASError.noDownloads)
|
seal.reject(MASError.noDownloads)
|
||||||
return
|
return
|
||||||
|
|
|
@ -41,7 +41,7 @@ extension SSPurchase {
|
||||||
|
|
||||||
itemIdentifier = adamId
|
itemIdentifier = adamId
|
||||||
|
|
||||||
if let account = account {
|
if let account {
|
||||||
accountIdentifier = account.dsID
|
accountIdentifier = account.dsID
|
||||||
appleID = account.identifier
|
appleID = account.identifier
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public struct OutdatedCommand: CommandProtocol {
|
||||||
firstly {
|
firstly {
|
||||||
storeSearch.lookup(app: installedApp.itemIdentifier.intValue)
|
storeSearch.lookup(app: installedApp.itemIdentifier.intValue)
|
||||||
}.done { storeApp in
|
}.done { storeApp in
|
||||||
guard let storeApp = storeApp else {
|
guard let storeApp else {
|
||||||
if options.verbose {
|
if options.verbose {
|
||||||
printWarning(
|
printWarning(
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Upgrade.swift
|
// Uninstall.swift
|
||||||
// mas-cli
|
// mas-cli
|
||||||
//
|
//
|
||||||
// Created by Ben Chatelain on 2018-12-27.
|
// Created by Ben Chatelain on 2018-12-27.
|
||||||
|
|
|
@ -76,7 +76,7 @@ class MasStoreSearch: StoreSearch {
|
||||||
return firstly {
|
return firstly {
|
||||||
self.scrapeVersionFromPage(pageUrl)
|
self.scrapeVersionFromPage(pageUrl)
|
||||||
}.done { pageVersion in
|
}.done { pageVersion in
|
||||||
if let pageVersion = pageVersion, pageVersion > searchVersion {
|
if let pageVersion, pageVersion > searchVersion {
|
||||||
results[index].version = pageVersion.description
|
results[index].version = pageVersion.description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ extension StoreSearch {
|
||||||
URLQueryItem(name: "term", value: appName),
|
URLQueryItem(name: "term", value: appName),
|
||||||
]
|
]
|
||||||
|
|
||||||
if let country = country {
|
if let country {
|
||||||
components.queryItems!.append(country)
|
components.queryItems!.append(country)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ extension StoreSearch {
|
||||||
|
|
||||||
components.queryItems = [URLQueryItem(name: "id", value: "\(appId)")]
|
components.queryItems = [URLQueryItem(name: "id", value: "\(appId)")]
|
||||||
|
|
||||||
if let country = country {
|
if let country {
|
||||||
components.queryItems!.append(country)
|
components.queryItems!.append(country)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// MAError.swift
|
// MASError.swift
|
||||||
// mas-cli
|
// mas-cli
|
||||||
//
|
//
|
||||||
// Created by Andrew Naylor on 21/08/2015.
|
// Created by Andrew Naylor on 21/08/2015.
|
||||||
|
@ -47,7 +47,7 @@ extension MASError: CustomStringConvertible {
|
||||||
"""
|
"""
|
||||||
|
|
||||||
case .signInFailed(let error):
|
case .signInFailed(let error):
|
||||||
if let error = error {
|
if let error {
|
||||||
return "Sign in failed: \(error.localizedDescription)"
|
return "Sign in failed: \(error.localizedDescription)"
|
||||||
} else {
|
} else {
|
||||||
return "Sign in failed"
|
return "Sign in failed"
|
||||||
|
@ -57,14 +57,14 @@ extension MASError: CustomStringConvertible {
|
||||||
return "Already signed in"
|
return "Already signed in"
|
||||||
|
|
||||||
case .purchaseFailed(let error):
|
case .purchaseFailed(let error):
|
||||||
if let error = error {
|
if let error {
|
||||||
return "Download request failed: \(error.localizedDescription)"
|
return "Download request failed: \(error.localizedDescription)"
|
||||||
} else {
|
} else {
|
||||||
return "Download request failed"
|
return "Download request failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
case .downloadFailed(let error):
|
case .downloadFailed(let error):
|
||||||
if let error = error {
|
if let error {
|
||||||
return "Download failed: \(error.localizedDescription)"
|
return "Download failed: \(error.localizedDescription)"
|
||||||
} else {
|
} else {
|
||||||
return "Download failed"
|
return "Download failed"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Formats text output for the info command.
|
/// Formats text output for the info command.
|
||||||
struct AppInfoFormatter {
|
enum AppInfoFormatter {
|
||||||
/// Formats text output with app info.
|
/// Formats text output with app info.
|
||||||
///
|
///
|
||||||
/// - Parameter app: Search result with app data.
|
/// - Parameter app: Search result with app data.
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Formats text output for the search command.
|
/// Formats text output for the search command.
|
||||||
struct AppListFormatter {
|
enum AppListFormatter {
|
||||||
static let idColumnMinWidth = 10
|
static let idColumnMinWidth = 10
|
||||||
static let nameColumnMinWidth = 50
|
static let nameColumnMinWidth = 50
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Formats text output for the search command.
|
/// Formats text output for the search command.
|
||||||
struct SearchResultFormatter {
|
enum SearchResultFormatter {
|
||||||
/// Formats text output with search results.
|
/// Formats text output with search results.
|
||||||
///
|
///
|
||||||
/// - Parameter results: Search results with app data
|
/// - Parameter results: Search results with app data
|
||||||
|
|
|
@ -43,12 +43,12 @@ let csi = "\u{001B}["
|
||||||
Swift.print(terminator, terminator: "")
|
Swift.print(terminator, terminator: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func print<Target>(
|
func print(
|
||||||
_ items: Any...,
|
_ items: Any...,
|
||||||
separator: String = " ",
|
separator: String = " ",
|
||||||
terminator: String = "\n",
|
terminator: String = "\n",
|
||||||
to output: inout Target
|
to output: inout some TextOutputStream
|
||||||
) where Target: TextOutputStream {
|
) {
|
||||||
if let observer = printObserver {
|
if let observer = printObserver {
|
||||||
let output =
|
let output =
|
||||||
items
|
items
|
||||||
|
|
|
@ -13,9 +13,9 @@ extension URLSession: NetworkSession {
|
||||||
public func loadData(from url: URL) -> Promise<Data> {
|
public func loadData(from url: URL) -> Promise<Data> {
|
||||||
Promise { seal in
|
Promise { seal in
|
||||||
dataTask(with: url) { data, _, error in
|
dataTask(with: url) { data, _, error in
|
||||||
if let data = data {
|
if let data {
|
||||||
seal.fulfill(data)
|
seal.fulfill(data)
|
||||||
} else if let error = error {
|
} else if let error {
|
||||||
seal.reject(error)
|
seal.reject(error)
|
||||||
} else {
|
} else {
|
||||||
seal.reject(MASError.noData)
|
seal.reject(MASError.noData)
|
||||||
|
|
|
@ -24,7 +24,7 @@ class NetworkSessionMock: NetworkSession {
|
||||||
/// - url: unused
|
/// - url: unused
|
||||||
/// - completionHandler: Closure which is delivered either data or an error.
|
/// - completionHandler: Closure which is delivered either data or an error.
|
||||||
func loadData(from _: URL) -> Promise<Data> {
|
func loadData(from _: URL) -> Promise<Data> {
|
||||||
guard let data = data else {
|
guard let data else {
|
||||||
return Promise(error: error ?? MASError.noData)
|
return Promise(error: error ?? MASError.noData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// ResultPreticates.swift
|
// ResultPredicates.swift
|
||||||
// MasKitTests
|
// MasKitTests
|
||||||
//
|
//
|
||||||
// Created by Ben Chatelain on 12/27/18.
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
|
Loading…
Reference in a new issue