spm.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 1am (PDT) / 4am (EDT) - 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: 15
  79. max_attempts: 3
  80. retry_wait_seconds: 120
  81. command: scripts/build.sh Firebase-Package iOS ${{ matrix.test }}
  82. # Test iOS Device build since some Firestore dependencies build different files.
  83. iOS-Device:
  84. # Don't run on private repo unless it is a PR.
  85. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  86. needs: [spm-package-resolved]
  87. strategy:
  88. matrix:
  89. include:
  90. - os: macos-14
  91. xcode: Xcode_16.2
  92. - os: macos-15
  93. xcode: Xcode_16.4
  94. runs-on: ${{ matrix.os }}
  95. steps:
  96. - uses: actions/checkout@v4
  97. - uses: actions/cache/restore@v4
  98. with:
  99. path: .build
  100. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  101. - name: Clone mock responses for Firebase AI Logic unit tests
  102. run: scripts/update_vertexai_responses.sh
  103. - name: Xcode
  104. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  105. - name: Initialize xcodebuild
  106. run: scripts/setup_spm_tests.sh
  107. - name: iOS Device and Test Build
  108. run: scripts/third_party/travis/retry.sh ./scripts/build.sh Firebase-Package iOS-device spmbuildonly
  109. platforms:
  110. # Don't run on private repo unless it is a PR.
  111. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  112. needs: [spm-package-resolved]
  113. strategy:
  114. matrix:
  115. # Full set of Firebase-Package tests only run on iOS. Run subset on other platforms.
  116. # visionOS isn't buildable from here (even with Firestore source) because the test
  117. # targets need Analytics.
  118. target: [tvOS, macOS, catalyst]
  119. include:
  120. - os: macos-15
  121. xcode: Xcode_16.4
  122. - os: macos-14
  123. xcode: Xcode_16.2
  124. runs-on: ${{ matrix.os }}
  125. steps:
  126. - uses: actions/checkout@v4
  127. - uses: actions/cache/restore@v4
  128. with:
  129. path: .build
  130. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  131. - name: Xcode
  132. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  133. - name: Initialize xcodebuild
  134. run: scripts/setup_spm_tests.sh
  135. - name: Objc Import Tests
  136. run: scripts/third_party/travis/retry.sh ./scripts/build.sh objc-import-test ${{ matrix.target }} spm
  137. - name: Swift Tests
  138. run: scripts/third_party/travis/retry.sh ./scripts/build.sh swift-test ${{ matrix.target }} spm
  139. - name: Version Tests
  140. run: scripts/third_party/travis/retry.sh ./scripts/build.sh version-test ${{ matrix.target }} spm
  141. - name: Analytics Build Tests
  142. run: scripts/third_party/travis/retry.sh ./scripts/build.sh analytics-import-test ${{ matrix.target }} spm