build-pull-request.yml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. name: Build pull request
  2. on:
  3. pull_request:
  4. concurrency:
  5. group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
  6. cancel-in-progress: true
  7. jobs:
  8. assemble:
  9. uses: ./.github/workflows/reusable-assemble.yml
  10. with:
  11. cache-read-only: true
  12. test:
  13. uses: ./.github/workflows/reusable-test.yml
  14. with:
  15. cache-read-only: true
  16. test-latest-deps:
  17. # test-latest-deps is not included in the PR workflow by default
  18. # because any time a new library version is released to maven central
  19. # it can fail due to test code incompatibility with the new library version,
  20. # or due to slight changes in emitted telemetry, which can be confusing for contributors
  21. # (muzzle can also fail when a new library version is released to maven central
  22. # but that happens much less often)
  23. #
  24. # the condition is on the steps below instead of here on the job, because skipping the job
  25. # causes the job to show up as canceled in the GitHub UI which prevents the build section from
  26. # collapsing when everything (else) is green
  27. #
  28. # and the name is updated when the steps below are skipped which makes what's happening clearer
  29. # in the GitHub UI
  30. uses: ./.github/workflows/reusable-test-latest-deps.yml
  31. with:
  32. skip: ${{ !contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
  33. cache-read-only: true
  34. smoke-test:
  35. uses: ./.github/workflows/reusable-smoke-test.yml
  36. with:
  37. # windows smoke tests are slower, and it's rare for only the windows smoke tests to break
  38. skip-windows: ${{ !contains(github.event.pull_request.labels.*.name, 'test windows') }}
  39. cache-read-only: true
  40. muzzle:
  41. # release branch PRs are excluded
  42. # because any time a new library version is released to maven central it can fail
  43. # which requires unnecessary release branch maintenance, especially for patches
  44. if: ${{ !startsWith(github.base_ref, 'release/') }}
  45. uses: ./.github/workflows/reusable-muzzle.yml
  46. with:
  47. cache-read-only: true
  48. gradle-plugins:
  49. uses: ./.github/workflows/reusable-gradle-plugins.yml
  50. with:
  51. cache-read-only: true
  52. examples:
  53. uses: ./.github/workflows/reusable-examples.yml
  54. with:
  55. cache-read-only: true
  56. # this is not a required check to avoid blocking pull requests if external links break
  57. markdown-link-check:
  58. # release branches are excluded to avoid unnecessary maintenance
  59. if: ${{ !startsWith(github.ref_name, 'release/') }}
  60. uses: ./.github/workflows/reusable-markdown-link-check.yml
  61. # this is not a required check to avoid blocking pull requests if new misspellings are added
  62. # to the misspell dictionary
  63. misspell-check:
  64. # release branches are excluded to avoid unnecessary maintenance
  65. if: ${{ !startsWith(github.ref_name, 'release/') }}
  66. uses: ./.github/workflows/reusable-misspell-check.yml
  67. required-status-check:
  68. needs:
  69. - assemble
  70. - test
  71. - smoke-test
  72. - muzzle
  73. - gradle-plugins
  74. - examples
  75. runs-on: ubuntu-latest
  76. if: always()
  77. steps:
  78. - if: |
  79. needs.assemble.result != 'success' ||
  80. needs.test.result != 'success' ||
  81. needs.smoke-test.result != 'success' ||
  82. (!startsWith(github.base_ref, 'release/') && needs.muzzle.result != 'success') ||
  83. needs.gradle-plugins.result != 'success' ||
  84. needs.examples.result != 'success'
  85. run: exit 1