|
| 1 | +name: firebaseai |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'FirebaseAI**' |
| 7 | + - '.github/workflows/firebaseai.yml' |
| 8 | + - 'scripts/quickstart_build_spm.sh' |
| 9 | + - 'scripts/quickstart_spm_xcodeproj.sh' |
| 10 | + - 'Gemfile*' |
| 11 | + schedule: |
| 12 | + # Run every day at 11pm (PST) - cron uses UTC times |
| 13 | + - cron: '0 7 * * *' |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read # Needed for actions/checkout |
| 22 | + actions: write # Needed for actions/cache (save and restore) |
| 23 | + |
| 24 | +jobs: |
| 25 | + spm-package-resolved: |
| 26 | + runs-on: macos-14 |
| 27 | + outputs: |
| 28 | + cache_key: ${{ steps.generate_cache_key.outputs.cache_key }} |
| 29 | + env: |
| 30 | + FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - name: Generate Swift Package.resolved |
| 34 | + id: swift_package_resolve |
| 35 | + run: | |
| 36 | + swift package resolve |
| 37 | + - name: Generate cache key |
| 38 | + id: generate_cache_key |
| 39 | + run: | |
| 40 | + cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}" |
| 41 | + echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT" |
| 42 | + - uses: actions/cache/save@v4 |
| 43 | + id: cache |
| 44 | + with: |
| 45 | + path: .build |
| 46 | + key: ${{ steps.generate_cache_key.outputs.cache_key }} |
| 47 | + |
| 48 | + spm-unit: |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + include: |
| 52 | + - os: macos-14 |
| 53 | + xcode: Xcode_16.2 |
| 54 | + target: iOS |
| 55 | + - os: macos-15 |
| 56 | + xcode: Xcode_16.3 |
| 57 | + target: iOS |
| 58 | + - os: macos-15 |
| 59 | + xcode: Xcode_16.3 |
| 60 | + target: tvOS |
| 61 | + - os: macos-15 |
| 62 | + xcode: Xcode_16.3 |
| 63 | + target: macOS |
| 64 | + - os: macos-15 |
| 65 | + xcode: Xcode_16.3 |
| 66 | + target: watchOS |
| 67 | + - os: macos-15 |
| 68 | + xcode: Xcode_16.3 |
| 69 | + target: catalyst |
| 70 | + - os: macos-15 |
| 71 | + xcode: Xcode_16.3 |
| 72 | + target: visionOS |
| 73 | + runs-on: ${{ matrix.os }} |
| 74 | + needs: spm-package-resolved |
| 75 | + env: |
| 76 | + FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v4 |
| 79 | + - uses: actions/cache/restore@v4 |
| 80 | + with: |
| 81 | + path: .build |
| 82 | + key: ${{needs.spm-package-resolved.outputs.cache_key}} |
| 83 | + - name: Clone mock responses |
| 84 | + run: scripts/update_vertexai_responses.sh |
| 85 | + - name: Xcode |
| 86 | + run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer |
| 87 | + - name: Install visionOS, if needed. |
| 88 | + if: matrix.target == 'visionOS' |
| 89 | + run: xcodebuild -downloadPlatform visionOS |
| 90 | + - name: Initialize xcodebuild |
| 91 | + run: scripts/setup_spm_tests.sh |
| 92 | + - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 |
| 93 | + with: |
| 94 | + timeout_minutes: 120 |
| 95 | + max_attempts: 3 |
| 96 | + retry_on: error |
| 97 | + retry_wait_seconds: 120 |
| 98 | + command: scripts/build.sh FirebaseAIUnit ${{ matrix.target }} spm |
| 99 | + |
| 100 | + testapp-integration: |
| 101 | + strategy: |
| 102 | + matrix: |
| 103 | + target: [iOS] |
| 104 | + os: [macos-15] |
| 105 | + include: |
| 106 | + - os: macos-15 |
| 107 | + xcode: Xcode_16.3 |
| 108 | + runs-on: ${{ matrix.os }} |
| 109 | + needs: spm-package-resolved |
| 110 | + env: |
| 111 | + TEST_RUNNER_FIRAAppCheckDebugToken: ${{ secrets.VERTEXAI_INTEGRATION_FAC_DEBUG_TOKEN }} |
| 112 | + TEST_RUNNER_VTXIntegrationImagen: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} |
| 113 | + FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 |
| 114 | + secrets_passphrase: ${{ secrets.GHASecretsGPGPassphrase1 }} |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v4 |
| 117 | + - uses: actions/cache/restore@v4 |
| 118 | + with: |
| 119 | + path: .build |
| 120 | + key: ${{needs.spm-package-resolved.outputs.cache_key}} |
| 121 | + - name: Install Secret GoogleService-Info.plist |
| 122 | + run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info.plist.gpg \ |
| 123 | + FirebaseAI/Tests/TestApp/Resources/GoogleService-Info.plist "$secrets_passphrase" |
| 124 | + - name: Install Secret GoogleService-Info-Spark.plist |
| 125 | + run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info-Spark.plist.gpg \ |
| 126 | + FirebaseAI/Tests/TestApp/Resources/GoogleService-Info-Spark.plist "$secrets_passphrase" |
| 127 | + - name: Install Secret Credentials.swift |
| 128 | + run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-Credentials.swift.gpg \ |
| 129 | + FirebaseAI/Tests/TestApp/Tests/Integration/Credentials.swift "$secrets_passphrase" |
| 130 | + - name: Xcode |
| 131 | + run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer |
| 132 | + - name: Run IntegrationTests |
| 133 | + run: scripts/build.sh FirebaseAIIntegration ${{ matrix.target }} |
| 134 | + |
| 135 | + pod-lib-lint: |
| 136 | + # Don't run on private repo unless it is a PR. |
| 137 | + if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' |
| 138 | + strategy: |
| 139 | + matrix: |
| 140 | + include: |
| 141 | + - os: macos-14 |
| 142 | + xcode: Xcode_16.2 |
| 143 | + swift_version: 5.9 |
| 144 | + warnings: |
| 145 | + - os: macos-15 |
| 146 | + xcode: Xcode_16.3 |
| 147 | + swift_version: 5.9 |
| 148 | + warnings: |
| 149 | + - os: macos-15 |
| 150 | + xcode: Xcode_16.3 |
| 151 | + swift_version: 6.0 |
| 152 | + warnings: |
| 153 | + runs-on: ${{ matrix.os }} |
| 154 | + steps: |
| 155 | + - uses: actions/checkout@v4 |
| 156 | + - name: Clone mock responses |
| 157 | + run: scripts/update_vertexai_responses.sh |
| 158 | + - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 |
| 159 | + - name: Setup Bundler |
| 160 | + run: scripts/setup_bundler.sh |
| 161 | + - name: Xcode |
| 162 | + run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer |
| 163 | + - name: Set Swift swift_version |
| 164 | + run: sed -i "" "s#s.swift_version = '5.9'#s.swift_version = '${{ matrix.swift_version}}'#" FirebaseAI.podspec |
| 165 | + - name: Build and test |
| 166 | + run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAI.podspec --platforms=${{ matrix.target }} ${{ matrix.warnings }} |
| 167 | + |
| 168 | + quickstart: |
| 169 | + # Verifies the quickstart builds with this PR. Only run on pulls where branch is available. |
| 170 | + if: github.event_name == 'pull_request' |
| 171 | + runs-on: macos-15 |
| 172 | + env: |
| 173 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 174 | + steps: |
| 175 | + - uses: actions/checkout@v4 |
| 176 | + - name: Build Quickstart |
| 177 | + run: scripts/quickstart_build_spm.sh FirebaseAI |
0 commit comments