release-build.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. # Releases a new minor / major version from a release branch
  2. name: Release Build
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. release-branch-name:
  7. description: The release branch to use, e.g. v1.9.x
  8. required: true
  9. version:
  10. # TODO (trask) this is redundant
  11. description: The version of the release, e.g. 1.9.0 (without the "v" prefix)
  12. required: true
  13. jobs:
  14. test:
  15. runs-on: ubuntu-latest
  16. strategy:
  17. matrix:
  18. test-java-version:
  19. - 8
  20. - 11
  21. - 15
  22. steps:
  23. - uses: actions/checkout@v2.3.4
  24. with:
  25. ref: ${{ github.event.inputs.release-branch-name }}
  26. fetch-depth: 0
  27. - id: setup-test-java
  28. name: Set up JDK ${{ matrix.test-java-version }} for running tests
  29. uses: actions/setup-java@v2
  30. with:
  31. distribution: adopt
  32. java-version: ${{ matrix.test-java-version }}
  33. - name: Set up JDK 11 for running Gradle
  34. uses: actions/setup-java@v2
  35. with:
  36. distribution: adopt
  37. java-version: 11
  38. - name: Restore cache
  39. uses: burrunan/gradle-cache-action@v1.10
  40. with:
  41. job-id: jdk${{ matrix.test-java-version }}
  42. read-only: true
  43. - name: Cache Gradle Wrapper
  44. uses: actions/cache@v2
  45. with:
  46. path: ~/.gradle/wrapper
  47. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  48. - name: Test
  49. run: ./gradlew test -PtestJavaVersion=${{ matrix.test-java-version }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
  50. # testLatestDeps is intentionally not included in the release workflows
  51. # because any time a new library version is released to maven central
  52. # it can fail due to test code incompatibility with the new library version,
  53. # or due to slight changes in emitted telemetry
  54. smoke-test:
  55. runs-on: ${{ matrix.os }}
  56. strategy:
  57. matrix:
  58. os:
  59. - windows-latest
  60. - ubuntu-latest
  61. smoke-test-suite:
  62. - jetty
  63. - liberty
  64. - payara
  65. - tomcat
  66. - tomee
  67. - websphere
  68. - wildfly
  69. - other
  70. exclude:
  71. - os: windows-latest
  72. smoke-test-suite: websphere
  73. steps:
  74. - name: Support longpaths
  75. run: git config --system core.longpaths true
  76. if: matrix.os == 'windows-latest'
  77. - uses: actions/checkout@v2.3.4
  78. with:
  79. ref: ${{ github.event.inputs.release-branch-name }}
  80. fetch-depth: 0
  81. - name: Set up JDK 11 for running Gradle
  82. uses: actions/setup-java@v2
  83. with:
  84. distribution: adopt
  85. java-version: 11
  86. - name: Restore cache
  87. uses: burrunan/gradle-cache-action@v1.10
  88. with:
  89. job-id: smokeTests
  90. read-only: true
  91. - name: Cache Gradle Wrapper
  92. uses: actions/cache@v2
  93. with:
  94. path: ~/.gradle/wrapper
  95. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
  96. - name: Test
  97. run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
  98. # muzzle is intentionally not included in the release workflows
  99. # because any time a new library version is released to maven central it can fail,
  100. # and this is not a reason to hold up the release
  101. examples:
  102. runs-on: ubuntu-latest
  103. steps:
  104. - uses: actions/checkout@v2.3.4
  105. with:
  106. ref: ${{ github.event.inputs.release-branch-name }}
  107. fetch-depth: 0
  108. - name: Set up JDK 11 for running Gradle
  109. uses: actions/setup-java@v2
  110. with:
  111. distribution: adopt
  112. java-version: 11
  113. - name: Cache Gradle Wrapper
  114. uses: actions/cache@v2
  115. with:
  116. path: ~/.gradle/wrapper
  117. key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('examples/distro/gradle/wrapper/gradle-wrapper.properties') }}
  118. - name: Local publish of artifacts
  119. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  120. run: ./gradlew publishToMavenLocal -x javadoc
  121. - name: Local publish of gradle plugins
  122. # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
  123. run: ../gradlew publishToMavenLocal -x javadoc
  124. working-directory: gradle-plugins
  125. - name: Build distro
  126. run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
  127. working-directory: examples/distro
  128. - name: Build extension
  129. run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
  130. working-directory: examples/extension
  131. - name: Run muzzle check against extension
  132. run: ./gradlew muzzle --init-script ../../.github/scripts/local.init.gradle.kts
  133. working-directory: examples/extension
  134. release:
  135. needs: [ test, smoke-test, examples ]
  136. name: Build and release
  137. runs-on: ubuntu-latest
  138. steps:
  139. - uses: actions/checkout@v2.3.4
  140. with:
  141. ref: ${{ github.event.inputs.release-branch-name }}
  142. fetch-depth: 0
  143. - name: Set up JDK 11 for running Gradle
  144. uses: actions/setup-java@v2
  145. with:
  146. distribution: adopt
  147. java-version: 11
  148. - name: Build and publish artifacts
  149. uses: burrunan/gradle-cache-action@v1.10
  150. with:
  151. job-id: jdk11
  152. remote-build-cache-proxy-enabled: false
  153. arguments: assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
  154. env:
  155. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  156. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  157. GRGIT_USER: ${{ github.actor }}
  158. GRGIT_PASS: ${{ secrets.GITHUB_TOKEN }}
  159. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  160. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  161. # TODO (trask) cache gradle wrapper?
  162. - name: Build and publish gradle plugins
  163. env:
  164. GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
  165. GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
  166. run: ../gradlew build publishPlugins
  167. working-directory: gradle-plugins
  168. - name: Create Release
  169. id: create_release
  170. uses: actions/create-release@v1.1.4
  171. env:
  172. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  173. with:
  174. tag_name: v${{ github.event.inputs.version }}
  175. commitish: ${{ github.event.inputs.release-branch-name }}
  176. release_name: Release v${{ github.event.inputs.version }}
  177. draft: true
  178. prerelease: false
  179. - name: Upload Release Asset
  180. id: upload-release-asset
  181. uses: actions/upload-release-asset@v1.0.2
  182. env:
  183. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  184. with:
  185. upload_url: ${{ steps.create_release.outputs.upload_url }}
  186. asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}.jar
  187. asset_name: opentelemetry-javaagent.jar
  188. asset_content_type: application/java-archive