test_coverage.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: test_coverage
  2. on: [pull_request]
  3. #run specific jobs when specific files are updated.
  4. #https://github.community/t/how-to-execute-jobs-if-folder-updated-recursive/117344/5
  5. jobs:
  6. check:
  7. name: Check changed files
  8. outputs:
  9. database_run_job: ${{ steps.check_files.outputs.database_run_job }}
  10. functions_run_job: ${{ steps.check_files.outputs.functions_run_job }}
  11. runs-on: ubuntu-latest
  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: ./scripts/code_coverage_report/get_updated_files.sh
  22. pod-lib-lint-database:
  23. # Don't run on private repo unless it is a PR.
  24. needs: check
  25. if: github.repository == 'Firebase/firebase-ios-sdk' && needs.check.outputs.database_run_job == 'true'
  26. runs-on: macOS-latest
  27. strategy:
  28. matrix:
  29. target: [ios, tvos, macos]
  30. steps:
  31. - uses: actions/checkout@v2
  32. - name: Setup Bundler
  33. run: scripts/setup_bundler.sh
  34. - name: Build and test
  35. env:
  36. SDK: database
  37. run: ./scripts/code_coverage_report/pod_test_code_coverage_report.sh FirebaseDatabase "${{ matrix.target }}"
  38. - uses: actions/upload-artifact@v2
  39. with:
  40. name: database-codecoverage
  41. path: /Users/runner/*.xcresult
  42. pod-lib-lint-functions:
  43. # Don't run on private repo unless it is a PR.
  44. needs: check
  45. if: github.repository == 'Firebase/firebase-ios-sdk' && needs.check.outputs.functions_run_job == 'true'
  46. runs-on: macOS-latest
  47. strategy:
  48. matrix:
  49. target: [ios, tvos, macos]
  50. steps:
  51. - uses: actions/checkout@v2
  52. - name: Setup Bundler
  53. run: scripts/setup_bundler.sh
  54. - name: Build and test
  55. run: ./scripts/code_coverage_report/pod_test_code_coverage_report.sh FirebaseFunctions "${{ matrix.target }}"
  56. - uses: actions/upload-artifact@v2
  57. with:
  58. name: functions-codecoverage
  59. path: /Users/runner/*.xcresult
  60. create_report:
  61. needs: [pod-lib-lint-functions, pod-lib-lint-database]
  62. if: always()
  63. runs-on: macOS-latest
  64. steps:
  65. - uses: actions/download-artifact@v2
  66. id: download
  67. with:
  68. path: /Users/runner/test
  69. - name: display results
  70. run: |
  71. if [ -d "${{steps.download.outputs.download-path}}" ]; then
  72. find "/Users/runner/test" -print -regex ".*/.*\.xcresult" -exec xcrun xccov view --report {} \;
  73. fi