Skip to content

Commit 55a8146

Browse files
authored
Preinstall FirebaseCore for release testing. (#9833)
* Preinstall FirebaseCore for release testing. * Pass `--allow-warnings` * Add retry to `pod repo push` wrapper.
1 parent 06185f6 commit 55a8146

File tree

5 files changed

+131
-28
lines changed

5 files changed

+131
-28
lines changed

.github/workflows/prerelease.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,50 @@ jobs:
6868
path: |
6969
${{ env.local_sdk_repo_dir }}/*.podspec
7070
${{ env.local_sdk_repo_dir }}/*.podspec.json
71-
buildup_SpecsTesting_repo:
71+
buildup_SpecsTesting_repo_FirebaseCore:
7272
needs: specs_checking
7373
# Don't run on private repo unless it is a PR.
7474
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
7575
runs-on: macos-12
76+
env:
77+
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
78+
local_repo: specstesting
79+
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
80+
targeted_pod: FirebaseCore
81+
steps:
82+
- uses: actions/checkout@v2
83+
- uses: actions/download-artifact@v3
84+
with:
85+
name: firebase-ios-sdk
86+
path: ${{ env.local_sdk_repo_dir }}
87+
- name: Get token
88+
run: |
89+
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
90+
bot-access.txt "$bot_token_secret"
91+
- name: Update SpecsTesting repo
92+
run: |
93+
botaccess=`cat bot-access.txt`
94+
cd scripts/create_spec_repo/
95+
swift build
96+
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
97+
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder /
98+
--sdk-repo "${local_sdk_repo_dir}" /
99+
--local-spec-repo-name "${local_repo}" /
100+
--sdk-repo-name SpecsTesting /
101+
--github-account Firebase /
102+
--pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" /
103+
--include-pods "${targeted_pod}" --keep-repo
104+
- name: Clean Artifacts
105+
if: ${{ always() }}
106+
run: |
107+
pod repo remove "${local_repo}"
108+
rm -rf bot-access.txt
109+
110+
buildup_SpecsTesting_repo:
111+
needs: [buildup_SpecsTesting_repo_FirebaseCore, specs_checking]
112+
# Don't run on private repo unless it is a PR.
113+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
114+
runs-on: macos-12
76115
strategy:
77116
fail-fast: false
78117
matrix: ${{fromJson(needs.specs_checking.outputs.matrix)}}
@@ -89,17 +128,25 @@ jobs:
89128
path: ${{ env.local_sdk_repo_dir }}
90129
- name: Get token
91130
run: |
92-
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/oss-bot-access.txt.gpg \
93-
oss-bot-access.txt "$bot_token_secret"
94131
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
95132
bot-access.txt "$bot_token_secret"
96133
- name: Update SpecsTesting repo
97134
run: |
135+
[[ ${{ matrix.podspec }} == true ]] && ALLOWWARNINGS=true
98136
botaccess=`cat bot-access.txt`
99137
cd scripts/create_spec_repo/
100138
swift build
101139
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
102-
BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" --include-pods "${targeted_pod}" --keep-repo
140+
# ${ALLOWWARNINGS:+--allow-warnings} will add --allow-warnings to the
141+
# command if ${ALLOWWARNINGS} is not null.
142+
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
143+
--sdk-repo "${local_sdk_repo_dir}" \
144+
--local-spec-repo-name "${local_repo}" \
145+
--sdk-repo-name SpecsTesting \
146+
--github-account Firebase \
147+
--pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
148+
--include-pods "${targeted_pod}" \
149+
--keep-repo ${ALLOWWARNINGS:+--allow-warnings}
103150
- name: Clean Artifacts
104151
if: ${{ always() }}
105152
run: |

.github/workflows/release.yml

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
jobs:
1818
specs_checking:
1919
# Don't run on private repo unless it is a PR.
20-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
20+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
2121
runs-on: macos-12
2222
env:
2323
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -49,13 +49,13 @@ jobs:
4949
sdk_version_config="${GITHUB_WORKSPACE}/scripts/create_spec_repo/RC_firebase_sdk.textproto" \
5050
local_sdk_repo_dir="${local_sdk_repo_dir}" \
5151
podspec_repo_branch="${podspec_repo_branch}" \
52-
scripts/release_testing_setup.sh prerelease_testing
52+
scripts/release_testing_setup.sh release_testing
5353
- name: Clean spec repo
5454
run: |
5555
botaccess=`cat bot-access.txt`
5656
git clone --quiet https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git "${local_repo}"
5757
cd "${local_repo}"
58-
# Remove all unhided dirs, i.e. all podspec dir from the spec repo.
58+
# Remove all unhidden dirs, i.e. all podspec dir from the spec repo.
5959
rm -Rf -- */
6060
git add .
6161
# commit without diff will throw an error. `git diff --exit-code` can avoid such error.
@@ -71,10 +71,47 @@ jobs:
7171
path: |
7272
${{ env.local_sdk_repo_dir }}/*.podspec
7373
${{ env.local_sdk_repo_dir }}/*.podspec.json
74-
buildup_SpecsTesting_repo:
74+
buildup_SpecsTesting_repo_FirebaseCore:
7575
needs: specs_checking
7676
# Don't run on private repo unless it is a PR.
77-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
77+
if: github.repository == 'Firebase/firebase-ios-sdk'
78+
runs-on: macos-12
79+
env:
80+
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
81+
local_repo: specstesting
82+
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
83+
targeted_pod: FirebaseCore
84+
steps:
85+
- uses: actions/checkout@v2
86+
- uses: actions/download-artifact@v3
87+
with:
88+
name: firebase-ios-sdk
89+
path: ${{ env.local_sdk_repo_dir }}
90+
- name: Get token
91+
run: |
92+
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
93+
bot-access.txt "$bot_token_secret"
94+
- name: Update SpecsTesting repo
95+
run: |
96+
botaccess=`cat bot-access.txt`
97+
cd scripts/create_spec_repo/
98+
swift build
99+
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git
100+
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
101+
--sdk-repo "${local_sdk_repo_dir}" \
102+
--local-spec-repo-name "${local_repo}" \
103+
--pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting' "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
104+
--include-pods "${targeted_pod}" --keep-repo
105+
- name: Clean Artifacts
106+
if: ${{ always() }}
107+
run: |
108+
pod repo remove "${local_repo}"
109+
rm -rf bot-access.txt
110+
111+
buildup_SpecsTesting_repo:
112+
needs: [buildup_SpecsTesting_repo_FirebaseCore, specs_checking]
113+
# Don't run on private repo unless it is a PR.
114+
if: github.repository == 'Firebase/firebase-ios-sdk'
78115
runs-on: macos-12
79116
strategy:
80117
fail-fast: false
@@ -96,11 +133,19 @@ jobs:
96133
bot-access.txt "$bot_token_secret"
97134
- name: Update SpecsTesting repo
98135
run: |
136+
[[ ${{ matrix.allowwarnings }} == true ]] && ALLOWWARNINGS=true
99137
botaccess=`cat bot-access.txt`
100138
cd scripts/create_spec_repo/
101139
swift build
102140
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git
103-
BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting' "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" --include-pods "${targeted_pod}" --keep-repo
141+
# ${ALLOWWARNINGS:+--allow-warnings} will add --allow-warnings to the
142+
# command if ${ALLOWWARNINGS} is not null.
143+
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
144+
--sdk-repo "${local_sdk_repo_dir}" \
145+
--local-spec-repo-name "${local_repo}" \
146+
--pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting' "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
147+
--include-pods "${targeted_pod}" \
148+
--keep-repo ${ALLOWWARNINGS:+--allow-warnings}
104149
- name: Clean Artifacts
105150
if: ${{ always() }}
106151
run: |

ReleaseTooling/Sources/ManifestParser/GHAMatrixSpecCollector.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,26 @@ import Utils
2525
/// ```
2626
struct SDKPodspec: Codable {
2727
let podspec: String
28+
let allowWarnings: Bool
2829
}
2930

3031
struct GHAMatrixSpecCollector {
3132
var SDKRepoURL: URL
3233
var outputSpecFileURL: URL
3334
var excludedSDKs: [String] = []
3435

35-
func getPodsInManifest(_ manifest: Manifest) -> [String] {
36-
var podsList: [String] = []
36+
func getPodsInManifest(_ manifest: Manifest) -> [String: SDKPodspec] {
37+
var podsMap: [String: SDKPodspec] = [:]
3738
for pod in manifest.pods {
38-
podsList.append(pod.name)
39+
podsMap[pod.name] = SDKPodspec(podspec: pod.name, allowWarnings: pod.allowWarnings)
3940
}
40-
return podsList
41+
return podsMap
4142
}
4243

43-
func getAllPodspecs() -> [String] {
44-
var output: [String] = []
44+
func getAllPodspecs() -> [SDKPodspec] {
45+
var output: [SDKPodspec] = []
4546
let fileManager = FileManager.default
46-
let podsSet = Set(getPodsInManifest(FirebaseManifest.shared))
47+
let podsMap = getPodsInManifest(FirebaseManifest.shared)
4748
do {
4849
let fileURLs = try fileManager.contentsOfDirectory(
4950
at: SDKRepoURL,
@@ -53,8 +54,11 @@ struct GHAMatrixSpecCollector {
5354
let fileNameComponents = url.lastPathComponent.components(separatedBy: ".")
5455
if fileNameComponents.count > 1, fileNameComponents[1] == "podspec" {
5556
let specName = fileNameComponents[0]
56-
podsSet.contains(specName) ? output
57-
.append(specName) : print("\(specName) is not in manifiest")
57+
if let spec = podsMap[specName] {
58+
output.append(spec)
59+
} else {
60+
print("\(specName) is not in manifiest")
61+
}
5862
}
5963
}
6064
} catch {
@@ -64,11 +68,7 @@ struct GHAMatrixSpecCollector {
6468
}
6569

6670
func generateMatrixJson(to filePath: URL) throws {
67-
let testingSpecs = getAllPodspecs()
68-
var sdkPodspecs: [SDKPodspec] = []
69-
for spec in testingSpecs {
70-
sdkPodspecs.append(SDKPodspec(podspec: spec))
71-
}
71+
let sdkPodspecs: [SDKPodspec] = getAllPodspecs()
7272
// Trim whitespaces so the GitHub Actions matrix can read.
7373
let str = try String(
7474
decoding: JSONEncoder().encode(sdkPodspecs),

scripts/create_spec_repo/Sources/SpecRepoBuilder/main.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ extension Constants {
2626
static let podSources = [
2727
"https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting",
2828
"https://github.com/firebase/SpecsStaging.git",
29+
// https://cdn.cocoapods.org is not used here since `--update-sources`
30+
// will update spec repos before a spec is pushed, but cdn is not a spec
31+
// repo.
2932
"https://github.com/CocoaPods/Specs.git",
3033
]
3134
}
@@ -34,7 +37,6 @@ extension Constants {
3437
extension Constants {
3538
static let flags = [
3639
"--skip-tests",
37-
"--allow-warnings",
3840
"--skip-import-validation",
3941
"--update-sources",
4042
]
@@ -155,6 +157,9 @@ struct SpecRepoBuilder: ParsableCommand {
155157
@Flag(help: "Raise error while circular dependency detected.")
156158
var raiseCircularDepError: Bool = false
157159

160+
@Flag(help: "Allow warnings when push a spec.")
161+
var allowWarnings: Bool = false
162+
158163
// This will track down dependencies of pods and keep the sequence of
159164
// dependency installation in specFiles.depInstallOrder.
160165
func generateOrderOfInstallation(pods: [String], specFiles: SpecFiles,
@@ -265,7 +270,8 @@ struct SpecRepoBuilder: ParsableCommand {
265270
func pushPodspec(forPod pod: URL, sdkRepo: String, sources: [String],
266271
flags: [String], shell: Shell = Shell.shared) throws -> Int32 {
267272
let sourcesArg = sources.joined(separator: ",")
268-
let flagsArg = flags.joined(separator: " ")
273+
let flagsArgArr = allowWarnings ?flags + ["--allow-warnings"] : flags
274+
let flagsArg = flagsArgArr.joined(separator: " ")
269275

270276
do {
271277
// Update the repo

scripts/release_testing_setup.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ test_version=$(git tag -l --sort=-version:refname CocoaPods-*[0-9] | head -n 1)
3737
git config --global user.email "[email protected]"
3838
git config --global user.name "google-oss-bot"
3939
git checkout "${podspec_repo_branch}"
40+
# Ensure the tag version including pod version to avoid warnings.
41+
# https://github.com/CocoaPods/Core/blob/e6451e172c33f3aa77a3f8baa7b6b5b8c3b5da14/lib/cocoapods-core/specification/linter.rb#L372-L374
42+
pod_testing_version=`echo "${test_version}" | sed "s/CocoaPods-//"`
4043
if [ "$TESTINGMODE" = "release_testing" ]; then
4144
git checkout "${test_version}"
4245
echo "Podspecs tags of Nightly release testing will be updated to ${test_version}."
4346
# Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
4447
# ":tag => 'CocoaPods-7.9.0'"
45-
sed -i "" "s/\s*:tag.*/:tag => '${test_version}'/" *.podspec
48+
sed -i "" "s/\s*:tag.*/:tag => '${test_version}'/" *.podspec
49+
sed -i "" "s/s\.version[[:space:]]*=.*/s\.version='${pod_testing_version}'/" *.podspec
4650
elif [ "$TESTINGMODE" = "prerelease_testing" ]; then
4751
tag_version="${test_version}.nightly"
4852
echo "A new tag, ${tag_version},for prerelease testing will be created."
@@ -55,5 +59,6 @@ elif [ "$TESTINGMODE" = "prerelease_testing" ]; then
5559
git push origin "${tag_version}"
5660
# Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
5761
# ":tag => ${test_version}.nightly"
58-
sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
62+
sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
63+
sed -i "" "s/s\.version[[:space:]]*=.*/s\.version='${pod_testing_version}'/" *.podspec
5964
fi

0 commit comments

Comments
 (0)