Skip to content

Commit 03e15cd

Browse files
Delete temporary build directories in compatibility test (#277)
### Motivation The compatibility test has an option to build the generated code. It does so in a temporary directory, but it doesn't cleanup the directory. ### Modifications Add a `defer` block to delete the temporary directory. ### Result Not leaking too much space in CI.
1 parent 0488531 commit 03e15cd

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,7 @@ fileprivate extension CompatibilityTest {
238238
"\(packageName)-\(UUID().uuidString.prefix(8))",
239239
isDirectory: true
240240
)
241-
let cacheDirectory = FileManager.default.temporaryDirectory.appendingPathComponent(
242-
"swift-openapi-compatibility-test-shared-cache",
243-
isDirectory: true
244-
)
241+
defer { try? FileManager.default.removeItem(at: packageDir) }
245242

246243
log("Creating Swift package: \(packageDir.path)")
247244
XCTAssertNoThrow(try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true))
@@ -280,7 +277,6 @@ fileprivate extension CompatibilityTest {
280277
process.arguments = [
281278
"swift", "build",
282279
"--package-path", packageDir.path,
283-
"--cache-path", cacheDirectory.path,
284280
"-Xswiftc", "-Xllvm", "-Xswiftc", "-vectorize-slp=false",
285281
]
286282
if let numBuildJobs = compatibilityTestNumBuildJobs {

0 commit comments

Comments
 (0)