Skip to content

Commit

Permalink
Merge a292670 into e1738b5
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed authored Apr 23, 2024
2 parents e1738b5 + a292670 commit dc12a92
Show file tree
Hide file tree
Showing 18 changed files with 638 additions and 479 deletions.
75 changes: 26 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ concurrency:
cancel-in-progress: true

jobs:
xcode-build-12:
name: Xcode 12 Build
runs-on: macOS-11
xcode-build-13:
name: Xcode 13 Build
runs-on: macOS-12
strategy:
matrix:
platforms: [
'iOS_14,tvOS_14,watchOS_7',
'iOS_13,tvOS_13,watchOS_6',
'iOS_15',
'tvOS_15',
]
fail-fast: false
timeout-minutes: 30
Expand All @@ -28,21 +28,21 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app/Contents/Developer
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
run: sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }} xcode
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
xcode-build-13:
name: Xcode 13 Build
runs-on: macOS-12
xcode-build-14:
name: Xcode 14 Build
runs-on: macOS-14
strategy:
matrix:
platforms: [
'iOS_15,tvOS_15,watchOS_8',
'iOS_16',
'tvOS_16',
'watchOS_9',
]
fail-fast: false
timeout-minutes: 30
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }} xcode
- name: Upload Coverage Reports
Expand All @@ -64,8 +64,9 @@ jobs:
strategy:
matrix:
platforms: [
'iOS_16,tvOS_16,watchOS_9',
'iOS_17,tvOS_17,watchOS_10',
'iOS_17',
'tvOS_17',
'watchOS_10',
]
fail-fast: false
timeout-minutes: 30
Expand Down Expand Up @@ -109,43 +110,15 @@ jobs:
run: brew outdated carthage || brew upgrade carthage
- name: Build Framework
run: carthage build --verbose --no-skip-current --use-xcframeworks
spm-11:
name: SPM Build macOS 11
runs-on: macOS-11
timeout-minutes: 30
strategy:
matrix:
platforms: [
'iOS_14,tvOS_14,watchOS_7',
'iOS_13,tvOS_13,watchOS_6',
'macOS_11',
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app/Contents/Developer
if: ${{ matrix.platforms == 'iOS_14,tvOS_14,watchOS_7' }}
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app/Contents/Developer
if: ${{ matrix.platforms == 'iOS_13,tvOS_13,watchOS_6' }}
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_12.5.1.app/Contents/Developer
if: ${{ matrix.platforms == 'macOS_11' }}
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build Framework
run: Scripts/build.swift ${{ matrix.platforms }} spm
spm-12:
name: SPM Build macOS 12
runs-on: macOS-12
strategy:
matrix:
platforms: [
'iOS_15,tvOS_15,watchOS_8',
'iOS_15',
'tvOS_15',
'watchOS_8',
'macOS_12',
]
fail-fast: false
Expand All @@ -167,7 +140,9 @@ jobs:
strategy:
matrix:
platforms: [
'iOS_16,tvOS_16,watchOS_9',
'iOS_16',
'tvOS_16',
'watchOS_9',
'macOS_13',
]
fail-fast: false
Expand All @@ -178,7 +153,7 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_14.3.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build Framework
Expand All @@ -189,7 +164,9 @@ jobs:
strategy:
matrix:
platforms: [
'iOS_17,tvOS_17,watchOS_10',
'iOS_17',
'tvOS_17',
'watchOS_10',
'macOS_14',
]
fail-fast: false
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "Tests/xctest-watchOS"]
path = Tests/XCTest-watchOS
url = https://github.com/dfed/XCTest-watchOS.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Valet guarantees that reading and writing operations will succeed as long as wri
## Requirements
* Xcode 12.5 or later.
* Xcode 13.0 or later.
* iOS 9 or later.
* tvOS 9 or later.
* watchOS 2 or later.
Expand Down
103 changes: 18 additions & 85 deletions Scripts/build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,131 +21,75 @@ enum TaskError: Error {
}

