Skip to content

Commit

Permalink
cherry-pick recent release process changes to release branch (#6775)
Browse files Browse the repository at this point in the history
* CocoaPods CI update (#6751)
* Finish port of update-versions.py (#6758)
* Some Release tooling cleanup (#6761)
* Rename ReleaseTooling (#6772)
* Address two comments from last week's PRs (#6774)
* Source updates for ReleaseTooling rename (#6773)
  • Loading branch information
paulb777 authored Oct 19, 2020
1 parent c5ea958 commit 158ccd0
Show file tree
Hide file tree
Showing 129 changed files with 75 additions and 1,065 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: zip
on:
pull_request:
paths:
- 'ZipBuilder/**'
- 'ReleaseTooling/**'
- '.github/workflows/zip.yml'
# Don't run based on any markdown only changes.
- '!ZipBuilder/*.md'
- '!ReleaseTooling/*.md'
schedule:
# Run every day at midnight(PST) - cron uses UTC times
- cron: '0 8 * * *'
Expand All @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- name: Build
run: |
cd ZipBuilder
cd ReleaseTooling
swift build -v
package:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ DerivedData

# Swift Package Manager
*/.build
ZipBuilder/Packages
ZipBuilder/*.xcodeproj
ZipBuilder/Package.resolved
ReleaseTooling/Packages
ReleaseTooling/*.xcodeproj
ReleaseTooling/Package.resolved

# Mint package manager
Mint
Expand Down
36 changes: 3 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,54 +239,24 @@ jobs:

# Validate Cocoapods configurations
# This may take long time, so we would like to run it only once all other tests pass
# Validate Cocoapods 1.7.0 compatibility
- stage: test
if: type = cron
env:
- POD_CONFIG_DIR=Cocoapods1_7_0_multiprojects_frameworks
- POD_CONFIG_DIR=Cocoapods_multiprojects_frameworks
script:
- travis_retry ./CocoapodsIntegrationTest/scripts/build_with_environment.sh --gemfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Gemfile --podfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Podfile

- stage: test
if: type = cron
env:
- POD_CONFIG_DIR=Cocoapods1_7_0_frameworks
script:
- travis_retry ./CocoapodsIntegrationTest/scripts/build_with_environment.sh --gemfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Gemfile --podfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Podfile

- stage: test
if: type = cron
env:
- POD_CONFIG_DIR=Cocoapods1_7_0_multiprojects_staticLibs
script:
- travis_retry ./CocoapodsIntegrationTest/scripts/build_with_environment.sh --gemfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Gemfile --podfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Podfile

- stage: test
if: type = cron
env:
- POD_CONFIG_DIR=Cocoapods1_7_0_staticLibs
script:
- travis_retry ./CocoapodsIntegrationTest/scripts/build_with_environment.sh --gemfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Gemfile --podfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Podfile

# Validate Cocoapods 1.6.1 compatibility
- stage: test
if: type = cron
env:
- POD_CONFIG_DIR=Cocoapods1_6_1_frameworks
script:
- travis_retry ./CocoapodsIntegrationTest/scripts/build_with_environment.sh --gemfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Gemfile --podfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Podfile

- stage: test
if: type = cron
env:
- POD_CONFIG_DIR=Cocoapods1_6_1_staticLibs
- POD_CONFIG_DIR=Cocoapods_multiprojects_staticLibs
script:
- travis_retry ./CocoapodsIntegrationTest/scripts/build_with_environment.sh --gemfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Gemfile --podfile=./CocoapodsIntegrationTest/TestEnvironments/${POD_CONFIG_DIR}/Podfile

allow_failures:
# Run fuzz tests only on cron jobs.
- stage: test
if: type = cron
# if: type = cron
env:
- PROJECT=Firestore PLATFORM=iOS METHOD=fuzz
before_install:
Expand Down
3 changes: 2 additions & 1 deletion AddNewPod.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ For top-level Firebase pods that map to documented products:
* Update [Firebase.podspec](Firebase.podspec).
* Register library via registerInternalLibrary API like this
[Storage example](FirebaseStorage/Sources/FIRStorageComponent.m).
* Add to the [ZipBuilder pod list](ZipBuilder/Sources/ZipBuilder/FirebasePods.swift).
* When ready to release with Firebase, add to the
[Firebase manifest](ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift).
* Add a [quickstart](https://github.com/firebase/quickstart-ios).

## Review and Release
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

source "https://rubygems.org"

gem 'cocoapods', "=1.6.1"
gem 'cocoapods', '1.10.0.rc.1'
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
source "https://rubygems.org"

# Don't allow 1.7.0.rc.1 because of https://github.com/CocoaPods/CocoaPods/issues/8765
gem 'cocoapods', "!=1.7.0.rc.1"
gem 'cocoapods', '1.10.0.rc.1'
4 changes: 2 additions & 2 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def labelsForModifiedFiles()
labels.push("api: storage") if @has_storage_changes
labels.push("GoogleDataTransport") if @has_gdt_changes
labels.push("GoogleUtilities") if @has_googleutilities_changes
labels.push("zip-builder") if @has_zipbuilder_changes
labels.push("release-tooling") if @has_releasetooling_changes
labels.push("public-api-change") if @has_api_changes
return labels
end
Expand Down Expand Up @@ -111,7 +111,7 @@ has_license_changes = didModify(["LICENSE"])
@has_gdt_changes = hasChangesIn(["GoogleDataTransport/"])
@has_gdt_api_changes = hasChangesIn("GoogleDataTransport/GDTCORLibrary/Public")
@has_googleutilities_changes = hasChangesIn("GoogleUtilities/")
@has_zipbuilder_changes = hasChangesIn("ZipBuilder/")
@has_releasetooling_changes = hasChangesIn("ReleaseTooling/")

# Convenient flag for all API changes.
@has_api_changes = @has_abtesting_api_changes ||
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ZipBuilder/Package.swift → ReleaseTooling/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import PackageDescription

let package = Package(
name: "ZipBuilder",
name: "ReleaseTooling",
products: [
.executable(name: "firebase-releaser", targets: ["FirebaseReleaser"]),
.executable(name: "ReleasePackager", targets: ["ZipBuilder"]),
.executable(name: "zip-builder", targets: ["ZipBuilder"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", .exact("0.0.1")),
Expand Down
8 changes: 4 additions & 4 deletions ZipBuilder/README.md → ReleaseTooling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In order to build the Zip file, you will need:

### Running the Tool

You can run the tool with `swift run ReleasePackager [ARGS]` or generate an Xcode project with
You can run the tool with `swift run zip-builder [ARGS]` or generate an Xcode project with
`swift package generate-xcodeproj` and run within Xcode.

Since Apple does not support linking libraries built by future Xcode versions, make sure to builid with the
Expand All @@ -32,12 +32,12 @@ for that version. Check with `xcodebuild -version`.

See `main.swift` and the `LaunchArgs` struct for information on specific launch arguments.

You can pass in launch arguments with Xcode by clicking "ZipBuilder" beside the Run/Stop buttons, clicking "Edit
You can pass in launch arguments with Xcode by clicking "zip-builder" beside the Run/Stop buttons, clicking "Edit
Scheme" and adding them in the "Arguments Passed On Launch" section.

#### Common Arguments

These arguments assume you're running the command from the `ZipBuilder` directory.
These arguments assume you're running the command from the `ReleaseTooling` directory.

**Required** arguments:
- `-templateDir $(pwd)/Template`
Expand Down Expand Up @@ -78,7 +78,7 @@ For release engineers (Googlers packaging an upcoming Firebase release) these co
Putting them all together, here's a common command to build a releaseable Zip file:

```
swift run ReleasePackager -updatePodRepo true \
swift run zip-builder -updatePodRepo true \
-repoDir <PATH_TO_current.firebase_ios_sdk.repo> \
-customSpecRepos sso://cpdc-internal/firebase
-carthageBuild true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Foundation
public let shared = Manifest(
version: "7.0.0",
pods: [
Pod("GoogleUtilities", isFirebase: false, podVersion: "7.0.0", releasing: false),
Pod("GoogleUtilities", isFirebase: false, podVersion: "7.0.0", releasing: true),
Pod("GoogleDataTransport", isFirebase: false, podVersion: "8.0.0", releasing: true),

Pod("FirebaseCoreDiagnostics"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ enum Push {
let cpdcLocation = findCpdc(gitRoot: gitRoot)
let manifest = FirebaseManifest.shared

for pod in manifest.pods {
if !pod.releasing {
continue
}
for pod in manifest.pods.filter({ $0.releasing }) {
let warningsOK = pod.allowWarnings ? " --allow-warnings" : ""

Shell.executeCommand("pod repo push --skip-tests --use-json \(warningsOK) \(cpdcLocation) " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ enum Tags {
createTag(gitRoot: gitRoot, tag: "CocoaPods-\(manifest.version)-beta",
deleteExistingTags: deleteExistingTags)

for pod in manifest.pods {
if pod.isFirebase {
continue
}
for pod in manifest.pods.filter({ !$0.isFirebase && $0.releasing }) {
if !pod.name.starts(with: "Google") {
fatalError("Unrecognized Other Pod: \(pod.name). Only Google prefix is recognized")
}
Expand All @@ -48,21 +45,31 @@ enum Tags {

private static func createTag(gitRoot: URL, tag: String, deleteExistingTags: Bool) {
if deleteExistingTags {
verifyTagsAreSafeToDelete()
verifyTagsAreSafeToDelete(gitRoot: gitRoot)
Shell.executeCommand("git tag --delete \(tag)", workingDir: gitRoot)
Shell.executeCommand("git push --delete origin \(tag)", workingDir: gitRoot)
} else {
verifyTagIsSafeToAdd(tag, gitRoot: gitRoot)
}
Shell.executeCommand("git tag \(tag)", workingDir: gitRoot)
Shell.executeCommand("git push origin \(tag)", workingDir: gitRoot)
}

private static func verifyTagsAreSafeToDelete() {
/// Check that the Firebase version has not already been published to CocoaPods, so that we don't
/// delete a tag that is being used in production.
/// It works by checking for the existence of the corresponding Firebase podspec in the
/// clone of https://github.com/CocoaPods/Specs
private static func verifyTagsAreSafeToDelete(gitRoot: URL) {
var homeDirURL: URL
if #available(OSX 10.12, *) {
homeDirURL = FileManager.default.homeDirectoryForCurrentUser
} else {
fatalError("Run on at least macOS 10.12")
}

// Make sure that local master spec repo is up to date.
Shell.executeCommand("pod repo update", workingDir: gitRoot)

let manifest = FirebaseManifest.shared
let firebasePublicURL = homeDirURL.appendingPathComponents(
[".cocoapods", "repos", "cocoapods", "Specs", "0", "3", "5", "Firebase"]
Expand All @@ -77,4 +84,29 @@ enum Tags {
fatalError("Do not remove tag of a published Firebase version.")
}
}

/// Before trying to add a new tag, make sure that it doesn't already exist locally or in the
/// git origin. The git commands return an empty string if the tag doesn't exist.
private static func verifyTagIsSafeToAdd(_ tag: String, gitRoot: URL) {
if checkTagCommand("git tag -l \(tag)", gitRoot: gitRoot) != "" {
fatalError("Tag \(tag) already exists locally. Please delete and restart")
}
if checkTagCommand("git ls-remote origin refs/tags/\(tag)", gitRoot: gitRoot) != "" {
fatalError("Tag \(tag) already exists locally. Please delete and restart")
}
}

private static func checkTagCommand(_ command: String, gitRoot: URL) -> String {
let result = Shell.executeCommandFromScript(command, workingDir: gitRoot)
switch result {
case let .error(code, output):
fatalError("""
`\(command) failed with exit code \(code)
Output from `pod repo list`:
\(output)
""")
case let .success(output):
return output.trimmingCharacters(in: .whitespacesAndNewlines)
}
}
}
Loading

0 comments on commit 158ccd0

Please sign in to comment.