spm.yml 5.1 KB

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