enum Platform: String, CustomStringConvertible {
case iOS_13
case iOS_14
case iOS_15
case iOS_16
case iOS_17
case tvOS_13
case tvOS_14
case tvOS_15
case tvOS_16
case tvOS_17
case macOS_11
case macOS_12
case macOS_13
case macOS_14
case watchOS_6
case watchOS_7
case watchOS_8
case watchOS_9
case watchOS_10

var destination: String {
switch self {
case .iOS_13:
return "platform=iOS Simulator,OS=13.7,name=iPad Pro (12.9-inch) (4th generation)"
case .iOS_14:
return "platform=iOS Simulator,OS=14.4,name=iPad Pro (12.9-inch) (4th generation)"
case .iOS_15:
return "platform=iOS Simulator,OS=15.5,name=iPad Pro (12.9-inch) (5th generation)"
case .iOS_16:
return "platform=iOS Simulator,OS=16.4,name=iPad Pro (12.9-inch) (6th generation)"
case .iOS_17:
return "platform=iOS Simulator,OS=17.4,name=iPad Pro (12.9-inch) (6th generation)"

case .tvOS_13:
return "platform=tvOS Simulator,OS=13.4,name=Apple TV"
case .tvOS_14:
return "platform=tvOS Simulator,OS=14.3,name=Apple TV"
case .tvOS_15:
return "platform=tvOS Simulator,OS=15.4,name=Apple TV"
case .tvOS_16:
return "platform=tvOS Simulator,OS=16.4,name=Apple TV"
case .tvOS_17:
return "platform=tvOS Simulator,OS=17.4,name=Apple TV"

case .macOS_11,
.macOS_12,
case .macOS_12,
.macOS_13,
.macOS_14:
return "platform=OS X"

case .watchOS_6:
return "OS=6.2.1,name=Apple Watch Series 4 - 44mm"
case .watchOS_7:
return "OS=7.2,name=Apple Watch Series 6 - 44mm"
case .watchOS_8:
return "OS=8.5,name=Apple Watch Series 6 - 44mm"
case .watchOS_9:
return "OS=9.4,name=Apple Watch Series 6 - 44mm"
return "OS=9.4,name=Apple Watch Series 6 (44mm)"
case .watchOS_10:
return "OS=10.4,name=Apple Watch Series 6 - 44mm"
return "OS=10.4,name=Apple Watch Series 9 (45mm)"
}
}

var sdk: String {
switch self {
case .iOS_13,
.iOS_14,
.iOS_15,
case .iOS_15,
.iOS_16,
.iOS_17:
return "iphonesimulator"

case .tvOS_13,
.tvOS_14,
.tvOS_15,
case .tvOS_15,
.tvOS_16,
.tvOS_17:
return "appletvsimulator"

case .macOS_11:
return "macosx11.1"
case .macOS_12:
return "macosx12.3"
case .macOS_13:
return "macosx13.3"
case .macOS_14:
return "macosx14.0"
return "macosx14.4"

case .watchOS_6,
.watchOS_7,
.watchOS_8,
case .watchOS_8,
.watchOS_9,
.watchOS_10:
return "watchsimulator"
}
}

var shouldTest: Bool {
switch self {
case .iOS_13,
.iOS_14,
.iOS_15,
.iOS_16,
.iOS_17,
.tvOS_13,
.tvOS_14,
.tvOS_15,
.tvOS_16,
.tvOS_17,
.macOS_11,
.macOS_12,
.macOS_13,
.macOS_14:
return true

case .watchOS_6,
.watchOS_7,
.watchOS_8,
.watchOS_9,
.watchOS_10:
// watchOS does not support unit testing (yet?).
return false
}
}

/// Whether the platform's Xcode version requires modern SPM integration in xcodebuild, given the removal of generate-xcodeproj.
var requiresModernSPMIntegration: Bool {
switch self {
Expand All @@ -163,29 +107,22 @@ enum Platform: String, CustomStringConvertible {

var scheme: String {
switch self {
case .iOS_13,
.iOS_14,
.iOS_15,
case .iOS_15,
.iOS_16,
.iOS_17:
return "Valet iOS"

case .tvOS_13,
.tvOS_14,
.tvOS_15,
case .tvOS_15,
.tvOS_16,
.tvOS_17:
return "Valet tvOS"

case .macOS_11,
.macOS_12,
case .macOS_12,
.macOS_13,
.macOS_14:
return "Valet Mac"

case .watchOS_6,
.watchOS_7,
.watchOS_8,
case .watchOS_8,
.watchOS_9,
.watchOS_10:
return "Valet watchOS"
Expand Down Expand Up @@ -271,27 +208,27 @@ enum Task: String, CustomStringConvertible {
// Our Package isn't set up with unit test targets, because SPM can't run unit tests in a codesigned environment.
return false
case .xcode:
return platform.shouldTest
return true
}
}
}

guard CommandLine.arguments.count > 2 else {
print("Usage: build.swift platforms [spm|xcode]")
exit(0)
throw TaskError.code(1)
}
let rawPlatforms = CommandLine.arguments[1].components(separatedBy: ",")
let rawTask = CommandLine.arguments[2]

guard let task = Task(rawValue: rawTask) else {
print("Received unknown task \(rawTask)")
exit(0)
throw TaskError.code(1)
}

let platforms = rawPlatforms.map { rawPlatform -> Platform in
let platforms = try rawPlatforms.map { rawPlatform -> Platform in
guard let platform = Platform(rawValue: rawPlatform) else {
print("Received unknown platform type \(rawPlatform)")
exit(0)
throw TaskError.code(1)
}

return platform
Expand All @@ -315,7 +252,7 @@ for platform in platforms {
deletedXcodeproj = true
} catch {
print("Could not delete Valet.xcodeproj due to error: \(error)")
exit(0)
throw TaskError.code(1)
}
}

Expand Down Expand Up @@ -349,11 +286,7 @@ for platform in platforms {
xcodeBuildArguments.append("test")
}

do {
try execute(commandPath: "/usr/bin/xcodebuild", arguments: xcodeBuildArguments)
} catch {
print("xcodebuild failed with error: \(error)")
}
try execute(commandPath: "/usr/bin/xcodebuild", arguments: xcodeBuildArguments)

if deletedXcodeproj {
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SecureEnclaveIntegrationTests: XCTestCase

func test_secureEnclaveSharedGroupValetsWithDifferingIdentifiers_canNotAccessSameData() throws
{
guard testEnvironmentIsSigned() && testEnvironmentSupportsWhenPasscodeSet() else {
guard testEnvironmentIsSignedOrDoesNotRequireEntitlement() && testEnvironmentSupportsWhenPasscodeSet() else {
return
}

Expand Down
Loading

0 comments on commit dc12a92

Please sign in to comment.