spm.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. name: spm
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. paths:
  6. - '.github/workflows/spm.yml'
  7. - 'Package.swift'
  8. - '.swiftpm/*'
  9. - 'scripts/build.sh'
  10. - 'SwiftPMTests/*'
  11. - 'SwiftPM-PlatformExclude'
  12. - 'Gemfile*'
  13. schedule:
  14. # Run every day at 12am (PST) - cron uses UTC times
  15. - cron: '0 8 * * *'
  16. # This workflow builds and tests the Swift Package Manager. Only iOS runs on PRs
  17. # because each platform takes 15-20 minutes after adding Firestore.
  18. concurrency:
  19. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  20. cancel-in-progress: true
  21. env:
  22. FIREBASE_CI: true
  23. jobs:
  24. spm-package-resolved:
  25. env:
  26. FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
  27. runs-on: macos-14
  28. outputs:
  29. cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
  30. steps:
  31. - uses: actions/checkout@v4
  32. - name: Xcode
  33. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  34. - name: Generate Swift Package.resolved
  35. id: swift_package_resolve
  36. run: |
  37. swift package resolve
  38. - name: Generate cache key
  39. id: generate_cache_key
  40. run: |
  41. cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
  42. echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
  43. - uses: actions/cache/save@v4
  44. id: cache
  45. with:
  46. path: .build
  47. key: ${{ steps.generate_cache_key.outputs.cache_key }}
  48. swift-build-run:
  49. # Don't run on private repo unless it is a PR.
  50. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  51. needs: [spm-package-resolved]
  52. strategy:
  53. matrix:
  54. include:
  55. - os: macos-15
  56. xcode: Xcode_16.4
  57. test: spm
  58. - os: macos-14
  59. xcode: Xcode_16.2
  60. test: spm
  61. runs-on: ${{ matrix.os }}
  62. steps:
  63. - uses: actions/checkout@v4
  64. - uses: actions/cache/restore@v4
  65. with:
  66. path: .build
  67. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  68. - name: Clone mock responses for Firebase AI Logic unit tests
  69. run: scripts/update_vertexai_responses.sh
  70. - name: Xcode
  71. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  72. - name: Initialize xcodebuild
  73. run: scripts/setup_spm_tests.sh
  74. - name: Functions Integration Test Server
  75. run: FirebaseFunctions/Backend/start.sh synchronous
  76. - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  77. with:
  78. timeout_minutes: 120
  79. max_attempts: 3
  80. retry_on: error
  81. retry_wait_seconds: 120
  82. command: scripts/build.sh Firebase-Package iOS ${{ matrix.test }}
  83. # Test iOS Device build since some Firestore dependencies build different files.
  84. iOS-Device:
  85. # Don't run on private repo unless it is a PR.
  86. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  87. needs: [spm-package-resolved]
  88. strategy:
  89. matrix:
  90. include:
  91. - os: macos-14
  92. xcode: Xcode_16.2
  93. - os: macos-15
  94. xcode: Xcode_16.2
  95. runs-on: ${{ matrix.os }}
  96. steps:
  97. - uses: actions/checkout@v4
  98. - uses: actions/cache/restore@v4
  99. with:
  100. path: .build
  101. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  102. - name: Clone mock responses for Firebase AI Logic unit tests
  103. run: scripts/update_vertexai_responses.sh
  104. - name: Xcode
  105. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  106. - name: Initialize xcodebuild
  107. run: scripts/setup_spm_tests.sh
  108. - name: iOS Device and Test Build
  109. run: scripts/third_party/travis/retry.sh ./scripts/build.sh Firebase-Package iOS-device spmbuildonly
  110. platforms:
  111. # Don't run on private repo unless it is a PR.
  112. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  113. needs: [spm-package-resolved]
  114. strategy:
  115. matrix:
  116. # Full set of Firebase-Package tests only run on iOS. Run subset on other platforms.
  117. # visionOS isn't buildable from here (even with Firestore source) because the test
  118. # targets need Analytics.
  119. target: [tvOS, macOS, catalyst]
  120. include:
  121. - os: macos-15
  122. xcode: Xcode_16.2
  123. - os: macos-14
  124. xcode: Xcode_16.2
  125. runs-on: ${{ matrix.os }}
  126. steps:
  127. - uses: actions/checkout@v4
  128. - uses: actions/cache/restore@v4
  129. with:
  130. path: .build
  131. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  132. - name: Xcode
  133. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  134. - name: Initialize xcodebuild
  135. run: scripts/setup_spm_tests.sh
  136. - name: Objc Import Tests
  137. run: scripts/third_party/travis/retry.sh ./scripts/build.sh objc-import-test ${{ matrix.target }} spm
  138. - name: Swift Tests
  139. run: scripts/third_party/travis/retry.sh ./scripts/build.sh swift-test ${{ matrix.target }} spm
  140. - name: Version Tests
  141. run: scripts/third_party/travis/retry.sh ./scripts/build.sh version-test ${{ matrix.target }} spm
  142. - name: Analytics Build Tests
  143. run: scripts/third_party/travis/retry.sh ./scripts/build.sh analytics-import-test ${{ matrix.target }} spm