Skip to content

Allow running WordPressTests standalone via the Keystone scheme #24537

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

Draft
wants to merge 14 commits into
base: trunk
Choose a base branch
from
Draft
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
17 changes: 17 additions & 0 deletions .buildkite/commands/run-unit-tests-for-scheme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -euo pipefail

SCHEME="${1:?Usage $0 SCHEME}"
DEVICE="iPhone 16"
OS_VERSION="18.4"

if "$(dirname "${BASH_SOURCE[0]}")/should-skip-job.sh" --job-type validation; then
exit 0
fi

$(dirname "${BASH_SOURCE[0]}")/shared-set-up.sh

xcodebuild \
-scheme "${SCHEME}" \
-destination "platform=iOS Simulator,OS=${OS_VERSION},name=${DEVICE}" \
test \
| xcbeautify
24 changes: 2 additions & 22 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,35 +111,15 @@ steps:
- github_commit_status:
context: "Reader Unit Tests"
- label: "🔬 Keystone Unit Tests"
command: |
if .buildkite/commands/should-skip-job.sh --job-type validation; then
exit 0
fi

.buildkite/commands/shared-set-up.sh
xcodebuild \
-scheme Keystone \
-destination 'platform=iOS Simulator,OS=18.2,name=iPhone 16' \
test \
| xcbeautify
command: .buildkite/commands/run-unit-tests-for-scheme.sh Keystone
plugins: [$CI_TOOLKIT_PLUGIN]
artifact_paths:
- "build/results/*"
notify:
- github_commit_status:
context: "Unit Tests Keystone"
- label: "🔬 WordPressData Unit Tests"
command: |
if .buildkite/commands/should-skip-job.sh --job-type validation; then
exit 0
fi

.buildkite/commands/shared-set-up.sh
xcodebuild \
-scheme WordPressData \
-destination 'platform=iOS Simulator,OS=18.2,name=iPhone 16' \
test \
| xcbeautify
command: .buildkite/commands/run-unit-tests-for-scheme.sh WordPressData
plugins: [$CI_TOOLKIT_PLUGIN]
artifact_paths:
- "build/results/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,3 @@ private func makeTags(from tags: String) -> [String] {
.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
.filter { !$0.isEmpty }
}

