spectesting.yml 2.4 KB

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