diff --git a/.github/workflows/abtesting.yml b/.github/workflows/abtesting.yml index 78327c72ca9..5a69d6f17fe 100644 --- a/.github/workflows/abtesting.yml +++ b/.github/workflows/abtesting.yml @@ -45,10 +45,9 @@ jobs: uses: ./.github/workflows/common_quickstart.yml with: product: ABTesting - is_legacy: true - setup_command: scripts/setup_quickstart.sh abtesting - plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg - plist_dst_path: quickstart-ios/database/GoogleService-Info.plist + setup_command: scripts/setup_quickstart_spm.sh abtesting + plist_src_path: scripts/gha-encrypted/qs-abtesting.plist.gpg + plist_dst_path: quickstart-ios/abtesting/GoogleService-Info.plist secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} @@ -66,8 +65,6 @@ jobs: with: python-version: '3.11' - name: Setup quickstart - env: - LEGACY: true run: scripts/setup_quickstart.sh abtesting - name: Install Secret GoogleService-Info.plist run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \ @@ -75,8 +72,6 @@ jobs: - name: Xcode run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - name: Build swift quickstart - env: - LEGACY: true run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh ABTesting) - id: ftl_test uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 diff --git a/.github/workflows/auth.yml b/.github/workflows/auth.yml index 59626a1a4b8..fd9cce9f5be 100644 --- a/.github/workflows/auth.yml +++ b/.github/workflows/auth.yml @@ -97,8 +97,7 @@ jobs: uses: ./.github/workflows/common_quickstart.yml with: product: Authentication - is_legacy: false - setup_command: scripts/setup_quickstart.sh authentication + setup_command: scripts/setup_quickstart_spm.sh authentication plist_src_path: scripts/gha-encrypted/qs-authentication.plist.gpg plist_dst_path: quickstart-ios/authentication/GoogleService-Info.plist run_tests: false @@ -141,6 +140,5 @@ jobs: platforms: '[ "ios", "tvos --skip-tests", "macos --skip-tests", "watchos --skip-tests" ]' flags: '[ "--use-static-frameworks" ]' setup_command: scripts/configure_test_keychain.sh - ignore_deprecation_warnings: true secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} diff --git a/.github/workflows/common_quickstart.yml b/.github/workflows/common_quickstart.yml index 3ced9e62959..ef41a4332ba 100644 --- a/.github/workflows/common_quickstart.yml +++ b/.github/workflows/common_quickstart.yml @@ -29,10 +29,11 @@ on: type: string required: true - # Whether to test the legacy version of the quickstart. - is_legacy: - type: boolean - required: true + # The branch to checkout in the quickstart repo. + quickstart_branch: + type: string + required: false + default: 'main' # The path to the encrypted `GoogleService-Info.plist` file. plist_src_path: @@ -44,14 +45,6 @@ on: type: string required: true - # The type of quickstart to test. - # - # Options: [swift, objc] - quickstart_type: - type: string - required: false - default: objc - # Whether to run tests or just build. Defaults to true. run_tests: type: boolean @@ -68,15 +61,18 @@ on: jobs: quickstart: + name: quickstart (${{ inputs.product }}) # Run on the main repo's scheduled jobs or pull requests and manual workflow invocations. if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name) env: plist_secret: ${{ secrets.plist_secret }} - LEGACY: ${{ inputs.is_legacy && true || '' }} + QUICKSTART_BRANCH: ${{ inputs.quickstart_branch }} runs-on: macos-15 steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + - name: Prereqs + run: gem install xcpretty - name: Xcode run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - name: Run setup command. @@ -87,17 +83,16 @@ jobs: ${{ inputs.plist_src_path }} \ ${{ inputs.plist_dst_path }} \ "$plist_secret" - - name: Build ${{ inputs.product }} Quickstart (${{ inputs.quickstart_type }} / ${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }}) + - name: Build ${{ inputs.product }} Quickstart uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 with: timeout_minutes: 15 max_attempts: 3 retry_wait_seconds: 120 command: | - scripts/test_quickstart.sh \ + SPM=true DIR=${{ inputs.product }} scripts/test_quickstart.sh \ ${{ inputs.product }} \ - ${{ inputs.run_tests }} \ - ${{ inputs.quickstart_type }} + ${{ inputs.run_tests }} # Failure sequence to upload artifact. - id: lowercase_product if: failure() diff --git a/.github/workflows/crashlytics.yml b/.github/workflows/crashlytics.yml index d3f712b913e..8e074482d08 100644 --- a/.github/workflows/crashlytics.yml +++ b/.github/workflows/crashlytics.yml @@ -47,14 +47,7 @@ jobs: uses: ./.github/workflows/common_quickstart.yml with: product: Crashlytics - is_legacy: true - quickstart_type: swift - setup_command: | - scripts/setup_quickstart.sh crashlytics - mkdir quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics - # Set the deployed pod location of run and upload-symbols with the development pod version. - cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ + setup_command: scripts/setup_quickstart_spm.sh crashlytics plist_src_path: scripts/gha-encrypted/qs-crashlytics.plist.gpg plist_dst_path: quickstart-ios/crashlytics/GoogleService-Info.plist secrets: @@ -77,20 +70,12 @@ jobs: run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - name: Setup quickstart run: scripts/setup_quickstart.sh crashlytics - env: - LEGACY: true - name: Install Secret GoogleService-Info.plist run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-crashlytics.plist.gpg \ quickstart-ios/crashlytics/GoogleService-Info.plist "$plist_secret" - name: Build swift quickstart run: | - mkdir quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics - # Set the deployed pod location of run and upload-symbols with the development pod version. - cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Crashlytics swift) - env: - LEGACY: true - id: ftl_test uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 with: diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index 04396da47ab..b75ecb9f8a3 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -72,16 +72,11 @@ jobs: quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: Database - is_legacy: false - setup_command: scripts/setup_quickstart.sh database + setup_command: scripts/setup_quickstart_spm.sh database plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg plist_dst_path: quickstart-ios/database/GoogleService-Info.plist - quickstart_type: ${{ matrix.quickstart_type }} run_tests: false secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} diff --git a/.github/workflows/firestore.yml b/.github/workflows/firestore.yml index 548153496f4..4c3e9726425 100644 --- a/.github/workflows/firestore.yml +++ b/.github/workflows/firestore.yml @@ -605,8 +605,7 @@ jobs: # uses: ./.github/workflows/common_quickstart.yml # with: # product: Firestore - # is_legacy: true - # setup_command: scripts/setup_quickstart.sh firestore + # setup_command: scripts/setup_quickstart_spm.sh firestore # plist_src_path: scripts/gha-encrypted/qs-firestore.plist.gpg # plist_dst_path: quickstart-ios/firestore/GoogleService-Info.plist # run_tests: false diff --git a/.github/workflows/functions.yml b/.github/workflows/functions.yml index 42d7b0c1395..07cafd50e4e 100644 --- a/.github/workflows/functions.yml +++ b/.github/workflows/functions.yml @@ -51,23 +51,7 @@ jobs: with: target: FirebaseFunctionsUnit - # TODO: The legacy quickstart uses material which doesn't build on Xcode 15. - # quickstart: - # uses: ./.github/workflows/common_quickstart.yml - # strategy: - # matrix: - # quickstart_type: [objc, swift] - # with: - # product: Functions - # is_legacy: true - # setup_command: | - # scripts/setup_quickstart.sh functions - # sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist - # plist_src_path: scripts/gha-encrypted/qs-functions.plist.gpg - # plist_dst_path: quickstart-ios/functions/GoogleService-Info.plist - # quickstart_type: ${{ matrix.quickstart_type }} - # secrets: - # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # TODO(ncooke3): Add a Functions quickstart test. # quickstart-ftl-cron-only: # # Don't run on private repo diff --git a/.github/workflows/inappmessaging.yml b/.github/workflows/inappmessaging.yml index d0633743721..b7ace6a847a 100644 --- a/.github/workflows/inappmessaging.yml +++ b/.github/workflows/inappmessaging.yml @@ -74,15 +74,11 @@ jobs: quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: InAppMessaging - is_legacy: false - quickstart_type: ${{ matrix.quickstart_type }} - setup_command: scripts/setup_quickstart.sh inappmessaging + setup_command: scripts/setup_quickstart_spm.sh inappmessaging plist_src_path: scripts/gha-encrypted/qs-inappmessaging.plist.gpg plist_dst_path: quickstart-ios/inappmessaging/GoogleService-Info.plist + run_tests: false secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} diff --git a/.github/workflows/installations.yml b/.github/workflows/installations.yml index ff7fde15883..1d236e40983 100644 --- a/.github/workflows/installations.yml +++ b/.github/workflows/installations.yml @@ -51,16 +51,11 @@ jobs: quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: Installations - is_legacy: false - setup_command: scripts/setup_quickstart.sh installations + setup_command: scripts/setup_quickstart_spm.sh installations plist_src_path: scripts/gha-encrypted/Installations/GoogleService-Info.plist.gpg plist_dst_path: quickstart-ios/installations/GoogleService-Info.plist - quickstart_type: ${{ matrix.quickstart_type }} secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} diff --git a/.github/workflows/messaging.yml b/.github/workflows/messaging.yml index 993cfb543dd..f1ab4cb2f1f 100644 --- a/.github/workflows/messaging.yml +++ b/.github/workflows/messaging.yml @@ -83,14 +83,9 @@ jobs: quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: Messaging - is_legacy: false - quickstart_type: ${{ matrix.quickstart_type }} - setup_command: scripts/setup_quickstart.sh messaging + setup_command: scripts/setup_quickstart_spm.sh messaging plist_src_path: scripts/gha-encrypted/qs-messaging.plist.gpg plist_dst_path: quickstart-ios/messaging/GoogleService-Info.plist run_tests: false diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 9d1f35594e6..19a6e044a73 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -78,14 +78,11 @@ jobs: #TODO: tests are not supported with Xcode 15 because the test spec depends on the iOS 8 GDCWebServer buildonly_platforms: iOS, tvOS - # TODO: The legacy ObjC quickstarts don't run with Xcode 15, re-able if we get these working. quickstart: uses: ./.github/workflows/common_quickstart.yml with: product: Performance - is_legacy: false - quickstart_type: swift - setup_command: scripts/setup_quickstart.sh performance + setup_command: scripts/setup_quickstart_spm.sh performance plist_src_path: scripts/gha-encrypted/qs-performance.plist.gpg plist_dst_path: quickstart-ios/performance/GoogleService-Info.plist secrets: diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 00000000000..e6575f9a614 --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,128 @@ +name: prerelease + +permissions: + contents: read + +on: + pull_request: + # closed will be triggered when a pull request is merged. This is to keep https://github.com/firebase/SpecsTesting up to date. + # types: [closed] # TODO(ncooke3): Uncomment. + paths: + - '.github/workflows/prerelease.yml' + workflow_dispatch: + schedule: + # Run every day at 10pm (PDT) / 1am (EDT) - cron uses UTC times + - cron: '0 5 * * *' + +env: + FIREBASE_CI: true + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + # TODO: The functions quickstart uses Material which isn't supported by Xcode 15 + #functions_quickstart: + # 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' + # needs: buildup_SpecsTesting_repo + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }} + # # TODO: The functions quickstart uses Material which isn't supported by Xcode 15 + # runs-on: macos-12 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup testing repo and quickstart + # run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh functions prerelease_testing + # - name: install secret googleservice-info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-functions.plist.gpg \ + # quickstart-ios/functions/GoogleService-Info.plist "$plist_secret" + # - name: Setup custom URL scheme + # run: sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist + # - name: Test objc quickstart + # run: ([ -z $plist_secret ] || + # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true) + # - name: Test swift quickstart + # run: ([ -z $plist_secret ] || + # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true swift) + # - name: Remove data before upload + # if: ${{ failure() }} + # run: scripts/remove_data.sh functions + # - uses: actions/upload-artifact@v4 + # if: ${{ failure() }} + # with: + # name: quickstart_artifacts_functions + # path: quickstart-ios/ + + quickstart: + # Don't run on private repo unless it is a PR. + if: | + github.repository == 'firebase/firebase-ios-sdk' && + contains(fromJSON('["schedule", "pull_request", "workflow_dispatch"]'), github.event_name) + strategy: + fail-fast: false + matrix: + include: + - product: Performance + run_tests: true + - product: Storage + run_tests: false + - product: Config + run_tests: true + - product: Messaging + run_tests: false + - product: InAppMessaging + run_tests: false + - product: Firestore + run_tests: false + - product: Database + run_tests: false + - product: Authentication + run_tests: false + - product: Crashlytics + run_tests: true + - product: ABTesting + run_tests: true + name: 'quickstart (prerelease, ${{ matrix.product }}, run_tests: ${{ matrix.run_tests }})' + env: + plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }} + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + - name: Prereqs + run: gem install xcpretty + - name: Xcode + run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + - name: Setup testing repo and quickstart + run: scripts/setup_quickstart_spm.sh ${{ matrix.product }} prerelease_testing + - name: Install Secret GoogleService-Info.plist + run: | + scripts/decrypt_gha_secret.sh \ + scripts/gha-encrypted/qs-${{ matrix.product }}.plist.gpg \ + quickstart-ios/${{ matrix.product }}/GoogleService-Info.plist \ + "$plist_secret" + - name: Build Quickstart + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + with: + timeout_minutes: 15 + max_attempts: 3 + retry_wait_seconds: 120 + command: DIR=${{ matrix.product }} scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} + # Failure sequence to upload artifact. + - name: Remove data before upload. + if: ${{ failure() }} + run: scripts/remove_data.sh ${{ matrix.product }} + - uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: quickstart_artifacts_${{ matrix.product }} + path: | + quickstart-ios/ + !quickstart-ios/**/GoogleService-Info.plist diff --git a/.github/workflows/prerelease_cocoapods.yml b/.github/workflows/prerelease_cocoapods.yml index f74adfb6e7d..684716b9c8b 100644 --- a/.github/workflows/prerelease_cocoapods.yml +++ b/.github/workflows/prerelease_cocoapods.yml @@ -214,138 +214,3 @@ jobs: 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 $(pwd) --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://cdn.cocoapods.org/" "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" --keep-repo --include-pods "${updated_podspecs[@]}" - - # TODO: The functions quickstart uses Material which isn't supported by Xcode 15 - #functions_quickstart: - # 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' - # needs: buildup_SpecsTesting_repo - # env: - # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - # botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }} - # LEGACY: true - # # TODO: The functions quickstart uses Material which isn't supported by Xcode 15 - # runs-on: macos-12 - # steps: - # - uses: actions/checkout@v4 - # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - # - name: Xcode - # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - # - name: Setup testing repo and quickstart - # run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh functions prerelease_testing - # - name: install secret googleservice-info.plist - # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-functions.plist.gpg \ - # quickstart-ios/functions/GoogleService-Info.plist "$plist_secret" - # - name: Setup custom URL scheme - # run: sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist - # - name: Test objc quickstart - # run: ([ -z $plist_secret ] || - # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true) - # - name: Test swift quickstart - # run: ([ -z $plist_secret ] || - # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true swift) - # - name: Remove data before upload - # if: ${{ failure() }} - # run: scripts/remove_data.sh functions - # - uses: actions/upload-artifact@v4 - # if: ${{ failure() }} - # with: - # name: quickstart_artifacts_functions - # path: quickstart-ios/ - - quickstart: - # 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' - needs: buildup_SpecsTesting_repo - strategy: - matrix: - include: - - product: Performance - run_tests: true - swift: true - - product: Storage - is_legacy: true - run_tests: true - swift: true - - product: Config - run_tests: true - objc: true - - product: Messaging - run_tests: false - swift: true - objc: true - - product: InAppMessaging - run_tests: true - swift: true - objc: true - - product: Firestore - run_tests: false - - product: Database - run_tests: false - swift: true - objc: true - - product: Authentication - run_tests: false - objc: true - - product: Crashlytics - is_legacy: true - run_tests: true - objc: false - swift: true - setup_command: | - mkdir -p quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics - # Set the deployed pod location of run and upload-symbols with the development pod version. - cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - - product: ABTesting - is_legacy: true - run_tests: true - objc: true - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }} - LEGACY: ${{ matrix.is_legacy && true || '' }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup testing repo and quickstart - run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh ${{ matrix.product }} prerelease_testing - - name: Install Secret GoogleService-Info.plist - run: | - scripts/decrypt_gha_secret.sh \ - scripts/gha-encrypted/qs-${{ matrix.product }}.plist.gpg \ - quickstart-ios/${{ matrix.product }}/GoogleService-Info.plist \ - "$plist_secret" - - name: Run setup command, if needed. - if: matrix.setup_command != '' - run: ${{ matrix.setup_command }} - - name: Build Swift quickstart - if: matrix.swift == true - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} swift - - name: Build Obj-C quickstart - if: matrix.objc == true - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} - # Failure sequence to upload artifact. - - name: Remove data before upload. - if: failure() - run: scripts/remove_data.sh ${{ matrix.product }} - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: quickstart_artifacts_${{ matrix.product }} - path: | - quickstart-ios/ - !quickstart-ios/**/GoogleService-Info.plist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..0a3d4842b53 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,123 @@ +name: release + +permissions: + contents: read + +on: + pull_request: + paths: + - '.github/workflows/release.yml' + - 'Gemfile*' + workflow_dispatch: + schedule: + # Run every day at 10pm (PDT) / 1am (EDT) - cron uses UTC times + - cron: '0 5 * * *' + +env: + FIREBASE_CI: true + FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: true + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + # TODO: The functions quickstart uses Material which isn't supported by Xcode 15 + # functions_quickstart: + # # 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' + # needs: buildup_SpecsReleasing_repo + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # botaccess: ${{ secrets.RELEASE_TESTING_PAT }} + # runs-on: macos-12 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup testing repo and quickstart + # run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh functions nightly_release_testing + # - name: install secret googleservice-info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-functions.plist.gpg \ + # quickstart-ios/functions/GoogleService-Info.plist "$plist_secret" + # - name: Setup custom URL scheme + # run: sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist + # - name: Test objc quickstart + # run: ([ -z $plist_secret ] || + # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true) + # - name: Test swift quickstart + # run: ([ -z $plist_secret ] || + # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true swift) + # - name: Remove data before upload + # if: ${{ failure() }} + # run: scripts/remove_data.sh functions + # - uses: actions/upload-artifact@v4 + # if: ${{ failure() }} + # with: + # name: quickstart_artifacts_functions + # path: quickstart-ios/ + + quickstart: + if: | + github.repository == 'firebase/firebase-ios-sdk' && + contains(fromJSON('["schedule", "pull_request", "workflow_dispatch"]'), github.event_name) + strategy: + fail-fast: false + matrix: + include: + - product: Performance + run_tests: true + - product: Storage + run_tests: false + - product: Config + run_tests: true + - product: Messaging + run_tests: false + - product: InAppMessaging + run_tests: false + - product: Firestore + run_tests: false + - product: Database + run_tests: false + - product: Authentication + run_tests: false + - product: Crashlytics + run_tests: true + - product: ABTesting + run_tests: false + name: 'quickstart (release, ${{ matrix.product }}, run_tests: ${{ matrix.run_tests }})' + env: + plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + botaccess: ${{ secrets.RELEASE_TESTING_PAT }} + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for pulling down repo tags. + - name: Set Xcode version + run: sudo xcode-select -s /Applications/Xcode_16.4.app + - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + - name: Prereqs + run: gem install xcpretty + - name: Setup testing repo and quickstart + run: scripts/setup_quickstart_spm.sh ${{ matrix.product }} nightly_release_testing + - name: Install Secret GoogleService-Info.plist + run: | + scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-${{ matrix.product }}.plist.gpg \ + quickstart-ios/${{ matrix.product }}/GoogleService-Info.plist "$plist_secret" + - name: Build Quickstart + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + with: + timeout_minutes: 15 + max_attempts: 3 + retry_wait_seconds: 120 + command: DIR=${{ matrix.product }} scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} + - name: Remove data before upload + if: failure() + run: scripts/remove_data.sh ${{ matrix.product }} + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: quickstart_artifacts_${{ matrix.product }} + path: | + quickstart-ios/ + !quickstart-ios/**/GoogleService-Info.plist diff --git a/.github/workflows/release_cocoapods.yml b/.github/workflows/release_cocoapods.yml index 4ec26a41272..c75b089802c 100644 --- a/.github/workflows/release_cocoapods.yml +++ b/.github/workflows/release_cocoapods.yml @@ -152,132 +152,3 @@ jobs: - name: Clean Artifacts if: ${{ always() }} run: pod repo remove "${local_repo}" - - quickstart: - # 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' - needs: buildup_SpecsReleasing_repo - strategy: - matrix: - include: - - product: Performance - run_tests: true - swift: true - - product: Storage - run_tests: true - swift: true - is_legacy: true - - product: Config - run_tests: true - objc: true - - product: Messaging - run_tests: false - objc: true - swift: true - - product: InAppMessaging - run_tests: true - objc: true - swift: true - - product: Firestore - run_tests: false - objc: true - - product: Database - run_tests: false - objc: true - swift: true - - product: Authentication - run_tests: false - objc: true - - product: Crashlytics - run_tests: true - swift: true - is_legacy: true - setup_command: | - mkdir -p quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics - # Set the deployed pod location of run and upload-symbols with the development pod version. - cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - - product: ABTesting - run_tests: true - objc: true - is_legacy: true - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - botaccess: ${{ secrets.RELEASE_TESTING_PAT }} - LEGACY: ${{ matrix.is_legacy && true || '' }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - name: Set Xcode version - run: sudo xcode-select -s /Applications/Xcode_16.4.app - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup testing repo and quickstart - run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh ${{ matrix.product }} nightly_release_testing - - name: Install Secret GoogleService-Info.plist - run: | - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-${{ matrix.product }}.plist.gpg \ - quickstart-ios/${{ matrix.product }}/GoogleService-Info.plist "$plist_secret" - - name: Run setup command, if needed. - if: matrix.setup_command != '' - run: ${{ matrix.setup_command }} - - name: Build Obj-C quickstart - if: matrix.objc == true - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} - - name: Build Swift quickstart - if: matrix.swift == true - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} swift - - name: Remove data before upload - if: failure() - run: scripts/remove_data.sh ${{ matrix.product }} - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: quickstart_artifacts_${{ matrix.product }} - path: | - quickstart-ios/ - !quickstart-ios/**/GoogleService-Info.plist - - # TODO: The functions quickstart uses Material which isn't supported by Xcode 15 - # functions_quickstart: - # # 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' - # needs: buildup_SpecsReleasing_repo - # env: - # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - # botaccess: ${{ secrets.RELEASE_TESTING_PAT }} - # LEGACY: true - # runs-on: macos-12 - # steps: - # - uses: actions/checkout@v4 - # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - # - name: Setup testing repo and quickstart - # run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh functions nightly_release_testing - # - name: install secret googleservice-info.plist - # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-functions.plist.gpg \ - # quickstart-ios/functions/GoogleService-Info.plist "$plist_secret" - # - name: Setup custom URL scheme - # run: sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist - # - name: Test objc quickstart - # run: ([ -z $plist_secret ] || - # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true) - # - name: Test swift quickstart - # run: ([ -z $plist_secret ] || - # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true swift) - # - name: Remove data before upload - # if: ${{ failure() }} - # run: scripts/remove_data.sh functions - # - uses: actions/upload-artifact@v4 - # if: ${{ failure() }} - # with: - # name: quickstart_artifacts_functions - # path: quickstart-ios/ diff --git a/.github/workflows/remoteconfig.yml b/.github/workflows/remoteconfig.yml index 9d6fe55f330..36ba73ed473 100644 --- a/.github/workflows/remoteconfig.yml +++ b/.github/workflows/remoteconfig.yml @@ -94,8 +94,7 @@ jobs: uses: ./.github/workflows/common_quickstart.yml with: product: Config - is_legacy: false - setup_command: scripts/setup_quickstart.sh config + setup_command: scripts/setup_quickstart_spm.sh config plist_src_path: scripts/gha-encrypted/qs-config.plist.gpg plist_dst_path: quickstart-ios/config/GoogleService-Info.plist secrets: diff --git a/.github/workflows/storage.yml b/.github/workflows/storage.yml index 12bbb9bf86d..9aae03de131 100644 --- a/.github/workflows/storage.yml +++ b/.github/workflows/storage.yml @@ -83,9 +83,7 @@ jobs: uses: ./.github/workflows/common_quickstart.yml with: product: Storage - quickstart_type: swift - is_legacy: true - setup_command: scripts/setup_quickstart.sh storage + setup_command: scripts/setup_quickstart_spm.sh storage plist_src_path: scripts/gha-encrypted/qs-storage.plist.gpg plist_dst_path: quickstart-ios/storage/GoogleService-Info.plist run_tests: false @@ -97,7 +95,6 @@ jobs: if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' env: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - LEGACY: true runs-on: macos-15 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/zip.yml b/.github/workflows/zip.yml index d698a01a20a..db5055fb93e 100644 --- a/.github/workflows/zip.yml +++ b/.github/workflows/zip.yml @@ -231,8 +231,6 @@ jobs: mkdir -p "${HOME}"/ios_frameworks/ find "${GITHUB_WORKSPACE}" -name "Firebase*latest.zip" -exec unzip -d "${HOME}"/ios_frameworks/ {} + - name: Setup quickstart - env: - LEGACY: true run: SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \ "${HOME}"/ios_frameworks/Firebase/FirebaseRemoteConfig/* \ "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/FirebaseCore.xcframework \ @@ -244,8 +242,6 @@ jobs: run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \ quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret" - name: Test Quickstart - env: - LEGACY: true run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}") - uses: actions/upload-artifact@v4 if: failure() @@ -384,29 +380,23 @@ jobs: mkdir -p "${HOME}"/ios_frameworks/ find "${GITHUB_WORKSPACE}" -name "Firebase*latest.zip" -exec unzip -d "${HOME}"/ios_frameworks/ {} + - name: Setup quickstart - env: - LEGACY: true run: | - SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \ - "${HOME}"/ios_frameworks/Firebase/FirebaseCrashlytics/* \ - "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/* - cp quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Firebase/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart - cp quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Firebase/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart - chmod +x quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/run - chmod +x quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/upload-symbols - # TODO(#8057): Restore Swift Quickstart - # - name: Setup swift quickstart - # env: - # LEGACY: true - # run: | - # SAMPLE="$SDK" TARGET="${SDK}ExampleSwift" NON_FIREBASE_SDKS="ReachabilitySwift" scripts/setup_quickstart_framework.sh \ - # "${HOME}"/ios_frameworks/Firebase/NonFirebaseSDKs/* + rm -rf "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/FirebaseAnalytics* + rm -rf "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/GoogleAppMeasurement* + rm -rf "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/GoogleAds* + SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \ + "${HOME}"/ios_frameworks/Firebase/FirebaseCrashlytics/* \ + "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/* + - name: Add frameworks to Crashlytics watchOS target + run: | + cd quickstart-ios/crashlytics + "${GITHUB_WORKSPACE}"/quickstart-ios/scripts/add_framework_script.rb --sdk "Crashlytics" --target "CrashlyticsExample_(watchOS)_Extension" --framework_path Firebase/ + - name: Patch Crashlytics Run Script Path + run: scripts/patch_crashlytics_run_path.rb - name: Install Secret GoogleService-Info.plist run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-crashlytics.plist.gpg \ quickstart-ios/crashlytics/GoogleService-Info.plist "$plist_secret" - name: Test Quickstart - env: - LEGACY: true run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}") - uses: actions/upload-artifact@v4 if: failure() @@ -467,8 +457,8 @@ jobs: !quickstart-ios/**/GoogleService-Info.plist quickstart_framework_firebaseai: - needs: package-head - if: ${{ !cancelled() && (success() || github.event.inputs.zip_run_id != '') }} + needs: packaging_done + if: ${{ !cancelled() }} env: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} SDK: "FirebaseAI" @@ -487,7 +477,7 @@ jobs: uses: actions/download-artifact@v4.1.7 with: name: ${{ matrix.artifact }} - run-id: ${{ github.event.inputs.zip_run_id || github.run_id }} + run-id: ${{ needs.packaging_done.outputs.run_id }} github-token: ${{ secrets.GITHUB_TOKEN }} - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - name: Xcode @@ -609,15 +599,11 @@ jobs: run: SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \ "${HOME}"/ios_frameworks/Firebase/FirebaseInAppMessaging/* \ "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/* - - name: Setup swift quickstart - run: SAMPLE="$SDK" TARGET="${SDK}ExampleSwift" scripts/setup_quickstart_framework.sh - name: Install Secret GoogleService-Info.plist run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-inappmessaging.plist.gpg \ quickstart-ios/inappmessaging/GoogleService-Info.plist "$plist_secret" - - name: Test Quickstart - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}") - name: Test Swift Quickstart - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}" swift) + run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}") - uses: actions/upload-artifact@v4 if: failure() with: @@ -660,19 +646,15 @@ jobs: run: SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \ "${HOME}"/ios_frameworks/Firebase/FirebaseMessaging/* \ "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/* - - name: Setup swift quickstart - run: SAMPLE="$SDK" TARGET="${SDK}ExampleSwift" scripts/setup_quickstart_framework.sh - - name: Add frameworks to Crashlytics watchOS target + - name: Add frameworks to notification extension target run: | cd quickstart-ios/messaging - "${GITHUB_WORKSPACE}"/quickstart-ios/scripts/add_framework_script.rb --sdk Messaging --target NotificationServiceExtension --framework_path Firebase/ + "${GITHUB_WORKSPACE}"/quickstart-ios/scripts/add_framework_script.rb --sdk "Messaging" --target "NotificationServiceExtension" --framework_path Firebase/ - name: Install Secret GoogleService-Info.plist run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-messaging.plist.gpg \ quickstart-ios/messaging/GoogleService-Info.plist "$plist_secret" - name: Test Quickstart run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}") - - name: Test Swift Quickstart - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}" swift) - uses: actions/upload-artifact@v4 if: failure() with: @@ -712,31 +694,19 @@ jobs: mkdir -p "${HOME}"/ios_frameworks/ find "${GITHUB_WORKSPACE}" -name "Firebase*latest.zip" -exec unzip -d "${HOME}"/ios_frameworks/ {} + - name: Setup quickstart - env: - LEGACY: true run: SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \ "${HOME}"/ios_frameworks/Firebase/FirebaseStorage/* \ "${HOME}"/ios_frameworks/Firebase/FirebaseAuth/* \ "${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/* - - name: Setup swift quickstart - env: - LEGACY: true - run: SAMPLE="$SDK" TARGET="${SDK}ExampleSwift" scripts/setup_quickstart_framework.sh - name: Install Secret GoogleService-Info.plist run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-storage.plist.gpg \ quickstart-ios/storage/GoogleService-Info.plist "$plist_secret" - name: Test Quickstart - env: - LEGACY: true run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}") - - name: Test Swift Quickstart - env: - LEGACY: true - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_framework.sh "${SDK}" swift) - uses: actions/upload-artifact@v4 if: failure() with: name: quickstart_artifacts_storage_${{ matrix.artifact }} path: | quickstart-ios/ - !quickstart-ios/**/GoogleService-Info.plist \ No newline at end of file + !quickstart-ios/**/GoogleService-Info.plist diff --git a/scripts/check_secrets.sh b/scripts/check_secrets.sh index 4db1540f00c..ea289feb4b4 100755 --- a/scripts/check_secrets.sh +++ b/scripts/check_secrets.sh @@ -17,7 +17,6 @@ # Check if secrets are available for multiple CI's -set -x echo "GITHUB_BASE_REF: ${GITHUB_BASE_REF:-}" echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF:-}" diff --git a/scripts/patch_crashlytics_run_path.rb b/scripts/patch_crashlytics_run_path.rb new file mode 100755 index 00000000000..0af96faed0b --- /dev/null +++ b/scripts/patch_crashlytics_run_path.rb @@ -0,0 +1,41 @@ +#!/usr/bin/env ruby + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'xcodeproj' + +# This script patches the Crashlytics Quickstart's Xcode project to fix the +# path to the `run` script for XCFramework-based builds. +# +# The default project assumes an SPM dependency. This script changes the path +# to point to the location where the `run` script is placed in the zip +# distribution test environment. + +project_path = 'quickstart-ios/crashlytics/CrashlyticsExample.xcodeproj' +project = Xcodeproj::Project.open(project_path) +new_path = '"${SRCROOT}/Firebase/run"' + +project.targets.each do |target| + target.build_phases.each do |phase| + if phase.is_a?(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) && phase.name == 'Run Script' + if phase.shell_script.include?('SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run') + puts "Patching Run Script phase in target '#{target.name}' to: #{new_path}" + phase.shell_script = new_path + end + end + end +end + +project.save diff --git a/scripts/remove_data.sh b/scripts/remove_data.sh index 04dcf25ae8f..eb6832b3916 100755 --- a/scripts/remove_data.sh +++ b/scripts/remove_data.sh @@ -16,10 +16,20 @@ set -xe SDK="$1" +if [[ -z "$SDK" ]]; then + echo "Error: SDK name not provided." >&2 + echo "Usage: $0 " >&2 + exit 1 +fi + DIR="${SDK}" -if [[ ! -z "$LEGACY" ]]; then - DIR="${SDK}/Legacy${SDK}Quickstart" +TARGET_DIR="quickstart-ios/${DIR}" + +if [[ ! -d "$TARGET_DIR" ]]; then + echo "Error: Directory '$TARGET_DIR' not found." >&2 + echo "Please provide a valid SDK name." >&2 + exit 1 fi -rm -f quickstart-ios/"${DIR}"/GoogleService-Info.plist +rm -f "${TARGET_DIR}"/GoogleService-Info.plist diff --git a/scripts/remove_spm_dependencies.rb b/scripts/remove_spm_dependencies.rb new file mode 100755 index 00000000000..ff229655e0b --- /dev/null +++ b/scripts/remove_spm_dependencies.rb @@ -0,0 +1,177 @@ +#!/usr/bin/env ruby + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may +# obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'xcodeproj' +require 'set' + +# This script removes Swift Package Manager dependencies from an Xcode project. +# It can remove all dependencies or a specified list of dependencies. +# It's designed to be used in CI to prepare a project for framework-based testing. + +# --- Argument Parsing --- +unless ARGV.length >= 1 + puts "Usage: #{$0} [dependency_name_1 dependency_name_2 ...]" + puts "If no dependency names are provided, all SPM dependencies will be removed." + exit 1 +end + +project_path = ARGV[0] +# If more than one argument is provided, treat the rest as a list of dependencies to remove. +# Otherwise, deps_to_remove_names will be nil, signaling that all dependencies should be removed. +deps_to_remove_names = ARGV.length > 1 ? ARGV[1..-1].to_set : nil + + +# --- Main Logic --- +begin + project = Xcodeproj::Project.open(project_path) +rescue => e + puts "Error opening project at #{project_path}: #{e.message}" + exit 1 +end + +puts "Opened project: #{project.path}" + +# --- Step 1: Find all SPM product dependencies --- +all_package_product_dependencies = project.objects.select do |obj| + obj.is_a?(Xcodeproj::Project::Object::XCSwiftPackageProductDependency) +end + +if all_package_product_dependencies.empty? + puts "No SPM product dependencies found in the project." + # Still, try to clean up package references if they exist. + unless project.root_object.package_references.empty? + puts "Removing #{project.root_object.package_references.count} orphaned package reference(s)..." + project.root_object.package_references.clear + project.save + puts "Project saved." + end + exit 0 +end + +# --- Step 2: Determine which dependencies to remove and which to keep --- +dependencies_to_remove = [] +dependencies_to_keep = [] + +if deps_to_remove_names + puts "Attempting to remove specific dependencies: #{deps_to_remove_names.to_a.join(', ')}" + all_package_product_dependencies.each do |dep| + if deps_to_remove_names.include?(dep.product_name) + dependencies_to_remove << dep + else + dependencies_to_keep << dep + end + end + + found_dep_names = dependencies_to_remove.map(&:product_name).to_set + not_found = deps_to_remove_names - found_dep_names + unless not_found.empty? + puts "Warning: The following specified dependencies were not found: #{not_found.to_a.join(', ')}" + end +else + puts "No specific dependencies provided. Removing all #{all_package_product_dependencies.count} SPM dependencies." + dependencies_to_remove = all_package_product_dependencies + # dependencies_to_keep remains empty +end + +if dependencies_to_remove.empty? + puts "No SPM product dependencies to remove." + exit 0 +end + +# --- Step 3: Remove dependencies and their references --- +puts "Found #{dependencies_to_remove.count} SPM product dependencies to remove. Removing all references..." +package_product_dep_uuids = dependencies_to_remove.map(&:uuid).to_set + +# Find all BuildFile objects that reference these SPM products +build_files_to_remove = project.objects.select do |obj| + obj.is_a?(Xcodeproj::Project::Object::PBXBuildFile) && + obj.product_ref && + package_product_dep_uuids.include?(obj.product_ref.uuid) +end +build_file_uuids_to_remove = build_files_to_remove.map(&:uuid).to_set + +# Remove references from all targets +project.targets.each do |target| + puts "Cleaning target '#{target.name}'..." + + # Remove from target dependencies list + removed_deps = target.dependencies.reject! do |dep| + package_product_dep_uuids.include?(dep.uuid) + end + if removed_deps + puts " - Removed #{removed_deps.count} SPM target dependencies." + end + + # Remove from build phases (e.g., "Link Binary With Libraries") + target.build_phases.each do |phase| + next unless phase.respond_to?(:files) + + original_file_count = phase.files.count + phase.files.reject! do |build_file| + build_file_uuids_to_remove.include?(build_file.uuid) + end + removed_count = original_file_count - phase.files.count + if removed_count > 0 + puts " - Removed #{removed_count} SPM build file references from '#{phase.display_name}'." + end + end +end + +# Delete the now-orphaned BuildFile and dependency objects +puts "Deleting #{build_files_to_remove.count} SPM BuildFile object(s)..." +build_files_to_remove.each(&:remove_from_project) + +puts "Deleting #{dependencies_to_remove.count} SPM product dependency object(s)..." +dependencies_to_remove.each(&:remove_from_project) + + +# --- Step 4: Remove package references from the project root --- +if deps_to_remove_names + # If we are removing a subset of dependencies, only remove package references + # if no other products from that package are being used. + packages_to_keep = dependencies_to_keep.map(&:package).compact.to_set + + original_count = project.root_object.package_references.count + project.root_object.package_references.reject! do |ref| + !packages_to_keep.include?(ref) + end + removed_count = original_count - project.root_object.package_references.count + if removed_count > 0 + puts "Removed #{removed_count} package reference(s) that no longer have products in use." + else + puts "No package references needed to be removed." + end +else + # Remove all package references if we are removing all dependencies. + unless project.root_object.package_references.empty? + puts "Removing #{project.root_object.package_references.count} package reference(s)..." + project.root_object.package_references.clear + puts "All package references removed from the project." + else + puts "No package references found in the project." + end +end + + +# --- Step 5: Save the modified project --- +begin + project.save + puts "Project saved successfully." +rescue => e + puts "Error saving project: #{e.message}" + exit 1 +end diff --git a/scripts/setup_quickstart_framework.sh b/scripts/setup_quickstart_framework.sh index 51499ab6efa..d500666ae4f 100755 --- a/scripts/setup_quickstart_framework.sh +++ b/scripts/setup_quickstart_framework.sh @@ -21,6 +21,16 @@ fi QS_SCRIPTS="${REPO}"/quickstart-ios/scripts cd quickstart-ios/"${SAMPLE}" +# Remove all SPM dependencies from the project. This is necessary to prepare +# the project for framework-based testing. +if [[ "${SAMPLE}" == "FirebaseAI" ]]; then + # For the FirebaseAI quickstart, we only want to remove the Firebase deps. + "${REPO}"/scripts/remove_spm_dependencies.rb "${SAMPLE}Example.xcodeproj" FirebaseAI +else + # For other quickstarts, remove all SPM dependencies. + "${REPO}"/scripts/remove_spm_dependencies.rb "${SAMPLE}Example.xcodeproj" +fi + if [[ ! -z "$LEGACY" ]]; then cd "Legacy${SAMPLE}Quickstart" fi diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh new file mode 100755 index 00000000000..faf0224fec8 --- /dev/null +++ b/scripts/setup_quickstart_spm.sh @@ -0,0 +1,260 @@ +#!/usr/bin/env bash + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Script to run in a CI `before_install` phase to setup a SPM-based +# quickstart repo so that it can be used for integration testing. + +set -euo pipefail + +# Define testing mode constants. +readonly NIGHTLY_RELEASE_TESTING="nightly_release_testing" +readonly PRERELEASE_TESTING="prerelease_testing" + +# All script logic is contained in functions. The main function is called at +# the end. +# Global variables: +# - readonly constants are defined at the top. +# - scripts_dir and root_dir are set after constants. + +scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +root_dir="$(dirname "$scripts_dir")" + +print_usage() { + cat < [testing_mode] + +This script sets up a quickstart sample for SPM integration testing. + +ARGUMENTS: + The name of the quickstart sample directory + (e.g., "authentication"). + [testing_mode] Optional. Specifies the testing mode. Can be one of: + - "${NIGHTLY_RELEASE_TESTING}": Points SPM to the latest + CocoaPods tag. + - "${PRERELEASE_TESTING}": Points SPM to the tip of the main + branch. + - (default): Points SPM to the current commit for PR testing. + +ENVIRONMENT VARIABLES: + QUICKSTART_REPO: Optional. Path to a local clone of the quickstart-ios repo. + If not set, the script will clone it from GitHub. + Example: + QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication + + QUICKSTART_BRANCH: Optional. The branch to checkout in the quickstart repo. + Defaults to the repo's default branch. + Example: + QUICKSTART_BRANCH=my-feature-branch $(basename "$0") authentication + + BYPASS_SECRET_CHECK: Optional. Set to "true" to bypass the CI secret check + for local runs. + Example: + BYPASS_SECRET_CHECK=true $(basename "$0") authentication + + DEBUG: Optional. Set to "true" to enable shell trace mode (`set -x`). + Example: DEBUG=true $(basename "$0") authentication +EOF +} + +# Clones or locates the quickstart repo. +# +# Globals: +# - QUICKSTART_REPO (read-only) +# Arguments: +# - $1: The name of the sample. +# Outputs: +# - Echoes the absolute path to the quickstart directory. +setup_quickstart_repo() { + local sample_name="$1" + local quickstart_dir + + # If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. + if [[ -n "${QUICKSTART_REPO:-}" ]]; then + # If the user provided a path, it must be a valid directory. + if [[ ! -d "${QUICKSTART_REPO}" ]]; then + echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}'," \ + "but this is not a valid directory." >&2 + exit 1 + fi + echo "Using local quickstart repository at ${QUICKSTART_REPO}" >&2 + quickstart_dir="${QUICKSTART_REPO}" + if ! (cd "${quickstart_dir}" && \ + git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + echo "Error: QUICKSTART_REPO ('${quickstart_dir}') is not a git" \ + "repository." >&2 + exit 1 + fi + else + # QUICKSTART_REPO is not set, so clone it. + quickstart_dir="quickstart-ios" + if [[ -d "${quickstart_dir}" ]]; then + echo "Quickstart repository already exists at ${quickstart_dir}" >&2 + else + echo "Cloning quickstart repository into '${quickstart_dir}' directory..." >&2 + # Do a partial, sparse clone to speed up CI. See + # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ + git clone --filter=blob:none --sparse \ + https://github.com/firebase/quickstart-ios.git "${quickstart_dir}" + fi + ( + cd "${quickstart_dir}" + echo "Ensuring sparse checkout is set for ${sample_name}..." >&2 + # Checkout the sample and scripts directories. + git sparse-checkout set "${sample_name}" scripts shared + ) + fi + + # If a branch is specified, check it out. + if [[ -n "${QUICKSTART_BRANCH:-}" ]]; then + echo "Checking out quickstart branch: ${QUICKSTART_BRANCH}" >&2 + ( + cd "${quickstart_dir}" + git fetch --quiet + git checkout --quiet "${QUICKSTART_BRANCH}" + ) + fi + + # Return the absolute path to the quickstart directory. + (cd "$quickstart_dir" && pwd) +} + +# Updates the SPM dependency in the Xcode project based on the testing mode. +# +# Globals: +# - NIGHTLY_RELEASE_TESTING (read-only) +# - PRERELEASE_TESTING (read-only) +# - scripts_dir (read-only) +# - root_dir (read-only) +# Arguments: +# - $1: The testing mode. +# - $2: The absolute path to the .xcodeproj file. +update_spm_dependency() { + local release_testing_mode="$1" + local absolute_project_file="$2" + + case "$release_testing_mode" in + "${NIGHTLY_RELEASE_TESTING}") + # For release testing, find the latest CocoaPods tag. + local latest_tag + latest_tag=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | + awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/{print; exit}') + if [[ -z "$latest_tag" ]]; then + echo "Error: Could not find the latest CocoaPods tag." >&2 + echo "This is often caused by a shallow git clone in a CI environment." >&2 + echo "If you are running in GitHub Actions, please ensure your checkout" >&2 + echo "step includes 'fetch-depth: 0' to fetch the full git history." >&2 + exit 1 + fi + local tag_revision + tag_revision=$(git -C "$root_dir" rev-list -n 1 "$latest_tag") + echo "Setting SPM dependency to revision for tag ${latest_tag}:" \ + "${tag_revision}" + "$scripts_dir/update_firebase_spm_dependency.sh" \ + "$absolute_project_file" --revision "$tag_revision" + ;; + + "${PRERELEASE_TESTING}") + # For prerelease testing, point to the tip of the main branch. + echo "Setting SPM dependency to the tip of the main branch." + "$scripts_dir/update_firebase_spm_dependency.sh" \ + "$absolute_project_file" --prerelease + ;; + + *) + # For PR testing, point to the current commit. + local current_revision + current_revision=$(git -C "$root_dir" rev-parse HEAD) + echo "Setting SPM dependency to current revision: ${current_revision}" + "$scripts_dir/update_firebase_spm_dependency.sh" \ + "$absolute_project_file" --revision "$current_revision" + ;; + esac +} + +main() { + # --- Argument Parsing --- + if [[ -z "${1:-}" ]]; then + print_usage + exit 1 + fi + + local sample="$1" + local release_testing="${2-}" + + # Validate release_testing argument. + case "$release_testing" in + "" | "${NIGHTLY_RELEASE_TESTING}" | "${PRERELEASE_TESTING}") + # This is a valid value (or empty), so do nothing. + ;; + *) + # This is an invalid value. + echo "Error: Invalid testing_mode: '${release_testing}'" >&2 + print_usage + exit 1 + ;; + esac + + # --- Environment Setup and Validation --- + # Enable trace mode if DEBUG is set to 'true' + if [[ "${DEBUG:-false}" == "true" ]]; then + set -x + fi + + # Source function to check if CI secrets are available. + source "$scripts_dir/check_secrets.sh" + + # Some quickstarts may not need a real GoogleService-Info.plist for their + # tests. When QUICKSTART_REPO is set (for local runs) or BYPASS_SECRET_CHECK + # is true, the secrets check is skipped. + if [[ -z "${QUICKSTART_REPO:-}" ]] && \ + [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ + ! check_secrets && \ + [[ "${sample}" != "installations" ]]; then + echo "Skipping quickstart setup: CI secrets are not available." + exit 0 + fi + + # --- Main Logic --- + local quickstart_dir + quickstart_dir=$(setup_quickstart_repo "$sample") + + local quickstart_project_dir="${quickstart_dir}/${sample}" + + if [[ ! -d "${quickstart_project_dir}" ]]; then + echo "Error: Sample directory not found at '${quickstart_project_dir}'" >&2 + exit 1 + fi + + # Find the .xcodeproj file within the sample directory. + # Fail if there isn't exactly one. + # Enable nullglob to ensure the glob expands to an empty list if no files + # are found. + shopt -s nullglob + local project_files=("${quickstart_project_dir}"/*.xcodeproj) + # Restore default globbing behavior. + shopt -u nullglob + if [[ "${#project_files[@]}" -ne 1 ]]; then + echo "Error: Expected 1 .xcodeproj file in" \ + "'${quickstart_project_dir}', but found ${#project_files[@]}." >&2 + exit 1 + fi + local project_file="${project_files[0]}" + + update_spm_dependency "$release_testing" "$project_file" +} + +# Run the main function with all provided arguments. +main "$@" diff --git a/scripts/test_quickstart.sh b/scripts/test_quickstart.sh index 4db82009d3f..2a3f533fc1d 100755 --- a/scripts/test_quickstart.sh +++ b/scripts/test_quickstart.sh @@ -20,17 +20,11 @@ set -xeuo pipefail sample="$1" test="$2" -language="${3-}" # Source function to check if CI secrets are available. source scripts/check_secrets.sh if check_secrets; then cd quickstart-ios - if [ "$language" = "swift" ]; then - have_secrets=true SAMPLE="$sample" TEST="$test" SWIFT_SUFFIX="Swift" ./scripts/test.sh - else - have_secrets=true SAMPLE="$sample" TEST="$test" ./scripts/test.sh - fi - + have_secrets=true SAMPLE="$sample" TEST="$test" ./scripts/test.sh fi diff --git a/scripts/update_firebase_spm_dependency.sh b/scripts/update_firebase_spm_dependency.sh index 7a13e07a3cb..27d54e4658d 100755 --- a/scripts/update_firebase_spm_dependency.sh +++ b/scripts/update_firebase_spm_dependency.sh @@ -65,7 +65,7 @@ case "$MODE" in REPLACEMENT_REGEX="\1kind = branch;\n\t\t\t\tbranch = \"$VERSION\";\2" ;; --prerelease) - COMMIT_HASH=$(git ls-remote https://github.com/firebase/firebase-ios-sdk.git main | cut -f1) + COMMIT_HASH=$(git ls-remote https://github.com/firebase/firebase-ios-sdk.git refs/heads/main | cut -f1) if [[ -z "$COMMIT_HASH" ]]; then echo "Error: Failed to get remote revision for main branch." exit 1 diff --git a/scripts/zip_quickstart_test.sh b/scripts/zip_quickstart_test.sh index 2771b8eb02a..0a3cc30ec9a 100755 --- a/scripts/zip_quickstart_test.sh +++ b/scripts/zip_quickstart_test.sh @@ -42,10 +42,23 @@ else device_name="iPhone 16" fi +# Define project and scheme names +PROJECT_NAME="${SAMPLE}Example.xcodeproj" +SCHEME_NAME="${SAMPLE}Example${SWIFT_SUFFIX}" + +# Check if the scheme exists before attempting to build. +# The `awk` command prints all lines from "Schemes:" to the end of the output. +if ! xcodebuild -list -project "${PROJECT_NAME}" | awk '/Schemes:/,0' | grep -q "^\s*${SCHEME_NAME}"$; then + echo "Error: Scheme '${SCHEME_NAME}' not found in project '${PROJECT_NAME}'." + echo "Available schemes from '${PROJECT_NAME}':" + xcodebuild -list -project "${PROJECT_NAME}" + exit 65 +fi + ( xcodebuild \ --project ${SAMPLE}Example.xcodeproj \ --scheme ${SAMPLE}Example${SWIFT_SUFFIX} \ +-project ${PROJECT_NAME} \ +-scheme ${SCHEME_NAME} \ -destination "platform=iOS Simulator,name=$device_name" "SWIFT_VERSION=5.3" "OTHER_LDFLAGS=\$(OTHER_LDFLAGS) -ObjC" "FRAMEWORK_SEARCH_PATHS= \$(PROJECT_DIR)/Firebase/" HEADER_SEARCH_PATHS='$(inherited) $(PROJECT_DIR)/Firebase' \ build \ ) || EXIT_STATUS=$?