spectesting.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: spectesting
  2. on:
  3. pull_request
  4. concurrency:
  5. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  6. cancel-in-progress: true
  7. jobs:
  8. specs_checking:
  9. # Don't run on private repo unless it is a PR.
  10. if: github.repository == 'Firebase/firebase-ios-sdk'
  11. runs-on: macos-14
  12. outputs:
  13. matrix: ${{ steps.check_files.outputs.matrix }}
  14. podspecs: ${{ steps.check_files.outputs.podspecs }}
  15. steps:
  16. - name: Checkout code
  17. uses: actions/checkout@v4
  18. with:
  19. fetch-depth: 0
  20. - name: check files
  21. id: check_files
  22. env:
  23. pr_branch: ${{ github.event.pull_request.head.ref }}
  24. run: |
  25. # The output.json will have podspecs that will be tested.
  26. # ``` output.json
  27. # [{"podspec":"FirebaseABTesting.podspec"},{"podspec":"FirebaseAnalytics.podspec"}]
  28. # ```
  29. # This array will help generate a matrix for jobs in GHA, taking
  30. # advantage of `include`.
  31. # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
  32. # The final matrix will be set as an env var in the GHA workflow,
  33. # This env var, matrix, will be passed as a matrix in the next job of
  34. # the workflow.
  35. # If multiple podspecs need to be excluded, escaping space is required
  36. # to split podspecs, e.g. get_updated_files.sh ... -e Firebase.podspec\ FirebaseABTesting.podspec
  37. ./scripts/health_metrics/get_updated_files.sh -p output.json -e Firebase.podspec\ FirebaseFunctions.podspec
  38. echo "::set-output name=matrix::{\"include\":$( cat output.json )}"
  39. # `podspecs` is to help determine if specs_testing job should be run.
  40. echo "::set-output name=podspecs::$(cat output.json)"
  41. specs_testing:
  42. needs: specs_checking
  43. if: ${{ needs.specs_checking.outputs.podspecs != '[]' }}
  44. runs-on: macos-14
  45. strategy:
  46. fail-fast: false
  47. matrix: ${{fromJson(needs.specs_checking.outputs.matrix)}}
  48. env:
  49. PODSPEC: ${{ matrix.podspec }}
  50. steps:
  51. - name: Checkout code
  52. uses: actions/checkout@v4
  53. with:
  54. fetch-depth: 0
  55. - name: Init podspecs and source
  56. run: |
  57. mkdir specTestingLogs
  58. cd ReleaseTooling
  59. swift run podspecs-tester --git-root "${GITHUB_WORKSPACE}" --podspec ${PODSPEC} --skip-tests --temp-log-dir "${GITHUB_WORKSPACE}/specTestingLogs"
  60. - name: Upload Failed Testing Logs
  61. if: failure()
  62. uses: actions/upload-artifact@v4
  63. with:
  64. name: specTestingLogs
  65. path: specTestingLogs/*.txt