reusable-smoke-test-images.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Every workflow that includes this must also include the following to make sure that it
  2. # is triggered when a new JDK is added to the matrix:
  3. #on:
  4. # push:
  5. # paths:
  6. # - ".github/workflows/reusable-smoke-test-images.yml"
  7. name: PR build fake backend images for smoke tests
  8. on:
  9. workflow_call:
  10. inputs:
  11. project:
  12. type: string
  13. required: true
  14. publish:
  15. type: boolean
  16. required: false
  17. cache-read-only:
  18. type: boolean
  19. required: false
  20. skip-java-8:
  21. type: boolean
  22. required: false
  23. skip-java-17:
  24. type: boolean
  25. required: false
  26. skip-java-21:
  27. type: boolean
  28. required: false
  29. permissions:
  30. contents: read
  31. jobs:
  32. build:
  33. runs-on: ubuntu-latest
  34. permissions:
  35. packages: write # for publishing docker image to github packages
  36. steps:
  37. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  38. - name: Free disk space
  39. run: .github/scripts/gha-free-disk-space.sh
  40. - name: Set up JDK for running Gradle
  41. uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
  42. with:
  43. distribution: temurin
  44. java-version-file: .java-version
  45. - name: Login to GitHub package registry
  46. if: inputs.publish
  47. uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
  48. with:
  49. registry: ghcr.io
  50. username: ${{ github.repository_owner }}
  51. password: ${{ secrets.GITHUB_TOKEN }}
  52. - name: Set tag
  53. run: echo "TAG=$(date '+%Y%m%d').$GITHUB_RUN_ID" >> $GITHUB_ENV
  54. - name: Set up Gradle cache
  55. uses: gradle/actions/setup-gradle@d9336dac04dea2507a617466bc058a3def92b18b # v3.4.0
  56. with:
  57. cache-read-only: ${{ inputs.cache-read-only }}
  58. - name: Build Java 8 Docker image
  59. if: "!inputs.skip-java-8"
  60. run: ./gradlew ${{ inputs.project }}:${{ inputs.publish && 'jib' || 'jibDockerBuild' }} -Ptag=${{ env.TAG }} -PtargetJDK=8 -Djib.httpTimeout=120000 -Djib.console=plain
  61. - name: Build Java 11 Docker image
  62. run: ./gradlew ${{ inputs.project }}:${{ inputs.publish && 'jib' || 'jibDockerBuild' }} -Ptag=${{ env.TAG }} -PtargetJDK=11 -Djib.httpTimeout=120000 -Djib.console=plain
  63. - name: Build Java 17 Docker image
  64. if: "!inputs.skip-java-17"
  65. run: ./gradlew ${{ inputs.project }}:${{ inputs.publish && 'jib' || 'jibDockerBuild' }} -Ptag=${{ env.TAG }} -PtargetJDK=17 -Djib.httpTimeout=120000 -Djib.console=plain
  66. - name: Build Java 21 Docker image
  67. if: "!inputs.skip-java-21"
  68. run: ./gradlew ${{ inputs.project }}:${{ inputs.publish && 'jib' || 'jibDockerBuild' }} -Ptag=${{ env.TAG }} -PtargetJDK=21 -Djib.httpTimeout=120000 -Djib.console=plain