public extension RemotePostUpdateParameters {

var isEmpty: Bool {
self == RemotePostUpdateParameters()
}

/// Returns a diff between the original and the latest revision with the
/// changes applied on top.
static func changes(from original: AbstractPost, to latest: AbstractPost, with changes: RemotePostUpdateParameters? = nil) -> RemotePostUpdateParameters {
guard original !== latest else {
return changes ?? RemotePostUpdateParameters()
}
let parametersOriginal = RemotePostCreateParameters(post: original)
var parametersLatest = RemotePostCreateParameters(post: latest)
if let changes {
parametersLatest.apply(changes)
}
return parametersLatest.changes(from: parametersOriginal)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import WordPressKit

public extension RemotePostUpdateParameters {

var isEmpty: Bool {
self == RemotePostUpdateParameters()
}

/// Returns a diff between the original and the latest revision with the
/// changes applied on top.
static func changes(from original: AbstractPost, to latest: AbstractPost, with changes: RemotePostUpdateParameters? = nil) -> RemotePostUpdateParameters {
guard original !== latest else {
return changes ?? RemotePostUpdateParameters()
}
let parametersOriginal = RemotePostCreateParameters(post: original)
var parametersLatest = RemotePostCreateParameters(post: latest)
if let changes {
parametersLatest.apply(changes)
}
return parametersLatest.changes(from: parametersOriginal)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Combine
import UIKit
import SwiftUI
import WordPressData
import WordPressUI

final class ReaderTabViewController: UITabBarController, UITabBarControllerDelegate {
Expand Down
5 changes: 0 additions & 5 deletions WordPress/Classes/Categories/Media+Extensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
#import "MediaService.h"
@import WordPressData;
@import WordPressShared;
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif

@implementation Media (Extensions)

- (NSError *)errorWithMessage:(NSString *)errorMessage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import WordPressData
import WordPressKit
import Gutenberg

Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/AccountService.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@import WordPressData;

NS_ASSUME_NONNULL_BEGIN

@class WPAccount;
@class RemoteUser;
@protocol CoreDataStack;

extern NSNotificationName const WPAccountEmailAndDefaultBlogUpdatedNotification;

Expand Down
5 changes: 0 additions & 5 deletions WordPress/Classes/Services/AccountService.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
@import WordPressKit;
@import WordPressShared;

#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif

NSString * const WPAccountEmailAndDefaultBlogUpdatedNotification = @"WPAccountEmailAndDefaultBlogUpdatedNotification";

@implementation AccountService
Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/Services/BlogService.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#import <Foundation/Foundation.h>
@import WordPressData;

NS_ASSUME_NONNULL_BEGIN

extern NSString *const WordPressMinimumVersion;
extern NSString *const WPBlogUpdatedNotification;
extern NSString *const WPBlogSettingsUpdatedNotification;

@class Blog;
@class WPAccount;
@class SiteInfo;
@protocol CoreDataStack;

@interface BlogService : NSObject

Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/BlogService.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
#import "WPError.h"
#import "PostCategoryService.h"
#import "CommentService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
@import WordPressData;
@import WordPressKit;
@import WordPressShared;
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/CommentService.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#import <Foundation/Foundation.h>
#import <WordPressKit/WordPressKit.h>
@import WordPressData;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -12,6 +11,7 @@ extern NSUInteger const WPTopLevelHierarchicalCommentsPerPage;
@class BasePost;
@class RemoteUser;
@class CommentServiceRemoteFactory;
@protocol CoreDataStack;

@interface CommentService : NSObject

Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/CommentService.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#import "CommentService.h"
#import "AccountService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
@import WordPressData;

@import WordPressShared;
Expand Down
8 changes: 1 addition & 7 deletions WordPress/Classes/Services/Facades/BlogSyncFacade.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@
#import "BlogService.h"
#import "AccountService.h"
#import "WPAppAnalytics.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
// For some reason, the modular import does not work.
// @import WordPressData;
#import <WordPressData/WordPressData.h>
@import WordPressData;

@import WordPressShared;
@import NSObject_SafeExpectations;
Expand Down
2 changes: 0 additions & 2 deletions WordPress/Classes/Services/MediaService.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

@class Media;
@class RemoteVideoPressVideo;
@class Blog;
@class AbstractPost;
@protocol ExportableAsset;

extern NSErrorDomain _Nonnull const MediaServiceErrorDomain;
Expand Down
5 changes: 0 additions & 5 deletions WordPress/Classes/Services/MediaService.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#import "MediaService.h"
#import <MobileCoreServices/MobileCoreServices.h>
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif

@import WordPressData;
@import WordPressKit;
@import WordPressUI;
Expand Down
5 changes: 0 additions & 5 deletions WordPress/Classes/Services/MenusService.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

NS_ASSUME_NONNULL_BEGIN

@class Blog;
@class Menu;
@class MenuLocation;
@class MenuItem;

typedef void(^MenusServiceSuccessBlock)(void);
typedef void(^MenusServiceCreateOrUpdateMenuRequestSuccessBlock)(void);
typedef void(^MenusServiceMenusRequestSuccessBlock)(NSArray<Menu *> * _Nullable menus);
Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/MenusService.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#import "MenusService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
@import WordPressData;
@import WordPressKit;

Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/Services/PostCategoryService.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@import CoreData;
#import <Foundation/Foundation.h>
@import WordPressData;

NS_ASSUME_NONNULL_BEGIN

@class Blog;
@class PostCategory;
@protocol CoreDataStack;

typedef NS_ENUM(NSInteger, PostCategoryServiceErrors) {
PostCategoryServiceErrorsBlogNotFound
Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/PostCategoryService.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#import "PostCategoryService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
@import WordPressData;
@import WordPressKit;

Expand Down
3 changes: 0 additions & 3 deletions WordPress/Classes/Services/PostTagService.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

NS_ASSUME_NONNULL_BEGIN

@class Blog;
@class PostTag;

@interface PostTagService : LocalCoreDataService

/**
Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/PostTagService.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#import "PostTagService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
@import WordPressData;
@import WordPressKit;

Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/Services/Reader Post/ReaderPostService.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@import CoreData;
#import <Foundation/Foundation.h>
@import WordPressData;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"

@class ReaderPost;
@class ReaderAbstractTopic;
@class WordPressComRestApi;
@protocol CoreDataStack;

extern NSString * const ReaderPostServiceErrorDomain;
extern NSString * const ReaderPostServiceToggleSiteFollowingState;
Expand Down
5 changes: 0 additions & 5 deletions WordPress/Classes/Services/Reader Post/ReaderPostService.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
#import "ReaderGapMarker.h"
#import "ReaderSiteService.h"
#import "WPAppAnalytics.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif

@import WordPressData;
@import WordPressKit;
@import WordPressShared;
Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/Services/ReaderSiteService.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
@import WordPressData;

@protocol CoreDataStack;

NS_ASSUME_NONNULL_BEGIN

Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/ReaderSiteService.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

#import "AccountService.h"
#import "ReaderPostService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
#import "WPAppAnalytics.h"
@import WordPressData;
@import WordPressKit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import WordPressData
import WordPressKit
import WordPressShared

Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/Services/ReaderTopicService.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import CoreData;
#import <Foundation/Foundation.h>
@import WordPressData;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -9,6 +9,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
@class ReaderTagTopic;
@class ReaderSiteTopic;
@class ReaderSearchTopic;
@protocol CoreDataStack;

@interface ReaderTopicService : NSObject

Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Services/ReaderTopicService.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#import "ReaderTopicService.h"
#import "AccountService.h"
#import "ReaderPostService.h"
#ifdef KEYSTONE
#import "Keystone-Swift.h"
#else
#import "WordPress-Swift.h"
#endif
@import WordPressData;
@import WordPressKit;
@import WordPressShared;
Expand Down
Loading