pr.yml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. with:
  12. fetch-depth: 0
  13. - name: Set up JDK 11 for running Gradle
  14. uses: actions/setup-java@v2
  15. with:
  16. distribution: adopt
  17. java-version: 11
  18. - name: Restore cache
  19. uses: burrunan/gradle-cache-action@v1.10
  20. with:
  21. job-id: jdk11
  22. - name: Cache Gradle Wrapper
  23. uses: actions/cache@v2
  24. with:
  25. path: ~/.gradle/wrapper
  26. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  27. - name: Start deadlock detector
  28. run: .github/scripts/deadlock-detector.sh
  29. - name: Build
  30. run: ./gradlew build --stacktrace
  31. - name: Upload deadlock detector artifacts if any
  32. if: always()
  33. uses: actions/upload-artifact@v2
  34. with:
  35. name: deadlock-detector-build
  36. path: /tmp/deadlock-detector-*
  37. if-no-files-found: ignore
  38. - name: Upload OpenJ9 javacore files if any
  39. if: always()
  40. uses: actions/upload-artifact@v2
  41. with:
  42. name: javacore-build
  43. path: "**/javacore.*.txt"
  44. if-no-files-found: ignore
  45. build-gradle-plugins:
  46. runs-on: ubuntu-latest
  47. steps:
  48. - uses: actions/checkout@v2.3.4
  49. with:
  50. fetch-depth: 0
  51. - name: Set up JDK 11 for running Gradle
  52. uses: actions/setup-java@v2
  53. with:
  54. distribution: adopt
  55. java-version: 11
  56. - name: Cache Gradle Wrapper
  57. uses: actions/cache@v2
  58. with:
  59. path: ~/.gradle/wrapper
  60. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  61. - name: Build
  62. run: ../gradlew build --stacktrace
  63. working-directory: gradle-plugins
  64. test:
  65. runs-on: ubuntu-latest
  66. strategy:
  67. matrix:
  68. test-java-version:
  69. - 8
  70. - 11
  71. - 15
  72. vm:
  73. - hotspot
  74. - openj9
  75. fail-fast: false
  76. steps:
  77. - uses: actions/checkout@v2.3.4
  78. with:
  79. fetch-depth: 0
  80. - id: setup-test-java
  81. name: Set up JDK ${{ matrix.test-java-version }}-${{ matrix.vm }} for running tests
  82. uses: actions/setup-java@v2
  83. with:
  84. distribution: adopt-${{ matrix.vm }}
  85. java-version: ${{ matrix.test-java-version }}
  86. - name: Set up JDK 11 for running Gradle
  87. uses: actions/setup-java@v2
  88. with:
  89. distribution: adopt
  90. java-version: 11
  91. - name: Restore cache
  92. uses: burrunan/gradle-cache-action@v1.10
  93. with:
  94. job-id: jdk${{ matrix.test-java-version }}
  95. read-only: true
  96. - name: Cache Gradle Wrapper
  97. uses: actions/cache@v2
  98. with:
  99. path: ~/.gradle/wrapper
  100. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  101. - name: Start deadlock detector
  102. run: .github/scripts/deadlock-detector.sh
  103. - name: Test
  104. run: ./gradlew test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} --stacktrace -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
  105. - name: Upload deadlock detector artifacts if any
  106. if: always()
  107. uses: actions/upload-artifact@v2
  108. with:
  109. name: deadlock-detector-test-${{ matrix.test-java-version }}
  110. path: /tmp/deadlock-detector-*
  111. if-no-files-found: ignore
  112. - name: Upload OpenJ9 javacore files if any
  113. if: always()
  114. uses: actions/upload-artifact@v2
  115. with:
  116. name: javacore-test-${{ matrix.test-java-version }}
  117. path: "**/javacore.*.txt"
  118. if-no-files-found: ignore
  119. # testLatestDeps is intentionally not included in the PR workflow
  120. # because any time a new library version is released to maven central
  121. # it can fail due to test code incompatibility with the new library version,
  122. # or due to slight changes in emitted telemetry, which can be confusing for contributors
  123. # (muzzle can also fail when a new library version is released to maven central
  124. # but that happens much less often)
  125. smoke-test:
  126. runs-on: ${{ matrix.os }}
  127. strategy:
  128. matrix:
  129. os:
  130. - windows-latest
  131. - ubuntu-latest
  132. smoke-test-suite:
  133. - glassfish
  134. - jetty
  135. - liberty
  136. - tomcat
  137. - tomee
  138. - wildfly
  139. - other
  140. fail-fast: false
  141. steps:
  142. - name: Support longpaths
  143. run: git config --system core.longpaths true
  144. if: matrix.os == 'windows-latest'
  145. - uses: actions/checkout@v2.3.4
  146. with:
  147. fetch-depth: 0
  148. - name: Set up JDK 11 for running Gradle
  149. uses: actions/setup-java@v2
  150. with:
  151. distribution: adopt
  152. java-version: 11
  153. - name: Restore cache
  154. uses: burrunan/gradle-cache-action@v1.10
  155. with:
  156. job-id: smokeTests
  157. read-only: true
  158. - name: Cache Gradle Wrapper
  159. uses: actions/cache@v2
  160. with:
  161. path: ~/.gradle/wrapper
  162. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  163. - name: Test
  164. run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
  165. setup-muzzle-matrix:
  166. runs-on: ubuntu-latest
  167. outputs:
  168. matrix: ${{ steps.set-matrix.outputs.matrix }}
  169. steps:
  170. - name: Check out repository
  171. uses: actions/checkout@v2.3.4
  172. with:
  173. fetch-depth: 0
  174. - name: Set up JDK 11 for running Gradle
  175. uses: actions/setup-java@v2
  176. with:
  177. distribution: adopt
  178. java-version: 11
  179. - name: Cache Gradle Wrapper
  180. uses: actions/cache@v2
  181. with:
  182. path: ~/.gradle/wrapper
  183. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  184. - id: set-matrix
  185. run: echo "::set-output name=matrix::{\"module\":[\"$(./gradlew -q instrumentation:listInstrumentations | xargs echo | sed 's/ /","/g')\"]}"
  186. muzzle:
  187. needs: setup-muzzle-matrix
  188. runs-on: ubuntu-latest
  189. strategy:
  190. matrix: ${{fromJson(needs.setup-muzzle-matrix.outputs.matrix)}}
  191. fail-fast: false
  192. steps:
  193. - name: Check out repository
  194. uses: actions/checkout@v2.3.4
  195. with:
  196. fetch-depth: 0
  197. - name: Set up JDK 11 for running Gradle
  198. uses: actions/setup-java@v2
  199. with:
  200. distribution: adopt
  201. java-version: 11
  202. - name: Cache Gradle Wrapper
  203. uses: actions/cache@v2
  204. with:
  205. path: ~/.gradle/wrapper
  206. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  207. - name: Run muzzle
  208. # using retry because of sporadic gradle download failures
  209. uses: nick-invision/retry@v2.5.0
  210. with:
  211. # timing out has not been a problem, these jobs typically finish in 2-3 minutes
  212. timeout_minutes: 15
  213. max_attempts: 3
  214. command: ./gradlew ${{ matrix.module }}:muzzle
  215. examples:
  216. runs-on: ubuntu-latest
  217. # When we make PR against pre-release branch examples may point to yet-unpublished version
  218. if: github.base_ref == 'main'
  219. steps:
  220. - uses: actions/checkout@v2.3.4
  221. with:
  222. fetch-depth: 0
  223. - name: Set up JDK 11 for running Gradle
  224. uses: actions/setup-java@v2
  225. with:
  226. distribution: adopt
  227. java-version: 11
  228. - name: Cache Gradle Wrapper
  229. uses: actions/cache@v2
  230. with:
  231. path: ~/.gradle/wrapper
  232. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('examples/distro/gradle/wrapper/gradle-wrapper.properties') }}
  233. - name: Local publish of artifacts
  234. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  235. run: ./gradlew publishToMavenLocal -x javadoc
  236. - name: Local publish of gradle plugins
  237. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  238. run: ../gradlew publishToMavenLocal -x javadoc
  239. working-directory: gradle-plugins
  240. - name: Build distro
  241. run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts --stacktrace
  242. working-directory: examples/distro
  243. - name: Build extension
  244. run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts --stacktrace
  245. working-directory: examples/extension
  246. accept-pr:
  247. needs: [ build, test, smoke-test, muzzle, examples ]
  248. runs-on: ubuntu-latest
  249. if: always()
  250. steps:
  251. # run this action to get workflow conclusion
  252. # You can get conclusion by env (env.WORKFLOW_CONCLUSION)
  253. - uses: technote-space/workflow-conclusion-action@v2.2
  254. - name: Fail build
  255. if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
  256. run: exit 1