-
Notifications
You must be signed in to change notification settings - Fork 58
321 lines (311 loc) · 10 KB
/
ci-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
name: "CI Tests"
on:
pull_request:
types: [opened, synchronize, reopened]
env:
XCODE_VERSION: "15.0.1"
jobs:
changes:
runs-on: ubuntu-latest
outputs:
ios: ${{ steps.filter.outputs.ios }}
codegen: ${{ steps.filter.outputs.codegen }}
pagination: ${{ steps.filter.outputs.pagination }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
ios:
- 'apollo-ios/**'
- 'Tests/ApolloInternalTestHelpers/**'
- 'Tests/ApolloServerIntegrationTests/**'
- 'Tests/ApolloTests/**'
codegen:
- 'apollo-ios-codegen/**'
- 'Tests/ApolloCodegenInternalTestHelpers/**'
- 'Tests/ApolloCodegenTests/**'
- 'Tests/CodegenCLITests/**'
- 'Tests/CodegenIntegrationTests/**'
- 'Tests/TestCodeGenConfigurations/**'
pagination:
- 'apollo-ios-pagination/**'
- 'Tests/ApolloInternalTestHelpers/**'
- 'apollo-ios/**'
tuist-generation:
runs-on: macos-13
needs: [changes]
if: ${{ needs.changes.outputs.ios == 'true' || needs.changes.outputs.codegen == 'true' || needs.changes.outputs.pagination == 'true' }}
timeout-minutes: 8
name: Run Tuist Generation
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run Tuist Generation
uses: tuist/[email protected]
with:
command: 'generate'
arguments: ''
- name: Cache Build Dependencies
uses: actions/cache@v3
with:
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
run-swift-builds:
runs-on: macos-13
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
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
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run Swift Build
shell: bash
run: |
cd ${{ matrix.package }} && swift build
build-and-unit-test:
runs-on: macos-13
needs: [tuist-generation, changes]
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
# macOS_current
- destination: platform=macOS,arch=x86_64
scheme: ApolloTests
test-plan: Apollo-CITestPlan
name: Apollo Unit Tests - macOS
run-js-tests: false
should-run: ${{ needs.changes.outputs.ios }}
# Codegen CLI Test
- destination: platform=macOS,arch=x86_64
scheme: CodegenCLITests
test-plan: CodegenCLITestPlan
name: Codegen CLI Unit Tests - macOS
run-js-tests: false
should-run: ${{ needs.changes.outputs.codegen }}
# CodegenLib Test
- destination: platform=macOS,arch=x86_64
scheme: ApolloCodegenTests
test-plan: Apollo-Codegen-CITestPlan
name: Codegen Lib Unit Tests - macOS
run-js-tests: true
should-run: ${{ needs.changes.outputs.codegen }}
# ApolloPagination Tests
- destination: platform=macOS,arch=x86_64
scheme: ApolloPaginationTests
test-plan: Apollo-PaginationTestPlan
name: ApolloPagination Unit Tests - macOS
run-js-tests: false
should-run: ${{ needs.changes.outputs.pagination }}
name: ${{ matrix.name }}
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
# Caching for apollo-ios and apollo-ios-codegen SPM dependencies
# - uses: actions/cache@v3
# with:
# path: ./DerivedData/SourcePackages
# key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }}
# - name: Run Tuist Generation
# uses: tuist/[email protected]
# with:
# command: 'generate'
# arguments: ''
- name: Build and Test
if: ${{ matrix.should-run == true || matrix.should-run == 'true' }}
id: build-and-test
uses: ./.github/actions/build-and-run-unit-tests
with:
destination: ${{ matrix.destination }}
scheme: ${{ matrix.scheme }}
test-plan: ${{ matrix.test-plan }}
- name: Run-JS-Tests
if: ${{ matrix.run-js-tests == true }}
shell: bash
working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/
run: |
npm install && npm test
- name: Save xcodebuild logs
if: ${{ steps.build-and-test.outcome != 'skipped' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-logs
path: |
DerivedData/Logs/Build
- name: Save crash logs
if: ${{ steps.build-and-test.outcome != 'skipped' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-crashes
path: |
~/Library/Logs/DiagnosticReports
- name: Zip Result Bundle
if: ${{ steps.build-and-test.outcome != 'skipped' }}
shell: bash
working-directory: TestResults
run: |
zip -r ResultBundle.zip ResultBundle.xcresult
- name: Save test results
if: ${{ steps.build-and-test.outcome != 'skipped' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-results
path: |
TestResults/ResultBundle.zip
run-codegen-test-configurations:
runs-on: macos-13
timeout-minutes: 20
name: Codegen Test Configurations - macOS
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install XCBeautify
shell: bash
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install xcbeautify
- name: Test Codegen Configurations
shell: bash
run: |
./scripts/run-test-codegen-configurations.sh -t
verify-frontend-bundle-latest:
runs-on: macos-13
needs: [changes]
if: ${{ needs.changes.outputs.codegen == 'true' }}
timeout-minutes: 5
name: Verify Frontend Bundle Latest - macOS
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Build JS Bundle
shell: bash
working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript
run: npm install && ./auto_rollup.sh
- name: Verify Latest
shell: bash
run: |
git diff --exit-code
run-cocoapods-integration-tests:
runs-on: macos-13
timeout-minutes: 20
name: Cocoapods Integration Tests - macOS
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Export ENV Variables
shell: bash
working-directory: apollo-ios
run: |
apollo_ios_sha=$(git rev-parse HEAD)
echo "APOLLO_IOS_SHA=$apollo_ios_sha" >> ${GITHUB_ENV}
- name: Run CocoaPods Integration Tests
id: run-cocoapods-integration-tests
uses: ./.github/actions/run-cocoapods-integration-tests
run-integration-tests:
runs-on: macos-13
needs: [tuist-generation, changes]
if: ${{ needs.changes.outputs.ios == 'true' }}
timeout-minutes: 20
name: Apollo Integration Tests - macOS
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node 12.22.10
uses: actions/setup-node@v3
with:
node-version: 12.22.10
- name: Setup Upload Server
shell: bash
run: |
sudo chmod -R +rwx SimpleUploadServer
cd SimpleUploadServer && npm install && npm start &
- name: Setup Node 18.15.0
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Setup Subscription Server
shell: bash
run: |
sh ./scripts/install-apollo-server-docs-example-server.sh
cd ../docs-examples/apollo-server/v3/subscriptions-graphql-ws && npm start &
- name: Setup Star Wars Server
shell: bash
run: |
sh ./scripts/install-or-update-starwars-server.sh
cd ../starwars-server && npm start &
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
- name: Build and Test
uses: ./.github/actions/build-and-run-unit-tests
with:
destination: platform=macOS,arch=x86_64
scheme: ApolloServerIntegrationTests
test-plan: Apollo-IntegrationTestPlan
- name: Save xcodebuild logs
uses: actions/upload-artifact@v3
with:
name: macOS-Integration-logs
path: |
DerivedData/Logs/Build
- name: Save crash logs
uses: actions/upload-artifact@v3
with:
name: macOS-Integration-crashes
path: |
~/Library/Logs/DiagnosticReports
- name: Zip Result Bundle
shell: bash
working-directory: TestResults
run: |
zip -r ResultBundle.zip ResultBundle.xcresult
- name: Save test results
uses: actions/upload-artifact@v3
with:
name: macOS-Integration-results
path: |
TestResults/ResultBundle.zip