Skip to content

Commit 6db47f7

Browse files
Skip building generated Github APIs in compat test (#290)
### Motivation We have an opt-in CI pipeline configured that is triggered by a comment. It runs the same compatibility test that's run in the automatic pipeline, which generates code for a set of real-world OpenAPI documents, but, additionally, it builds the generated code. However, the Github APIs are so large that we cannot compile them in a reasonable amount of time in CI, if we want to compile the others. ### Modifications Skip building the generated code for Github APIs, even on the opt-in pipeline. ### Result The opt-in pipeline now runs in ~22 minutes. ### Test Plan We'll use this PR to trigger the CI to confirm it completes, and in a reasonable time.
1 parent 82678a7 commit 6db47f7

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,44 @@ final class CompatibilityTest: XCTestCase {
4040
try await _test(
4141
"https://raw.githubusercontent.com/aws/aws-lambda-dotnet/7a516b80d83a5c5f5d951158b16b8f76120035cc/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/runtime-api.yaml",
4242
license: .apache,
43-
expectedDiagnostics: []
43+
expectedDiagnostics: [],
44+
skipBuild: compatibilityTestSkipBuild
4445
)
4546
}
4647

4748
func testAzureIOTIdentityService() async throws {
4849
try await _test(
4950
"https://raw.githubusercontent.com/Azure/iot-identity-service/6404c3bebcc03f12c441c5b018803256bfe1fffe/key/aziot-keyd/openapi/2021-05-01.yaml",
5051
license: .mit,
51-
expectedDiagnostics: []
52+
expectedDiagnostics: [],
53+
skipBuild: compatibilityTestSkipBuild
5254
)
5355
}
5456

5557
func testBox() async throws {
5658
try await _test(
5759
"https://raw.githubusercontent.com/box/box-openapi/5955d651f0cd273c0968e3855c1d873c7ae3523e/openapi.json",
5860
license: .apache,
59-
expectedDiagnostics: []
61+
expectedDiagnostics: [],
62+
skipBuild: compatibilityTestSkipBuild
6063
)
6164
}
6265

6366
func testCiscoMindmeld() async throws {
6467
try await _test(
6568
"https://raw.githubusercontent.com/cisco/mindmeld/bd3547d5c1bd092dbd4a64a90528dfc2e2b3844a/mindmeld/openapi/custom_action.yaml",
6669
license: .apache,
67-
expectedDiagnostics: []
70+
expectedDiagnostics: [],
71+
skipBuild: compatibilityTestSkipBuild
6872
)
6973
}
7074

7175
func testCloudHypervisor() async throws {
7276
try await _test(
7377
"https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/889d06277acae45c2b55bd5f6298ca2b21a55cbb/vmm/src/api/openapi/cloud-hypervisor.yaml",
7478
license: .apache,
75-
expectedDiagnostics: []
79+
expectedDiagnostics: [],
80+
skipBuild: compatibilityTestSkipBuild
7681
)
7782
}
7883

@@ -82,92 +87,104 @@ final class CompatibilityTest: XCTestCase {
8287
license: .apache,
8388
expectedDiagnostics: [
8489
"Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes.."
85-
]
90+
],
91+
skipBuild: compatibilityTestSkipBuild
8692
)
8793
}
8894

8995
func testGithub() async throws {
9096
try await _test(
9197
"https://raw.githubusercontent.com/github/rest-api-description/13c873cb3b15ffd5bcd88c6d6270a963ef4518f6/descriptions/api.github.com/api.github.com.yaml",
9298
license: .mit,
93-
expectedDiagnostics: []
99+
expectedDiagnostics: [],
100+
skipBuild: true
94101
)
95102
}
96103

97104
func testGithubEnterprise() async throws {
98105
try await _test(
99106
"https://raw.githubusercontent.com/github/rest-api-description/13c873cb3b15ffd5bcd88c6d6270a963ef4518f6/descriptions/ghes-3.5/ghes-3.5.yaml",
100107
license: .mit,
101-
expectedDiagnostics: []
108+
expectedDiagnostics: [],
109+
skipBuild: true
102110
)
103111
}
104112

105113
func testKubernetes() async throws {
106114
try await _test(
107115
"https://raw.githubusercontent.com/kubernetes/kubernetes/fa3d7990104d7c1f16943a67f11b154b71f6a132/api/openapi-spec/v3/api__v1_openapi.json",
108116
license: .apache,
109-
expectedDiagnostics: []
117+
expectedDiagnostics: [],
118+
skipBuild: compatibilityTestSkipBuild
110119
)
111120
}
112121

