ci.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. name: CI build
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - v[0-9]+.[0-9]+.x
  7. workflow_dispatch:
  8. jobs:
  9. build:
  10. uses: ./.github/workflows/reusable-build.yml
  11. secrets:
  12. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  13. GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
  14. GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
  15. test:
  16. uses: ./.github/workflows/reusable-test.yml
  17. secrets:
  18. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  19. GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
  20. GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
  21. testLatestDeps:
  22. # release branches are excluded
  23. # because any time a new library version is released to maven central it can fail
  24. # which requires unnecessary release branch maintenance, especially for patches
  25. if: ${{ !startsWith(github.ref_name, 'v') }}
  26. uses: ./.github/workflows/reusable-test-latest-deps.yml
  27. secrets:
  28. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  29. GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
  30. GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
  31. smoke-test:
  32. uses: ./.github/workflows/reusable-smoke-test.yml
  33. secrets:
  34. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  35. GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
  36. GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
  37. muzzle:
  38. # release branches are excluded
  39. # because any time a new library version is released to maven central it can fail
  40. # which requires unnecessary release branch maintenance, especially for patches
  41. if: ${{ !startsWith(github.ref_name, 'v') }}
  42. uses: ./.github/workflows/reusable-muzzle.yml
  43. examples:
  44. uses: ./.github/workflows/reusable-examples.yml
  45. markdown-link-check:
  46. # release branches are excluded
  47. # because links to external urls can break at any time which requires unnecessary release branch
  48. # maintenance, especially for patches (and also because the README.md javaagent download link
  49. # has to be updated on release branches before the release download has been published)
  50. if: ${{ !startsWith(github.ref_name, 'v') }}
  51. runs-on: ubuntu-latest
  52. steps:
  53. - uses: actions/checkout@v3
  54. - name: Check markdown links
  55. # using retry because of sporadic external site failures
  56. uses: nick-invision/retry@v2.6.0
  57. with:
  58. # timing out has not been a problem
  59. timeout_minutes: 15
  60. # give external site some time to hopefully recover
  61. retry_wait_seconds: 120
  62. max_attempts: 5
  63. command: |
  64. npm install -g markdown-link-check
  65. find . -type f \
  66. -name '*.md' \
  67. -not -path './.github/*' \
  68. -not -path './node_modules/*' \
  69. -print0 \
  70. | xargs -0 -n1 markdown-link-check --config .github/scripts/markdown_link_check_config.json
  71. markdown-misspell-check:
  72. runs-on: ubuntu-latest
  73. steps:
  74. - uses: actions/checkout@v3
  75. - name: Check markdown for common misspellings
  76. run: |
  77. curl -L -o ./install-misspell.sh https://git.io/misspell
  78. sh ./install-misspell.sh
  79. ./bin/misspell -error ./**/*
  80. snapshot:
  81. runs-on: ubuntu-latest
  82. # intentionally not blocking snapshot publishing on testLatestDeps
  83. # because any time a new library version is released to maven central
  84. # it can fail due to test code incompatibility with the new library version,
  85. # or due to slight changes in emitted telemetry
  86. #
  87. # also not blocking snapshot publishing on markdown-link-check because links to external urls
  88. # can break at any time
  89. needs: [ build, test, smoke-test, examples, muzzle, markdown-misspell-check ]
  90. if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-instrumentation' }}
  91. steps:
  92. - uses: actions/checkout@v3
  93. - name: Set up JDK for running Gradle
  94. uses: actions/setup-java@v2
  95. with:
  96. distribution: temurin
  97. java-version: 17
  98. - name: Build and publish artifact snapshots
  99. env:
  100. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  101. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  102. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  103. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  104. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  105. uses: gradle/gradle-build-action@v2
  106. with:
  107. arguments: assemble publishToSonatype
  108. - name: Build and publish gradle plugin snapshots
  109. env:
  110. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  111. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  112. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  113. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  114. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  115. uses: gradle/gradle-build-action@v2
  116. with:
  117. arguments: build publishToSonatype
  118. build-root-directory: gradle-plugins