Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Modernize CI #300

Merged
merged 19 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
58 changes: 52 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- master
pull_request:

concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
dfed marked this conversation as resolved.
Show resolved Hide resolved

jobs:
xcode-build-12:
name: Xcode 12 Build
Expand All @@ -19,7 +23,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -42,7 +46,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -52,12 +56,33 @@ jobs:
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
xcode-build-14:
name: Xcode 14 Build
runs-on: macOS-13
strategy:
matrix:
platforms: [
'iOS_16,tvOS_16,watchOS_9',
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
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
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
pod-lint:
name: Pod Lint
runs-on: macOS-11
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -69,7 +94,7 @@ jobs:
runs-on: macOS-11
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -92,7 +117,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand Down Expand Up @@ -123,7 +148,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
jshier marked this conversation as resolved.
Show resolved Hide resolved
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -132,3 +157,24 @@ jobs:
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build Framework
run: Scripts/build.swift ${{ matrix.platforms }} spm
spm-13:
name: SPM Build macOS 13
runs-on: macOS-13
strategy:
matrix:
platforms: [
'iOS_16,tvOS_16,watchOS_9',
'macOS_13',
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
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
run: Scripts/build.swift ${{ matrix.platforms }} spm
70 changes: 59 additions & 11 deletions Scripts/build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@ 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_10_15
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 {
Expand All @@ -42,17 +50,27 @@ enum Platform: String, CustomStringConvertible {
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.0,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.0,name=Apple TV"

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

case .watchOS_6:
Expand All @@ -61,19 +79,27 @@ enum Platform: String, CustomStringConvertible {
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"
case .watchOS_10:
return "OS=10.0,name=Apple Watch Series 6 - 44mm"
}
}

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

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

case .macOS_10_15:
Expand All @@ -82,10 +108,16 @@ enum Platform: String, CustomStringConvertible {
return "macosx11.1"
case .macOS_12:
return "macosx12.3"
case .macOS_13:
return "macosx13.3"
case .macOS_14:
return "macosx14.0"

case .watchOS_6,
.watchOS_7,
.watchOS_8:
.watchOS_8,
.watchOS_9,
.watchOS_10:
return "watchsimulator"
}
}
Expand All @@ -95,17 +127,25 @@ enum Platform: String, CustomStringConvertible {
case .iOS_13,
.iOS_14,
.iOS_15,
.iOS_16,
.iOS_17,
.tvOS_13,
.tvOS_14,
.tvOS_15,
.tvOS_16,
.tvOS_17,
.macOS_10_15,
.macOS_11,
.macOS_12:
.macOS_12,
.macOS_13,
.macOS_14:
return true

case .watchOS_6,
.watchOS_7,
.watchOS_8:
.watchOS_8,
.watchOS_9,
.watchOS_10:
// watchOS does not support unit testing (yet?).
return false
}
Expand All @@ -119,22 +159,30 @@ enum Platform: String, CustomStringConvertible {
switch self {
case .iOS_13,
.iOS_14,
.iOS_15:
.iOS_15,
.iOS_16,
.iOS_17:
return "Valet iOS"

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

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

case .watchOS_6,
.watchOS_7,
.watchOS_8:
.watchOS_8,
.watchOS_9,
.watchOS_10:
return "Valet watchOS"
}
}
Expand Down Expand Up @@ -203,7 +251,7 @@ enum Task: String, CustomStringConvertible {
func shouldTest(on platform: Platform) -> Bool {
switch self {
case .spm:
// Our Package isn't set up with unit test targets, becuase SPM can't run unit tests in a codesigned environment.
// Our Package isn't set up with unit test targets, because SPM can't run unit tests in a codesigned environment.
dfed marked this conversation as resolved.
Show resolved Hide resolved
return false
case .xcode:
return platform.shouldTest
Expand Down
3 changes: 3 additions & 0 deletions Sources/LegacyValet/VALLegacySecureEnclaveValet.m
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ - (BOOL)containsObjectForKey:(nonnull NSString *)key;
return keyAlreadyInKeychain;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreturn-type"
- (nonnull NSSet *)allKeys;
{
VALCheckCondition(NO, [NSSet new], @"%s is not supported on %@", __PRETTY_FUNCTION__, NSStringFromClass([self class]));
Expand All @@ -273,6 +275,7 @@ - (BOOL)removeAllObjects;
{
VALCheckCondition(NO, NO, @"%s is not supported on %@", __PRETTY_FUNCTION__, NSStringFromClass([self class]));
}
#pragma clang diagnostic pop
dfed marked this conversation as resolved.
Show resolved Hide resolved

- (nullable NSError *)migrateObjectsMatchingQuery:(nonnull NSDictionary *)secItemQuery removeOnCompletion:(BOOL)remove;
{
Expand Down
12 changes: 11 additions & 1 deletion Tests/ValetIntegrationTests/ValetIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import XCTest
/// - The Valet Mac Tests target is left without a host app on master. Mac test host app signing requires CI to have the Developer team credentials down in keychain, which we can't easily accomplish.
/// - Note: In order to test changes locally, set the Valet Mac Tests host to Valet macOS Test Host App, delete all VAL_* keychain items in your keychain via Keychain Access.app, and run Mac tests.
func testEnvironmentIsSigned() -> Bool {
#if targetEnvironment(simulator)
if #available(iOS 16, tvOS 16, macOS 13, watchOS 9, *) {
jshier marked this conversation as resolved.
Show resolved Hide resolved
return false
}
#endif

// Our test host apps for iOS and Mac are both signed, so testing for a custom bundle identifier is analogous to testing signing.
guard Bundle.main.bundleIdentifier != nil && Bundle.main.bundleIdentifier != "com.apple.dt.xctest.tool" else {
#if os(iOS) || os(tvOS)
Expand All @@ -42,8 +48,12 @@ func testEnvironmentSupportsWhenPasscodeSet() -> Bool {
|| simulatorVersionInfo.contains("tvOS 13")
|| simulatorVersionInfo.contains("iOS 15")
|| simulatorVersionInfo.contains("tvOS 15")
|| simulatorVersionInfo.contains("iOS 16")
|| simulatorVersionInfo.contains("tvOS 16")
|| simulatorVersionInfo.contains("iOS 17")
|| simulatorVersionInfo.contains("tvOS 17")
{
// iOS 13, tvOS 13, iOS 15, and tvOS 15 simulators fail to store items in a Valet that has a
// iOS 13, tvOS 13, iOS 15, tvOS 15, and later simulators fail to store items in a Valet that has a
jshier marked this conversation as resolved.
Show resolved Hide resolved
// kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly flag. The documentation for this flag says:
// "No items can be stored in this class on devices without a passcode". I currently do not
// understand why prior simulators work with this flag, given that no simulators have a passcode.
Expand Down
26 changes: 11 additions & 15 deletions Valet.xcodeproj/xcshareddata/xcschemes/Valet iOS.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "26E6827B1BA8B3F900EFF4EA"
BuildableName = "Valet.framework"
BlueprintName = "Valet iOS"
ReferencedContainer = "container:Valet.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -40,17 +49,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "26E6827B1BA8B3F900EFF4EA"
BuildableName = "Valet.framework"
BlueprintName = "Valet iOS"
ReferencedContainer = "container:Valet.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -71,8 +69,6 @@
ReferencedContainer = "container:Valet.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Loading