113122
func testNetflixConsoleMe() async throws {
114123
try await _test(
115124
"https://raw.githubusercontent.com/Netflix/consoleme/774420462b0190b1bfa78aa73d39e20044f52db9/swagger.yaml",
116125
license: .apache,
117-
expectedDiagnostics: []
126+
expectedDiagnostics: [],
127+
skipBuild: compatibilityTestSkipBuild
118128
)
119129
}
120130

121131
func testOpenAI() async throws {
122132
try await _test(
123133
"https://raw.githubusercontent.com/openai/openai-openapi/ec0b3953bfa08a92782bdccf34c1931b13402f56/openapi.yaml",
124134
license: .mit,
125-
expectedDiagnostics: []
135+
expectedDiagnostics: [],
136+
skipBuild: compatibilityTestSkipBuild
126137
)
127138
}
128139

129140
func testOpenAPIExamplesPetstore() async throws {
130141
try await _test(
131142
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/9dff244e5708fbe16e768738f4f17cf3fddf4066/examples/v3.0/petstore.yaml",
132143
license: .apache,
133-
expectedDiagnostics: []
144+
expectedDiagnostics: [],
145+
skipBuild: compatibilityTestSkipBuild
134146
)
135147
}
136148

137149
func testOpenAPIExamplesPetstoreExpanded() async throws {
138150
try await _test(
139151
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/9dff244e5708fbe16e768738f4f17cf3fddf4066/examples/v3.0/petstore-expanded.yaml",
140152
license: .apache,
141-
expectedDiagnostics: []
153+
expectedDiagnostics: [],
154+
skipBuild: compatibilityTestSkipBuild
142155
)
143156
}
144157
func testOpenAPIExamplesAPIWithExamples() async throws {
145158
try await _test(
146159
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/9dff244e5708fbe16e768738f4f17cf3fddf4066/examples/v3.0/api-with-examples.yaml",
147160
license: .apache,
148-
expectedDiagnostics: []
161+
expectedDiagnostics: [],
162+
skipBuild: compatibilityTestSkipBuild
149163
)
150164
}
151165
func testOpenAPIExamplesCallbackExample() async throws {
152166
try await _test(
153167
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/9dff244e5708fbe16e768738f4f17cf3fddf4066/examples/v3.0/callback-example.yaml",
154168
license: .apache,
155-
expectedDiagnostics: []
169+
expectedDiagnostics: [],
170+
skipBuild: compatibilityTestSkipBuild
156171
)
157172
}
158173
func testOpenAPIExamplesLinkExample() async throws {
159174
try await _test(
160175
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/9dff244e5708fbe16e768738f4f17cf3fddf4066/examples/v3.0/link-example.yaml",
161176
license: .apache,
162-
expectedDiagnostics: []
177+
expectedDiagnostics: [],
178+
skipBuild: compatibilityTestSkipBuild
163179
)
164180
}
165181

166182
func testSwiftPackageRegistry() async throws {
167183
try await _test(
168184
"https://raw.githubusercontent.com/apple/swift-package-manager/ce0ff6f223122c88cbf24a0eca8424664e2fb1f1/Documentation/PackageRegistry/registry.openapi.yaml",
169185
license: .apache,
170-
expectedDiagnostics: []
186+
expectedDiagnostics: [],
187+
skipBuild: compatibilityTestSkipBuild
171188
)
172189
}
173190
}
@@ -189,7 +206,8 @@ fileprivate extension CompatibilityTest {
189206
func _test(
190207
_ documentURL: String,
191208
license: License,
192-
expectedDiagnostics: Set<String> = []
209+
expectedDiagnostics: Set<String> = [],
210+
skipBuild: Bool = false
193211
) async throws {
194212
let diagnosticsCollector = RecordingDiagnosticCollector()
195213

@@ -230,7 +248,7 @@ fileprivate extension CompatibilityTest {
230248
XCTAssertEqual(Set(diagnosticsCollector.diagnostics.map(\.message)), expectedDiagnostics)
231249
XCTAssertEqual(outputs.count, 3)
232250

233-
if !compatibilityTestSkipBuild {
251+
if !skipBuild {
234252
// Create Swift package test harness.
235253
let packageName = "swift-openapi-compatibility-test-\(testCaseName)"
236254
let packageDir = FileManager.default.temporaryDirectory.appendingPathComponent(

0 commit comments

Comments
 (0)