From a04b4247cc7cec02ac86914b8bdb6a8bdaf75ca1 Mon Sep 17 00:00:00 2001 From: Hesham Salman Date: Thu, 12 Oct 2023 11:13:08 -0400 Subject: [PATCH] Add Pagination Test Configuration (apollographql/apollo-ios-dev#69) --- .github/workflows/ci-tests.yml | 1 + .../Apollo-Target-PaginationTests.xcconfig | 3 ++ Project.swift | 2 + Tests/ApolloPaginationTests/Info.plist | 22 +++++++++ .../Apollo-PaginationTestPlan.xctestplan | 25 ++++++++++ .../Enums/ApolloTarget.swift | 6 +++ .../Enums/ApolloTestPlan.swift | 3 ++ .../Target+ApolloPaginationTests.swift | 48 +++++++++++++++++++ 8 files changed, 110 insertions(+) create mode 100644 Configuration/Apollo/Apollo-Target-PaginationTests.xcconfig create mode 100644 Tests/ApolloPaginationTests/Info.plist create mode 100644 Tests/TestPlans/Apollo-PaginationTestPlan.xctestplan create mode 100644 Tuist/ProjectDescriptionHelpers/Targets/Target+ApolloPaginationTests.swift diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 34c36942f..589fd9f30 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -17,6 +17,7 @@ jobs: include: - package: apollo-ios - package: apollo-ios-codegen + - package: apollo-ios-pagination name: Run swift build for SPM packages steps: - uses: maxim-lobanov/setup-xcode@v1 diff --git a/Configuration/Apollo/Apollo-Target-PaginationTests.xcconfig b/Configuration/Apollo/Apollo-Target-PaginationTests.xcconfig new file mode 100644 index 000000000..397177520 --- /dev/null +++ b/Configuration/Apollo/Apollo-Target-PaginationTests.xcconfig @@ -0,0 +1,3 @@ +#include "../Shared/Workspace-Target-Test.xcconfig" + +INFOPLIST_FILE = Tests/ApolloPaginationTests/Info.plist diff --git a/Project.swift b/Project.swift index 1ae48bf45..c2cab2530 100644 --- a/Project.swift +++ b/Project.swift @@ -28,6 +28,7 @@ let project = Project( .apolloInternalTestHelpersFramework(), .apolloCodegenInternalTestHelpersFramework(), .apolloTests(), + .apolloPaginationTests(), .apolloPerformanceTests(), .apolloServerIntegrationTests(), .apolloCodegenTests(), @@ -36,6 +37,7 @@ let project = Project( schemes: [ .apolloCodegenTests(), .apolloPerformanceTests(), + .apolloPaginationTests(), .apolloServerIntegrationTests(), .apolloTests(), .codegenCLITests() diff --git a/Tests/ApolloPaginationTests/Info.plist b/Tests/ApolloPaginationTests/Info.plist new file mode 100644 index 000000000..64d65ca49 --- /dev/null +++ b/Tests/ApolloPaginationTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Tests/TestPlans/Apollo-PaginationTestPlan.xctestplan b/Tests/TestPlans/Apollo-PaginationTestPlan.xctestplan new file mode 100644 index 000000000..8104192d8 --- /dev/null +++ b/Tests/TestPlans/Apollo-PaginationTestPlan.xctestplan @@ -0,0 +1,25 @@ +{ + "configurations" : [ + { + "id" : "BF52CC8B-4AB1-4640-BAF4-00FDB47CC315", + "name" : "Configuration 1", + "options" : { + + } + } + ], + "defaultOptions" : { + "testTimeoutsEnabled" : true + }, + "testTargets" : [ + { + "parallelizable" : true, + "target" : { + "containerPath" : "container:ApolloDev.xcodeproj", + "identifier" : "F13FB1AFFD21C03856AD8A03", + "name" : "ApolloPaginationTests" + } + } + ], + "version" : 1 +} diff --git a/Tuist/ProjectDescriptionHelpers/Enums/ApolloTarget.swift b/Tuist/ProjectDescriptionHelpers/Enums/ApolloTarget.swift index 1fb42b7d7..b4a683ae8 100644 --- a/Tuist/ProjectDescriptionHelpers/Enums/ApolloTarget.swift +++ b/Tuist/ProjectDescriptionHelpers/Enums/ApolloTarget.swift @@ -7,6 +7,7 @@ public enum ApolloTarget { case apolloCodegenLibWrapper case apolloCodegenTests case apolloInternalTestHelpers + case apolloPaginationTests case apolloPerformanceTests case apolloServerIntegrationTests case apolloTests @@ -29,6 +30,8 @@ public enum ApolloTarget { return "ApolloCodegenTests" case .apolloInternalTestHelpers: return "ApolloInternalTestHelpers" + case .apolloPaginationTests: + return "ApolloPaginationTests" case .apolloPerformanceTests: return "ApolloPerformanceTests" case .apolloServerIntegrationTests: @@ -62,6 +65,8 @@ public enum ApolloTarget { return "Apollo-Target-CodegenTests" case .apolloInternalTestHelpers: return "Apollo-Target-InternalTestHelpers" + case .apolloPaginationTests: + return "Apollo-Target-PaginationTests" case .apolloPerformanceTests: return "Apollo-Target-PerformanceTests" case .apolloServerIntegrationTests: @@ -100,6 +105,7 @@ public enum ApolloTarget { .apolloPerformanceTests, .apolloServerIntegrationTests, .apolloTests, + .apolloPaginationTests, .codegenCLITests: version = "12.5" } diff --git a/Tuist/ProjectDescriptionHelpers/Enums/ApolloTestPlan.swift b/Tuist/ProjectDescriptionHelpers/Enums/ApolloTestPlan.swift index 96749b78a..102ab7d99 100644 --- a/Tuist/ProjectDescriptionHelpers/Enums/ApolloTestPlan.swift +++ b/Tuist/ProjectDescriptionHelpers/Enums/ApolloTestPlan.swift @@ -7,6 +7,7 @@ enum ApolloTestPlan { case codegenCITest case codegenCLITest case integrationTest + case paginationTest case performanceTest case unitTest @@ -22,6 +23,8 @@ enum ApolloTestPlan { return Path("Tests/TestPlans/CodegenCLITestPlan.xctestplan") case .integrationTest: return Path("Tests/TestPlans/Apollo-IntegrationTestPlan.xctestplan") + case .paginationTest: + return Path("Tests/TestPlans/Apollo-PaginationTestPlan.xctestplan") case .performanceTest: return Path("Tests/TestPlans/Apollo-PerformanceTestPlan.xctestplan") case .unitTest: diff --git a/Tuist/ProjectDescriptionHelpers/Targets/Target+ApolloPaginationTests.swift b/Tuist/ProjectDescriptionHelpers/Targets/Target+ApolloPaginationTests.swift new file mode 100644 index 000000000..7317e1307 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Targets/Target+ApolloPaginationTests.swift @@ -0,0 +1,48 @@ +import ProjectDescription + +extension Target { + + public static func apolloPaginationTests() -> Target { + let target: ApolloTarget = .apolloPaginationTests + + return Target( + name: target.name, + platform: .macOS, + product: .unitTests, + bundleId: "com.apollographql.\(target.name.lowercased())", + deploymentTarget: target.deploymentTarget, + sources: [ + "Tests/\(target.name)/**", + ], + dependencies: [ + .target(name: ApolloTarget.apolloInternalTestHelpers.name), + .target(name: ApolloTarget.starWarsAPI.name), + .package(product: "Apollo"), + .package(product: "ApolloAPI"), + .package(product: "ApolloTestSupport"), + .package(product: "Nimble"), + .package(product: "ApolloPagination") + ], + settings: .forTarget(target) + ) + } + +} + +extension Scheme { + + public static func apolloPaginationTests() -> Scheme { + let target: ApolloTarget = .apolloPaginationTests + + return Scheme( + name: target.name, + buildAction: .buildAction(targets: [ + TargetReference(projectPath: nil, target: target.name) + ]), + testAction: .testPlans([ + ApolloTestPlan.paginationTest.path, + ]) + ) + } + +}