shared-swift.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: shared-swift
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. paths:
  6. - 'FirebaseSharedSwift**'
  7. - '.github/workflows/shared-swift.yml'
  8. - 'Gemfile*'
  9. schedule:
  10. # Run every day at 3am (PST) - cron uses UTC times
  11. - cron: '0 11 * * *'
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  14. cancel-in-progress: true
  15. jobs:
  16. pod-lib-lint:
  17. # Don't run on private repo unless it is a PR.
  18. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  19. strategy:
  20. matrix:
  21. target: [ios, tvos, macos, watchos]
  22. build-env:
  23. - os: macos-14
  24. xcode: Xcode_16.2
  25. swift_version: 5.9
  26. - os: macos-15
  27. xcode: Xcode_16.2
  28. swift_version: 5.9
  29. - os: macos-15
  30. xcode: Xcode_16.2
  31. swift_version: 6.0
  32. runs-on: ${{ matrix.build-env.os }}
  33. steps:
  34. - uses: actions/checkout@v4
  35. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  36. - name: Setup Bundler
  37. run: scripts/setup_bundler.sh
  38. - name: Xcode
  39. run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
  40. - name: Set Swift swift_version
  41. run: sed -i "" "s/s.swift_version[[:space:]]*=[[:space:]]*'5.9'/s.swift_version = '${{ matrix.build-env.swift_version }}'/" FirebaseSharedSwift.podspec
  42. - name: Build and test
  43. run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseSharedSwift.podspec --platforms=${{ matrix.target }}
  44. spm-package-resolved:
  45. env:
  46. FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
  47. runs-on: macos-14
  48. outputs:
  49. cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
  50. steps:
  51. - uses: actions/checkout@v4
  52. - name: Xcode
  53. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  54. - name: Generate Swift Package.resolved
  55. id: swift_package_resolve
  56. run: |
  57. swift package resolve
  58. - name: Generate cache key
  59. id: generate_cache_key
  60. run: |
  61. cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
  62. echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
  63. - uses: actions/cache/save@v4
  64. id: cache
  65. with:
  66. path: .build
  67. key: ${{ steps.generate_cache_key.outputs.cache_key }}
  68. spm:
  69. # Don't run on private repo unless it is a PR.
  70. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  71. needs: [spm-package-resolved]
  72. strategy:
  73. matrix:
  74. target: [iOS, tvOS, macOS, catalyst, watchOS]
  75. build-env:
  76. - os: macos-14
  77. xcode: Xcode_16.2
  78. - os: macos-15
  79. xcode: Xcode_16.2
  80. runs-on: ${{ matrix.build-env.os }}
  81. steps:
  82. - uses: actions/checkout@v4
  83. - uses: actions/cache/restore@v4
  84. with:
  85. path: .build
  86. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  87. - name: Xcode
  88. run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
  89. - name: Initialize xcodebuild
  90. run: scripts/setup_spm_tests.sh
  91. - name: Unit Tests
  92. run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseSharedSwiftTests ${{ matrix.target }} spm