Skip to content

Commit c68b0ea

Browse files
authored
Move schema downloader tests to integration test target (#1761)
* Move schema downloader tests to integration test target * Only run codegen integration tests on macOS * Only run integration tests on macOS * Move codegen test support into its own target * Fix target config errors * Clean Derived data before building on CI * Build-for-testing while specifying correct test plan
1 parent 802327a commit c68b0ea

34 files changed

Lines changed: 458 additions & 169 deletions

.circleci/config.yml

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,11 @@ parameters:
2727
default: "appletvsimulator14.3"
2828

2929
commands:
30-
common_test_steps:
31-
description: Commands to run for every set of tests
30+
integration_test_setup:
3231
steps:
3332
- restore_cache:
3433
key: starwars-server
35-
- checkout
36-
- run:
37-
command: rm ~/.ssh/id_rsa
38-
name: Remove old SSH key
39-
- run:
40-
command: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
41-
name: Bitbucket Key Workaround
42-
- run:
43-
command: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
44-
name: Github Key Workaround
34+
- common_test_setup
4535
- run:
4636
command: ./scripts/install-node.sh
4737
name: Install Node
@@ -59,17 +49,34 @@ commands:
5949
- run:
6050
command: sudo chmod -R +rwx SimpleUploadServer
6151
name: Adjust permissions for simple upload server folder
52+
integration_test_cleanup:
53+
steps:
54+
- save_cache:
55+
key: starwars-server
56+
paths:
57+
- ../starwars-server
58+
common_test_setup:
59+
description: Commands to run for setup of every set of tests
60+
steps:
61+
- checkout
62+
- run:
63+
command: rm ~/.ssh/id_rsa
64+
name: Remove old SSH key
6265
- run:
63-
command: xcodebuild clean build build-for-testing -project "Apollo.xcodeproj" -scheme "${CIRCLE_XCODE_SCHEME}" -sdk "${CIRCLE_XCODE_SDK}" -destination "${DESTINATION}" | xcpretty
66+
command: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
67+
name: Bitbucket Key Workaround
68+
- run:
69+
command: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
70+
name: Github Key Workaround
71+
build_and_run_tests:
72+
steps:
73+
- run:
74+
command: xcodebuild clean build build-for-testing -project "Apollo.xcodeproj" -scheme "${CIRCLE_XCODE_SCHEME}" -sdk "${CIRCLE_XCODE_SDK}" -destination "${DESTINATION}" -testPlan "${CIRCLE_XCODE_TEST_PLAN}" | xcpretty
6475
name: Clean and build for testing
6576
- run:
6677
command: xcodebuild test-without-building -resultBundlePath ~/TestResults/ResultBundle.xcresult -project "Apollo.xcodeproj" -scheme "${CIRCLE_XCODE_SCHEME}" -sdk "${CIRCLE_XCODE_SDK}" -destination "${DESTINATION}" -testPlan "${CIRCLE_XCODE_TEST_PLAN}" | xcpretty
6778
name: Run tests
6879
- save-xcodebuild-artifacts
69-
- save_cache:
70-
key: starwars-server
71-
paths:
72-
- ../starwars-server
7380
save-xcodebuild-artifacts:
7481
description: Save artifacts logs, crash reports and test results generated by xcodebuild
7582
steps:
@@ -94,6 +101,19 @@ commands:
94101
# Important! When adding a new job to `jobs`, make sure to define when it
95102
# executes by also adding it to the `workflows` section below!
96103
jobs:
104+
IntegrationTests_macOS_current:
105+
macos:
106+
xcode: << pipeline.parameters.xcode_version >>
107+
environment:
108+
DESTINATION: platform=macOS,arch=x86_64
109+
CIRCLE_XCODE_SCHEME: Apollo
110+
CIRCLE_XCODE_TEST_PLAN: Apollo-IntegrationTestPlan
111+
CIRCLE_XCODE_SDK: << pipeline.parameters.macos_sdk >>
112+
steps:
113+
- integration_test_setup
114+
- build_and_run_tests
115+
- integration_test_cleanup
116+
97117
macOS_current:
98118
macos:
99119
xcode: << pipeline.parameters.xcode_version >>
@@ -103,7 +123,8 @@ jobs:
103123
CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan
104124
CIRCLE_XCODE_SDK: << pipeline.parameters.macos_sdk >>
105125
steps:
106-
- common_test_steps
126+
- common_test_setup
127+
- build_and_run_tests
107128

108129
iOS_current:
109130
macos:
@@ -114,7 +135,8 @@ jobs:
114135
CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan
115136
CIRCLE_XCODE_SDK: << pipeline.parameters.ios_sdk >>
116137
steps:
117-
- common_test_steps
138+
- common_test_setup
139+
- build_and_run_tests
118140

119141
iOS_previous:
120142
macos:
@@ -125,7 +147,8 @@ jobs:
125147
CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan
126148
CIRCLE_XCODE_SDK: << pipeline.parameters.ios_sdk >>
127149
steps:
128-
- common_test_steps
150+
- common_test_setup
151+
- build_and_run_tests
129152

130153
tvOS_current:
131154
macos:
@@ -136,9 +159,10 @@ jobs:
136159
CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan
137160
CIRCLE_XCODE_SDK: << pipeline.parameters.tvos_sdk >>
138161
steps:
139-
- common_test_steps
162+
- common_test_setup
163+
- build_and_run_tests
140164

141-
CodegenLibmacOS_current:
165+
CodegenLib_macOS_current:
142166
macos:
143167
xcode: << pipeline.parameters.xcode_version >>
144168
environment:
@@ -147,7 +171,8 @@ jobs:
147171
CIRCLE_XCODE_TEST_PLAN: Apollo-CodegenTestPlan
148172
CIRCLE_XCODE_SDK: << pipeline.parameters.macos_sdk >>
149173
steps:
150-
- common_test_steps
174+
- common_test_setup
175+
- build_and_run_tests
151176

152177
CocoaPodsTrunk:
153178
macos:
@@ -165,6 +190,8 @@ workflows:
165190
# This workflow builds and tests the library across various operating systems and versions
166191
build-and-test:
167192
jobs:
193+
- IntegrationTests_macOS_current:
194+
name: Apollo Integration Tests macOS << pipeline.parameters.macos_version >>
168195
- macOS_current:
169196
name: Apollo macOS << pipeline.parameters.macos_version >>
170197
- iOS_current:
@@ -173,7 +200,7 @@ workflows:
173200
name: Apollo iOS << pipeline.parameters.ios_previous_version >>
174201
- tvOS_current:
175202
name: Apollo tvOS << pipeline.parameters.tvos_version >>
176-
- CodegenLibmacOS_current:
203+
- CodegenLib_macOS_current:
177204
name: Swift Code Generation
178205
- CocoaPodsTrunk:
179206
name: Push Podspec to CocoaPods Trunk

0 commit comments

Comments
 (0)