فهرست منبع

Archive testing on GHA (#6338)

* Testing generating archives on GHA

* Removed unnecessary quotes.

* Fix arguments again.

* Attempt to archive macOS and tvOS too

* Fix naming

* arg parsing

* Fix parentheses style.

* End case for bash script.

* Try Catalyst support, too.

* Try Catalyst support, too for real.

* Catalyst again

* Revert Catalyst build.

This was wrong (scheme should have been App-iOS) but then that failed
with a different error:

```
firebase-ios-sdk/gen/FirebaseCore/Target Support Files/nanopb/nanopb-prefix.pch:2:9: fatal error: 'UIKit/UIKit.h' file not found
        ^~~~~~~~~~~~~~~
1 error generated.

```

I'll revert it for now and address later.

* Add ALL THE SDKS

* Run on cron job only

* Removed Installations test.

* Remove uploading of archive, print size on disk

* Temporarily run Core on PRs for testing.

* Re-enable cron only for Core.
Ryan Wilson 5 سال پیش
والد
کامیت
bdf84c0a7b

+ 15 - 0
.github/workflows/abtesting.yml

@@ -116,3 +116,18 @@ jobs:
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb \
           FirebaseABTesting.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseABTesting ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/appdistribution.yml

@@ -49,3 +49,18 @@ jobs:
       run: |
        scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAppDistribution.podspec \
          --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseAppDistribution ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/auth.yml

@@ -150,3 +150,18 @@ jobs:
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAuth.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAuth.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseAuth ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/core.yml

@@ -71,6 +71,21 @@ jobs:
     - name: Setup project and Build Catalyst
       run: scripts/test_catalyst.sh FirebaseCore build
 
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseCore ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive
+
   core-cron-only:
     # Don't run on private repo.
     if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'

+ 15 - 0
.github/workflows/crashlytics.yml

@@ -124,3 +124,18 @@ jobs:
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseCrashlytics.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseCrashlytics.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseCrashlytics ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/database.yml

@@ -138,3 +138,18 @@ jobs:
       run: scripts/setup_bundler.sh
     - name: PodLibLint database Cron
       run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseDatabase.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseDatabase ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/datatransport.yml

@@ -76,3 +76,18 @@ jobs:
     - name: PodLibLint DataTransport Cron
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb GoogleDataTransport.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh GoogleDataTransport ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 16 - 0
.github/workflows/dynamiclinks.yml

@@ -85,3 +85,19 @@ jobs:
     - name: Test swift quickstart
       if: ${{ always() }}
       run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh DynamicLinks swift)
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseDynamicLinks ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive
+

+ 15 - 0
.github/workflows/firestore.yml

@@ -238,3 +238,18 @@ jobs:
     - name: Test swift quickstart
       run: ([ -z $plist_secret ] ||
             scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Firestore)
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseFirestore ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/functions.yml

@@ -71,3 +71,18 @@ jobs:
     - name: Test swift quickstart
       run: ([ -z $plist_secret ] ||
             scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions swift)
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseFunctions ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 14 - 0
.github/workflows/inappmessaging.yml

@@ -53,3 +53,17 @@ jobs:
       run: ([ -z $plist_secret ] ||
             scripts/third_party/travis/retry.sh scripts/test_quickstart.sh InAppMessaging swift)
 
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseInAppMessaging ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/instanceid.yml

@@ -82,3 +82,18 @@ jobs:
       run: |
         export FIR_IID_INTEGRATION_TESTS_REQUIRED=${{ steps.secrets.outputs.val }}
         FIR_IID_INTEGRATION_TESTS_REQUIRED="$plist_secret" scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseInstanceID.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseInstanceID ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/messaging.yml

@@ -156,3 +156,18 @@ jobs:
       run: scripts/install_prereqs.sh MessagingSample iOS
     - name: Build
       run: ([ -z $plist_secret ] || scripts/build.sh MessagingSample iOS)
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseMessaging ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/remoteconfig.yml

@@ -152,3 +152,18 @@ jobs:
     - name: PodLibLint RemoteConfig Cron
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseRemoteConfig.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseRemoteConfig ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 15 - 0
.github/workflows/storage.yml

@@ -145,3 +145,18 @@ jobs:
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseStorage.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseStorage.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+
+  archive-cron:
+    # Don't run on private repo.
+    if: github.event_name == 'schedule' && github.repository != 'FirebasePrivate/firebase-ios-sdk'
+
+    runs-on: macOS-latest
+    strategy:
+      matrix:
+        target: [ios, tvos, macos]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Setup project and archive
+      run: scripts/test_archiving.sh FirebaseStorage ${{ matrix.target }} ArchiveOutputs/${{ matrix.target }}.xcarchive

+ 73 - 0
scripts/test_archiving.sh

@@ -0,0 +1,73 @@
+#!/usr/bin/env bash
+
+# Copyright 2020 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.
+
+
+# USAGE: test_archiving.sh pod platform outputPath
+#
+# Generates the project for the given CocoaPod and attempts to archive it to the provided
+# path.
+
+set -xeuo pipefail
+
+pod="$1"
+platform="$2"
+output_path="$3"
+
+# watchOS is unsupported - `pod gen` can't generate the test schemes.
+case "$platform" in
+  ios)
+  scheme_name="App-iOS"
+  ;;
+
+  macos)
+  scheme_name="App-macOS"
+  ;;
+
+  tvos)
+  scheme_name="App-tvOS"
+  ;;
+
+  # Fail for anything else, invalid input.
+  *)
+  exit 1;
+  ;;
+esac
+
+bundle exec pod gen --local-sources=./ --sources=https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/ \
+  "$pod".podspec --platforms="$platform"
+
+args=(
+  # Run the `archive` command.
+  "archive"
+  # Write the archive to a given path.
+  "-archivePath" "$output_path"
+  # The generated workspace.
+  "-workspace" "gen/$pod/$pod.xcworkspace"
+  # Specify the generated App scheme.
+  "-scheme" "$scheme_name"
+  # Disable signing.
+  "CODE_SIGN_IDENTITY=-" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"
+)
+
+xcodebuild -version
+xcodebuild "${args[@]}" | xcpretty
+
+# Print the size if the Xcode build was successful.
+if [ $? -eq 0 ]; then
+  echo "Size of archive:"
+  # Use `du` to print the file size of all .apps found. The `k` argument prints in KB.
+  du -sk $(find "$output_path" -name "*.app")
+fi