pr.yml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. name: PR build
  2. on: pull_request
  3. concurrency:
  4. group: ci-${{ github.event.pull_request.number }}
  5. cancel-in-progress: true
  6. jobs:
  7. build:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v2.3.4
  11. - name: Set up JDK 11 for running Gradle
  12. uses: actions/setup-java@v2
  13. with:
  14. distribution: adopt
  15. java-version: 11
  16. - name: Start deadlock detector
  17. run: .github/scripts/deadlock-detector.sh
  18. - name: Build
  19. uses: gradle/gradle-build-action@v2
  20. with:
  21. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  22. arguments: build -x javadoc
  23. cache-read-only: true
  24. - name: Upload deadlock detector artifacts if any
  25. if: always()
  26. uses: actions/upload-artifact@v2
  27. with:
  28. name: deadlock-detector-build
  29. path: /tmp/deadlock-detector-*
  30. if-no-files-found: ignore
  31. - name: Upload jvm crash dump files if any
  32. if: always()
  33. uses: actions/upload-artifact@v2
  34. with:
  35. name: javacore-build
  36. path: |
  37. "**/hs_err_pid*.log"
  38. "**/javacore.*.txt"
  39. "**/Snap.*.trc"
  40. "**/core.*.dmp"
  41. "**/jitdump.*.dmp"
  42. if-no-files-found: ignore
  43. build-gradle-plugins:
  44. runs-on: ubuntu-latest
  45. steps:
  46. - uses: actions/checkout@v2.3.4
  47. - name: Set up JDK 11 for running Gradle
  48. uses: actions/setup-java@v2
  49. with:
  50. distribution: adopt
  51. java-version: 11
  52. - name: Build
  53. uses: gradle/gradle-build-action@v2
  54. with:
  55. cache-read-only: true
  56. arguments: build
  57. build-root-directory: gradle-plugins
  58. test:
  59. runs-on: ubuntu-latest
  60. strategy:
  61. matrix:
  62. test-java-version:
  63. - 8
  64. - 11
  65. - 15
  66. vm:
  67. - hotspot
  68. - openj9
  69. fail-fast: false
  70. steps:
  71. - uses: actions/checkout@v2.3.4
  72. - id: setup-test-java
  73. name: Set up JDK ${{ matrix.test-java-version }}-${{ matrix.vm }} for running tests
  74. uses: actions/setup-java@v2
  75. with:
  76. distribution: adopt-${{ matrix.vm }}
  77. java-version: ${{ matrix.test-java-version }}
  78. - name: Set up JDK 11 for running Gradle
  79. uses: actions/setup-java@v2
  80. with:
  81. distribution: adopt
  82. java-version: 11
  83. - name: Start deadlock detector
  84. run: .github/scripts/deadlock-detector.sh
  85. - name: Test
  86. uses: gradle/gradle-build-action@v2
  87. with:
  88. arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
  89. cache-read-only: true
  90. - name: Upload deadlock detector artifacts if any
  91. if: always()
  92. uses: actions/upload-artifact@v2
  93. with:
  94. name: deadlock-detector-test-${{ matrix.test-java-version }}
  95. path: /tmp/deadlock-detector-*
  96. if-no-files-found: ignore
  97. - name: Upload jvm crash dump files if any
  98. if: always()
  99. uses: actions/upload-artifact@v2
  100. with:
  101. name: javacore-test-${{ matrix.test-java-version }}
  102. path: |
  103. "**/hs_err_pid*.log"
  104. "**/javacore.*.txt"
  105. "**/Snap.*.trc"
  106. "**/core.*.dmp"
  107. "**/jitdump.*.dmp"
  108. if-no-files-found: ignore
  109. testLatestDeps:
  110. # testLatestDeps is not included in the PR workflow by default
  111. # because any time a new library version is released to maven central
  112. # it can fail due to test code incompatibility with the new library version,
  113. # or due to slight changes in emitted telemetry, which can be confusing for contributors
  114. # (muzzle can also fail when a new library version is released to maven central
  115. # but that happens much less often)
  116. #
  117. # the condition is on the steps below instead of here on the job, because skipping the job
  118. # causes the job to show up as canceled in the GitHub UI which prevents the build section from
  119. # collapsing when everything (else) is green
  120. #
  121. # and the name is updated when the steps below are skipped which makes what's happening clearer
  122. # in the GitHub UI
  123. name: testLatestDeps${{ !contains(github.event.pull_request.labels.*.name, 'test latest deps') && ' (skipped)' || ''}}
  124. runs-on: ubuntu-latest
  125. steps:
  126. - uses: actions/checkout@v2.3.4
  127. - name: Set up JDK 11 for running Gradle
  128. if: ${{ contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
  129. uses: actions/setup-java@v2
  130. with:
  131. distribution: adopt
  132. java-version: 11
  133. - name: Test
  134. if: ${{ contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
  135. uses: gradle/gradle-build-action@v2
  136. with:
  137. arguments: test -PtestLatestDeps=true
  138. cache-read-only: true
  139. smoke-test:
  140. runs-on: ${{ matrix.os }}
  141. strategy:
  142. matrix:
  143. os:
  144. - windows-2019
  145. - ubuntu-latest
  146. smoke-test-suite:
  147. - jetty
  148. - liberty
  149. - payara
  150. - tomcat
  151. - tomee
  152. - websphere
  153. - wildfly
  154. - other
  155. exclude:
  156. - os: windows-2019
  157. smoke-test-suite: websphere
  158. fail-fast: false
  159. steps:
  160. - name: Support longpaths
  161. run: git config --system core.longpaths true
  162. if: matrix.os == 'windows-2019'
  163. - uses: actions/checkout@v2.3.4
  164. - name: Set up JDK 11 for running Gradle
  165. uses: actions/setup-java@v2
  166. with:
  167. distribution: adopt
  168. java-version: 11
  169. - name: Test
  170. uses: gradle/gradle-build-action@v2
  171. with:
  172. cache-read-only: true
  173. arguments: ":smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}"
  174. setup-muzzle-matrix:
  175. # release branches are excluded
  176. # because any time a new library version is released to maven central it can fail
  177. # which requires unnecessary release branch maintenance, especially for patches
  178. if: ${{ !startsWith(github.base_ref, 'v') }}
  179. runs-on: ubuntu-latest
  180. outputs:
  181. matrix: ${{ steps.set-matrix.outputs.matrix }}
  182. steps:
  183. - name: Check out repository
  184. uses: actions/checkout@v2.3.4
  185. with:
  186. fetch-depth: 0
  187. - name: Set up JDK 11 for running Gradle
  188. uses: actions/setup-java@v2
  189. with:
  190. distribution: adopt
  191. java-version: 11
  192. - name: List instrumentations to file
  193. uses: gradle/gradle-build-action@v2
  194. with:
  195. arguments: instrumentation:listInstrumentations
  196. cache-read-only: true
  197. - id: set-matrix
  198. run: echo "::set-output name=matrix::{\"module\":[\"$(cat instrumentation-list.txt | xargs echo | sed 's/ /","/g')\"]}"
  199. muzzle:
  200. needs: setup-muzzle-matrix
  201. runs-on: ubuntu-latest
  202. strategy:
  203. matrix: ${{fromJson(needs.setup-muzzle-matrix.outputs.matrix)}}
  204. fail-fast: false
  205. steps:
  206. - name: Check out repository
  207. uses: actions/checkout@v2.3.4
  208. - name: Set up JDK 11 for running Gradle
  209. uses: actions/setup-java@v2
  210. with:
  211. distribution: adopt
  212. java-version: 11
  213. - name: Run muzzle
  214. uses: gradle/gradle-build-action@v2
  215. with:
  216. arguments: ${{ matrix.module }}:muzzle
  217. cache-read-only: true
  218. examples:
  219. runs-on: ubuntu-latest
  220. steps:
  221. - uses: actions/checkout@v2.3.4
  222. - name: Set up JDK 11 for running Gradle
  223. uses: actions/setup-java@v2
  224. with:
  225. distribution: adopt
  226. java-version: 11
  227. - name: Local publish of artifacts
  228. uses: gradle/gradle-build-action@v2
  229. with:
  230. cache-read-only: true
  231. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  232. arguments: publishToMavenLocal -x javadoc
  233. - name: Local publish of gradle plugins
  234. uses: gradle/gradle-build-action@v2
  235. with:
  236. cache-read-only: true
  237. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  238. arguments: publishToMavenLocal -x javadoc
  239. build-root-directory: gradle-plugins
  240. - name: Build distro
  241. uses: gradle/gradle-build-action@v2
  242. with:
  243. cache-read-only: true
  244. arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
  245. build-root-directory: examples/distro
  246. - name: Build extension
  247. uses: gradle/gradle-build-action@v2
  248. with:
  249. cache-read-only: true
  250. arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
  251. build-root-directory: examples/extension
  252. - name: Run muzzle check against extension
  253. uses: gradle/gradle-build-action@v2
  254. with:
  255. cache-read-only: true
  256. arguments: muzzle --init-script ../../.github/scripts/local.init.gradle.kts
  257. build-root-directory: examples/extension
  258. accept-pr:
  259. needs: [ build, test, smoke-test, muzzle, examples ]
  260. runs-on: ubuntu-latest
  261. if: always()
  262. steps:
  263. # run this action to get workflow conclusion
  264. # You can get conclusion by env (env.WORKFLOW_CONCLUSION)
  265. - uses: technote-space/workflow-conclusion-action@v2.2
  266. - name: Fail build
  267. if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
  268. run: exit 1