Repository: firebase/firebase-ios-sdk (language: cpp)

Issue:
Nightly Testing Report
# Nightly Testing Report
This issue([log](https://github.com/firebase/firebase-ios-sdk/actions/runs/856943560)) is generated at 05/19/2021 06:10 AM, fetching workflow runs triggered in the last 24 hrs.
| Workflow |05/18|
| -------- | -------- |
| [zip](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/zip.yml) | [failure](https://github.com/firebase/firebase-ios-sdk/actions/runs/856082663) |
| [database](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/database.yml) | [failure](https://github.com/firebase/firebase-ios-sdk/actions/runs/856428214) |
| [release](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/release.yml) | [cancelled](https://github.com/firebase/firebase-ios-sdk/actions/runs/855937007) |



Discussion / hints:
The database failure looks like the integration test flake
The release failure looks like a GHA infra issue in the Firestore quickstart
The zip failure is a likely regression from #8098 and I'll investigate.

Fix patch:
diff --git a/ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift b/ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift
index 7e51f605f01..b6e123569a0 100644
--- a/ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift
+++ b/ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift
@@ -160,10 +160,13 @@ struct ZipBuilder {
   /// Builds and assembles the contents for the zip build.
   ///
   /// - Parameter podsToInstall: All pods to install.
+  /// - Parameter includeCarthage: Build Carthage distribution as well.
+  /// - Parameter includeDependencies: Include dependencies of requested pod in distribution.
   /// - Returns: Arrays of pod install info and the frameworks installed.
   func buildAndAssembleZip(podsToInstall: [CocoaPodUtils.VersionedPod],
+                           includeCarthage: Bool,
                            includeDependencies: Bool) ->
-    ([String: CocoaPodUtils.PodInfo], [String: [URL]], URL) {
+    ([String: CocoaPodUtils.PodInfo], [String: [URL]], URL?) {
     // Remove CocoaPods cache so the build gets updates after a version is rebuilt during the
     // release process. Always do this, since it can be the source of subtle failures on rebuilds.
     CocoaPodUtils.cleanPodCache()
@@ -237,7 +240,7 @@ struct ZipBuilder {
                                                  podInfo: podInfo)
           groupedFrameworks[podName] = (groupedFrameworks[podName] ?? []) + frameworks
 
-          if podName == "FirebaseCoreDiagnostics" {
+          if includeCarthage, podName == "FirebaseCoreDiagnostics" {
             let (cdFrameworks, _) = builder.compileFrameworkAndResources(withName: podName,
                                                                          logsOutputDir: paths
                                                                            .logsOutputDir,
@@ -271,13 +274,6 @@ struct ZipBuilder {
     } catch {
       fatalError("Could not create XCFrameworks directory: \(error)")
     }
-    let xcframeworksCarthageDir = FileManager.default.temporaryDirectory(withName: "xcf-carthage")
-    do {
-      try FileManager.default.createDirectory(at: xcframeworksCarthageDir,
-                                              withIntermediateDirectories: false)
-    } catch {
-      fatalError("Could not create XCFrameworks Carthage directory: \(error)")
-    }
 
     for groupedFramework in groupedFrameworks {
       let name = groupedFramework.key
@@ -290,6 +286,18 @@ struct ZipBuilder {
     for (framework, paths) in xcframeworks {
       print("Frameworks for pod: \(framework) were compiled at \(paths)")
     }
+    guard includeCarthage else {
+      // No Carthage build necessary, return now.
+      return (podsBuilt, xcframeworks, nil)
+    }
+    let xcframeworksCarthageDir = FileManager.default.temporaryDirectory(withName: "xcf-carthage")
+    do {
+      try FileManager.default.createDirectory(at: xcframeworksCarthageDir,
+                                              withIntermediateDirectories: false)
+    } catch {
+      fatalError("Could not create XCFrameworks Carthage directory: \(error)")
+    }
+
     let carthageCoreDiagnosticsXcframework = FrameworkBuilder.makeXCFramework(
       withName: "FirebaseCoreDiagnostics",
       frameworks: carthageCoreDiagnosticsFrameworks,
@@ -324,8 +332,9 @@ struct ZipBuilder {
                                                     platforms: ["ios"]))
 
     print("Final expected versions for the Zip file: \(podsToInstall)")
-    let (installedPods, frameworks, carthageCoreDiagnosticsXcframework) =
+    let (installedPods, frameworks, carthageCoreDiagnosticsXcframeworkFirebase) =
       buildAndAssembleZip(podsToInstall: podsToInstall,
+                          includeCarthage: true,
                           // Always include dependencies for Firebase zips.
                           includeDependencies: true)
 
@@ -336,6 +345,10 @@ struct ZipBuilder {
         "installed: \(installedPods)")
     }
 
+    guard let carthageCoreDiagnosticsXcframework = carthageCoreDiagnosticsXcframeworkFirebase else {
+      fatalError("CoreDiagnosticsXcframework is missing")
+    }
+
     let zipDir = try assembleDistributions(withPackageKind: "Firebase",
                                            podsToInstall: podsToInstall,
                                            installedPods: installedPods,
diff --git a/ReleaseTooling/Sources/ZipBuilder/main.swift b/ReleaseTooling/Sources/ZipBuilder/main.swift
index ec61433a085..24fd38f3150 100644
--- a/ReleaseTooling/Sources/ZipBuilder/main.swift
+++ b/ReleaseTooling/Sources/ZipBuilder/main.swift
@@ -268,6 +268,7 @@ struct ZipBuilderTool: ParsableCommand {
 
       let (installedPods, frameworks, _) =
         builder.buildAndAssembleZip(podsToInstall: podsToBuild,
+                                    includeCarthage: false,
                                     includeDependencies: buildDependencies)
       let staging = FileManager.default.temporaryDirectory(withName: "Binaries")
       try builder.copyFrameworks(fromPods: Array(installedPods.keys), toDirectory: staging,


Test patch: