Skip to content

Commit 33f1256

Browse files
authored
Transfer main branch testing podspec repo to open source. (#7869)
* Transfer master branch testing podspec repo to open source. * Update the tool to only remove dirs and retain CONTRIBUTION, LICENSE and README.md.
1 parent 724caed commit 33f1256

File tree

2 files changed

+44
-21
lines changed

2 files changed

+44
-21
lines changed

.github/workflows/prerelease.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- cron: '0 7 * * *'
1212

1313
jobs:
14-
buildup_SpecsReleasing_repo:
14+
buildup_SpecsTesting_repo:
1515
# Don't run on private repo unless it is a PR.
1616
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
1717
env:
@@ -31,17 +31,17 @@ jobs:
3131
oss-bot-access.txt "$bot_token_secret"
3232
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
3333
bot-access.txt "$bot_token_secret"
34-
- name: Update SpecsReleasing repo setup
34+
- name: Update SpecsTesting repo setup
3535
run: |
3636
ossbotaccess=`cat oss-bot-access.txt`
3737
BOT_TOKEN="${ossbotaccess}" test_version="${nightly_version}" sdk_version_config="${GITHUB_WORKSPACE}/scripts/create_spec_repo/RC_firebase_sdk.textproto" local_sdk_repo_dir="${local_sdk_repo_dir}" podspec_repo_branch="${podspec_repo_branch}" scripts/release_testing_setup.sh prerelease_testing
38-
- name: Update SpecsReleasing repo
38+
- name: Update SpecsTesting repo
3939
run: |
4040
botaccess=`cat bot-access.txt`
4141
cd scripts/create_spec_repo/
4242
swift build
43-
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsReleasing.git
44-
BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsReleasing --pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsReleasing' --pod-sources "https://github.com/firebase/SpecsDev.git" --pod-sources "https://github.com/firebase/SpecsStaging.git" --pod-sources "https://cdn.cocoapods.org/"
43+
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
44+
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' --pod-sources "https://github.com/firebase/SpecsDev.git" --pod-sources "https://github.com/firebase/SpecsStaging.git" --pod-sources "https://cdn.cocoapods.org/"
4545
- name: Clean Artifacts
4646
if: ${{ always() }}
4747
run: |
@@ -52,7 +52,7 @@ jobs:
5252
# Don't run on private repo unless it is a PR.
5353
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
5454

55-
needs: buildup_SpecsReleasing_repo
55+
needs: buildup_SpecsTesting_repo
5656
env:
5757
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
5858
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -86,7 +86,7 @@ jobs:
8686
auth_quickstart:
8787
# Don't run on private repo unless it is a PR.
8888
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
89-
needs: buildup_SpecsReleasing_repo
89+
needs: buildup_SpecsTesting_repo
9090
env:
9191
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
9292
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -120,7 +120,7 @@ jobs:
120120
crashlytics_quickstart:
121121
# Don't run on private repo unless it is a PR.
122122
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
123-
needs: buildup_SpecsReleasing_repo
123+
needs: buildup_SpecsTesting_repo
124124
env:
125125
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
126126
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -163,7 +163,7 @@ jobs:
163163
database_quickstart:
164164
# Don't run on private repo unless it is a PR.
165165
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
166-
needs: buildup_SpecsReleasing_repo
166+
needs: buildup_SpecsTesting_repo
167167
env:
168168
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
169169
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -201,7 +201,7 @@ jobs:
201201
dynamiclinks_quickstart:
202202
# Don't run on private repo unless it is a PR.
203203
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
204-
needs: buildup_SpecsReleasing_repo
204+
needs: buildup_SpecsTesting_repo
205205
env:
206206
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
207207
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -245,7 +245,7 @@ jobs:
245245
firestore_quickstart:
246246
# Don't run on private repo unless it is a PR.
247247
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
248-
needs: buildup_SpecsReleasing_repo
248+
needs: buildup_SpecsTesting_repo
249249
env:
250250
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
251251
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -282,7 +282,7 @@ jobs:
282282
functions_quickstart:
283283
# Don't run on private repo unless it is a PR.
284284
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
285-
needs: buildup_SpecsReleasing_repo
285+
needs: buildup_SpecsTesting_repo
286286
env:
287287
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
288288
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -324,7 +324,7 @@ jobs:
324324
inappmessaging_quickstart:
325325
# Don't run on private repo unless it is a PR.
326326
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
327-
needs: buildup_SpecsReleasing_repo
327+
needs: buildup_SpecsTesting_repo
328328
env:
329329
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
330330
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -364,7 +364,7 @@ jobs:
364364
messaging_quickstart:
365365
# Don't run on private repo unless it is a PR.
366366
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
367-
needs: buildup_SpecsReleasing_repo
367+
needs: buildup_SpecsTesting_repo
368368
env:
369369
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
370370
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -404,7 +404,7 @@ jobs:
404404
remoteconfig_quickstart:
405405
# Don't run on private repo unless it is a PR.
406406
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
407-
needs: buildup_SpecsReleasing_repo
407+
needs: buildup_SpecsTesting_repo
408408
env:
409409
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
410410
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -438,7 +438,7 @@ jobs:
438438
storage_quickstart:
439439
# Don't run on private repo unless it is a PR.
440440
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
441-
needs: buildup_SpecsReleasing_repo
441+
needs: buildup_SpecsTesting_repo
442442
env:
443443
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
444444
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -476,7 +476,7 @@ jobs:
476476
performance_quickstart:
477477
# Don't run on private repo unless it is a PR.
478478
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
479-
needs: buildup_SpecsReleasing_repo
479+
needs: buildup_SpecsTesting_repo
480480
env:
481481
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
482482
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}

