spm.yml 5.1 KB

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