Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 51 additions & 4 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,50 @@ jobs:
path: |
${{ env.local_sdk_repo_dir }}/*.podspec
${{ env.local_sdk_repo_dir }}/*.podspec.json
buildup_SpecsTesting_repo:
buildup_SpecsTesting_repo_FirebaseCore:
needs: specs_checking
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
runs-on: macos-12
env:
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
local_repo: specstesting
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
targeted_pod: FirebaseCore
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: firebase-ios-sdk
path: ${{ env.local_sdk_repo_dir }}
- name: Get token
run: |
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
bot-access.txt "$bot_token_secret"
- name: Update SpecsTesting repo
run: |
botaccess=`cat bot-access.txt`
cd scripts/create_spec_repo/
swift build
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .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
- name: Clean Artifacts
if: ${{ always() }}
run: |
pod repo remove "${local_repo}"
rm -rf bot-access.txt

buildup_SpecsTesting_repo:
needs: [buildup_SpecsTesting_repo_FirebaseCore, specs_checking]
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
runs-on: macos-12
strategy:
fail-fast: false
matrix: ${{fromJson(needs.specs_checking.outputs.matrix)}}
Expand All @@ -89,17 +128,25 @@ jobs:
path: ${{ env.local_sdk_repo_dir }}
- name: Get token
run: |
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/oss-bot-access.txt.gpg \
oss-bot-access.txt "$bot_token_secret"
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
bot-access.txt "$bot_token_secret"
- name: Update SpecsTesting repo
run: |
[[ ${{ matrix.podspec }} == true ]] && ALLOWWARNINGS=true
botaccess=`cat bot-access.txt`
cd scripts/create_spec_repo/
swift build
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
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
# ${ALLOWWARNINGS:+--allow-warnings} will add --allow-warnings to the
# command if ${ALLOWWARNINGS} is not null.
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .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 ${ALLOWWARNINGS:+--allow-warnings}
- name: Clean Artifacts
if: ${{ always() }}
run: |
Expand Down
57 changes: 51 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
jobs:
specs_checking:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
runs-on: macos-12
env:
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -49,13 +49,13 @@ jobs:
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
scripts/release_testing_setup.sh release_testing
- name: Clean spec repo
run: |
botaccess=`cat bot-access.txt`
git clone --quiet https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git "${local_repo}"
cd "${local_repo}"
# Remove all unhided dirs, i.e. all podspec dir from the spec repo.
# Remove all unhidden dirs, i.e. all podspec dir from the spec repo.
rm -Rf -- */
git add .
# commit without diff will throw an error. `git diff --exit-code` can avoid such error.
Expand All @@ -71,10 +71,47 @@ jobs:
path: |
${{ env.local_sdk_repo_dir }}/*.podspec
${{ env.local_sdk_repo_dir }}/*.podspec.json
buildup_SpecsTesting_repo:
buildup_SpecsTesting_repo_FirebaseCore:
needs: specs_checking
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
if: github.repository == 'Firebase/firebase-ios-sdk'
runs-on: macos-12
env:
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
local_repo: specstesting
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
targeted_pod: FirebaseCore
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: firebase-ios-sdk
path: ${{ env.local_sdk_repo_dir }}
- name: Get token
run: |
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
bot-access.txt "$bot_token_secret"
- name: Update SpecsTesting repo
run: |
botaccess=`cat bot-access.txt`
cd scripts/create_spec_repo/
swift build
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .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
- name: Clean Artifacts
if: ${{ always() }}
run: |
pod repo remove "${local_repo}"
rm -rf bot-access.txt

buildup_SpecsTesting_repo:
needs: [buildup_SpecsTesting_repo_FirebaseCore, specs_checking]
# Don't run on private repo unless it is a PR.
if: github.repository == 'Firebase/firebase-ios-sdk'
runs-on: macos-12
strategy:
fail-fast: false
Expand All @@ -96,11 +133,19 @@ jobs:
bot-access.txt "$bot_token_secret"
- name: Update SpecsTesting repo
run: |
[[ ${{ matrix.allowwarnings }} == true ]] && ALLOWWARNINGS=true
botaccess=`cat bot-access.txt`
cd scripts/create_spec_repo/
swift build
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git
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
# ${ALLOWWARNINGS:+--allow-warnings} will add --allow-warnings to the
# command if ${ALLOWWARNINGS} is not null.
BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .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 ${ALLOWWARNINGS:+--allow-warnings}
- name: Clean Artifacts
if: ${{ always() }}
run: |
Expand Down
28 changes: 14 additions & 14 deletions ReleaseTooling/Sources/ManifestParser/GHAMatrixSpecCollector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ import Utils
/// ```
struct SDKPodspec: Codable {
let podspec: String
let allowWarnings: Bool
}

struct GHAMatrixSpecCollector {
var SDKRepoURL: URL
var outputSpecFileURL: URL
var excludedSDKs: [String] = []

func getPodsInManifest(_ manifest: Manifest) -> [String] {
var podsList: [String] = []
func getPodsInManifest(_ manifest: Manifest) -> [String: SDKPodspec] {
var podsMap: [String: SDKPodspec] = [:]
for pod in manifest.pods {
podsList.append(pod.name)
podsMap[pod.name] = SDKPodspec(podspec: pod.name, allowWarnings: pod.allowWarnings)
}
return podsList
return podsMap
}

func getAllPodspecs() -> [String] {
var output: [String] = []
func getAllPodspecs() -> [SDKPodspec] {
var output: [SDKPodspec] = []
let fileManager = FileManager.default
let podsSet = Set(getPodsInManifest(FirebaseManifest.shared))
let podsMap = getPodsInManifest(FirebaseManifest.shared)
do {
let fileURLs = try fileManager.contentsOfDirectory(
at: SDKRepoURL,
Expand All @@ -53,8 +54,11 @@ struct GHAMatrixSpecCollector {
let fileNameComponents = url.lastPathComponent.components(separatedBy: ".")
if fileNameComponents.count > 1, fileNameComponents[1] == "podspec" {
let specName = fileNameComponents[0]
podsSet.contains(specName) ? output
.append(specName) : print("\(specName) is not in manifiest")
if let spec = podsMap[specName] {
output.append(spec)
} else {
print("\(specName) is not in manifiest")
}
}
}
} catch {
Expand All @@ -64,11 +68,7 @@ struct GHAMatrixSpecCollector {
}

func generateMatrixJson(to filePath: URL) throws {
let testingSpecs = getAllPodspecs()
var sdkPodspecs: [SDKPodspec] = []
for spec in testingSpecs {
sdkPodspecs.append(SDKPodspec(podspec: spec))
}
let sdkPodspecs: [SDKPodspec] = getAllPodspecs()
// Trim whitespaces so the GitHub Actions matrix can read.
let str = try String(
decoding: JSONEncoder().encode(sdkPodspecs),
Expand Down
10 changes: 8 additions & 2 deletions scripts/create_spec_repo/Sources/SpecRepoBuilder/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ extension Constants {
static let podSources = [
"https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting",
"https://github.com/firebase/SpecsStaging.git",
// https://cdn.cocoapods.org is not used here since `--update-sources`
// will update spec repos before a spec is pushed, but cdn is not a spec
// repo.
"https://github.com/CocoaPods/Specs.git",
]
}
Expand All @@ -34,7 +37,6 @@ extension Constants {
extension Constants {
static let flags = [
"--skip-tests",
"--allow-warnings",
"--skip-import-validation",
"--update-sources",
]
Expand Down Expand Up @@ -155,6 +157,9 @@ struct SpecRepoBuilder: ParsableCommand {
@Flag(help: "Raise error while circular dependency detected.")
var raiseCircularDepError: Bool = false

@Flag(help: "Allow warnings when push a spec.")
var allowWarnings: Bool = false

// This will track down dependencies of pods and keep the sequence of
// dependency installation in specFiles.depInstallOrder.
func generateOrderOfInstallation(pods: [String], specFiles: SpecFiles,
Expand Down Expand Up @@ -265,7 +270,8 @@ struct SpecRepoBuilder: ParsableCommand {
func pushPodspec(forPod pod: URL, sdkRepo: String, sources: [String],
flags: [String], shell: Shell = Shell.shared) throws -> Int32 {
let sourcesArg = sources.joined(separator: ",")
let flagsArg = flags.joined(separator: " ")
let flagsArgArr = allowWarnings ?flags + ["--allow-warnings"] : flags
let flagsArg = flagsArgArr.joined(separator: " ")

do {
// Update the repo
Expand Down
9 changes: 7 additions & 2 deletions scripts/release_testing_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ test_version=$(git tag -l --sort=-version:refname CocoaPods-*[0-9] | head -n 1)
git config --global user.email "[email protected]"
git config --global user.name "google-oss-bot"
git checkout "${podspec_repo_branch}"
# Ensure the tag version including pod version to avoid warnings.
# https://github.com/CocoaPods/Core/blob/e6451e172c33f3aa77a3f8baa7b6b5b8c3b5da14/lib/cocoapods-core/specification/linter.rb#L372-L374
pod_testing_version=`echo "${test_version}" | sed "s/CocoaPods-//"`
if [ "$TESTINGMODE" = "release_testing" ]; then
git checkout "${test_version}"
echo "Podspecs tags of Nightly release testing will be updated to ${test_version}."
# Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
# ":tag => 'CocoaPods-7.9.0'"
sed -i "" "s/\s*:tag.*/:tag => '${test_version}'/" *.podspec
sed -i "" "s/\s*:tag.*/:tag => '${test_version}'/" *.podspec
sed -i "" "s/s\.version[[:space:]]*=.*/s\.version='${pod_testing_version}'/" *.podspec
elif [ "$TESTINGMODE" = "prerelease_testing" ]; then
tag_version="${test_version}.nightly"
echo "A new tag, ${tag_version},for prerelease testing will be created."
Expand All @@ -55,5 +59,6 @@ elif [ "$TESTINGMODE" = "prerelease_testing" ]; then
git push origin "${tag_version}"
# Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
# ":tag => ${test_version}.nightly"
sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
sed -i "" "s/s\.version[[:space:]]*=.*/s\.version='${pod_testing_version}'/" *.podspec
fi