scripts/create_spec_repo/Sources/SpecRepoBuilder/main.swift

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension Constants {
2323
static let skipLinesWithWords = ["unit_tests", "test_spec"]
2424
static let dependencyLineSeparators = CharacterSet(charactersIn: " ,/")
2525
static let podSources = [
26-
"https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting",
26+
"https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting",
2727
"https://github.com/firebase/SpecsStaging.git",
2828
"https://cdn.cocoapods.org/",
2929
]
@@ -100,6 +100,8 @@ enum SpecRepoBuilderError: Error {
100100
case failedToPush(pods: [String])
101101
// Error occurs when a podspec is not found in the repo.
102102
case podspecNotFound(_ podspec: String, from: String)
103+
// Error occurs when a direotyr path cannot be determined.
104+
case pathNotFound(_ path: String)
103105
}
104106

105107
struct SpecRepoBuilder: ParsableCommand {
@@ -258,10 +260,31 @@ struct SpecRepoBuilder: ParsableCommand {
258260
)
259261
let fileManager = FileManager.default
260262
do {
261-
let dirs = try fileManager.contentsOfDirectory(atPath: "\(repoPath)/\(sdkRepoName)")
263+
let sdk_repo_path = "\(repoPath)/\(sdkRepoName)"
264+
print("The repo path is \(sdk_repo_path)")
265+
guard let repo_url = URL(string: sdk_repo_path) else {
266+
print("Error: cannot find \(sdk_repo_path).")
267+
Self
268+
.exit(withError: SpecRepoBuilderError
269+
.pathNotFound(sdk_repo_path))
270+
}
271+
// Skip hidden files, e.g. /.git
272+
let dirs = try fileManager.contentsOfDirectory(
273+
at: repo_url,
274+
includingPropertiesForKeys: nil,
275+
options: [.skipsHiddenFiles]
276+
)
277+
print("Found following unhidden dirs: \(dirs)")
262278
for dir in dirs {
263-
if dir != ".git" {
264-
shell.run("cd \(sdkRepoName); git rm -r \(dir)")
279+
guard let isDir = (try dir.resourceValues(forKeys: [.isDirectoryKey])).isDirectory else {
280+
print("Error: cannot determine if \(dir.path) is a directory or not.")
281+
Self
282+
.exit(withError: SpecRepoBuilderError
283+
.pathNotFound(dir.path))
284+
}
285+
if isDir {
286+
print("Removing \(dir.path)")
287+
shell.run("cd \(sdkRepoName); git rm -r \(dir.path)")
265288
}
266289
}
267290
shell.run("cd \(sdkRepoName); git commit -m 'Empty repo'; git push")

0 commit comments

Comments
 (0)