_push-entrypoint.yaml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. name: Push Entrypoint
  2. concurrency:
  3. group: push-entrypoint-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. tags:
  8. - 'v*'
  9. branches:
  10. - 'master'
  11. - 'release-5[0-9]'
  12. - 'ci/**'
  13. workflow_dispatch:
  14. inputs:
  15. ref:
  16. required: false
  17. defaults:
  18. run:
  19. shell: bash
  20. env:
  21. IS_CI: 'yes'
  22. jobs:
  23. init:
  24. runs-on: ubuntu-22.04
  25. outputs:
  26. BUILDER_VSN: ${{ steps.env.outputs.BUILDER_VSN }}
  27. OTP_VSN: ${{ steps.env.outputs.OTP_VSN }}
  28. ELIXIR_VSN: ${{ steps.env.outputs.ELIXIR_VSN }}
  29. BUILDER: ${{ steps.env.outputs.BUILDER }}
  30. BUILD_FROM: ${{ steps.env.outputs.BUILD_FROM }}
  31. RUN_FROM: ${{ steps.env.outputs.RUN_FROM }}
  32. steps:
  33. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  34. with:
  35. ref: ${{ github.event.inputs.ref }}
  36. - name: Set up environment
  37. id: env
  38. run: |
  39. source env.sh
  40. echo "BUILDER_VSN=$EMQX_BUILDER_VSN" >> "$GITHUB_OUTPUT"
  41. echo "OTP_VSN=$OTP_VSN" >> "$GITHUB_OUTPUT"
  42. echo "ELIXIR_VSN=$ELIXIR_VSN" >> "$GITHUB_OUTPUT"
  43. echo "BUILDER=$EMQX_BUILDER" >> "$GITHUB_OUTPUT"
  44. echo "BUILD_FROM=$EMQX_DOCKER_BUILD_FROM" >> "$GITHUB_OUTPUT"
  45. echo "RUN_FROM=$EMQX_DOCKER_RUN_FROM" >> "$GITHUB_OUTPUT"
  46. prepare:
  47. runs-on: ubuntu-22.04
  48. needs: init
  49. container: ${{ needs.init.outputs.BUILDER }}
  50. outputs:
  51. profile: ${{ steps.parse-git-ref.outputs.profile }}
  52. release: ${{ steps.parse-git-ref.outputs.release }}
  53. latest: ${{ steps.parse-git-ref.outputs.latest }}
  54. ct-matrix: ${{ steps.matrix.outputs.ct-matrix }}
  55. ct-host: ${{ steps.matrix.outputs.ct-host }}
  56. ct-docker: ${{ steps.matrix.outputs.ct-docker }}
  57. permissions:
  58. contents: read
  59. steps:
  60. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  61. with:
  62. ref: ${{ github.event.inputs.ref }}
  63. fetch-depth: 0
  64. - name: Work around https://github.com/actions/checkout/issues/766
  65. shell: bash
  66. run: |
  67. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  68. - name: Detect emqx profile
  69. id: parse-git-ref
  70. run: |
  71. JSON="$(./scripts/parse-git-ref.sh $GITHUB_REF)"
  72. PROFILE=$(echo "$JSON" | jq -cr '.profile')
  73. RELEASE=$(echo "$JSON" | jq -cr '.release')
  74. LATEST=$(echo "$JSON" | jq -cr '.latest')
  75. echo "profile=$PROFILE" | tee -a $GITHUB_OUTPUT
  76. echo "release=$RELEASE" | tee -a $GITHUB_OUTPUT
  77. echo "latest=$LATEST" | tee -a $GITHUB_OUTPUT
  78. - name: Build matrix
  79. id: matrix
  80. run: |
  81. MATRIX="$(./scripts/find-apps.sh --ci)"
  82. echo "${MATRIX}" | jq
  83. CT_MATRIX="$(echo "${MATRIX}" | jq -c 'map({profile}) | unique')"
  84. CT_HOST="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "host"))')"
  85. CT_DOCKER="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "docker"))')"
  86. echo "ct-matrix=${CT_MATRIX}" | tee -a $GITHUB_OUTPUT
  87. echo "ct-host=${CT_HOST}" | tee -a $GITHUB_OUTPUT
  88. echo "ct-docker=${CT_DOCKER}" | tee -a $GITHUB_OUTPUT
  89. build_packages:
  90. if: needs.prepare.outputs.release == 'true'
  91. needs:
  92. - init
  93. - prepare
  94. uses: ./.github/workflows/build_packages.yaml
  95. with:
  96. profile: ${{ needs.prepare.outputs.profile }}
  97. publish: true
  98. otp_vsn: ${{ needs.init.outputs.OTP_VSN }}
  99. elixir_vsn: ${{ needs.init.outputs.ELIXIR_VSN }}
  100. builder_vsn: ${{ needs.init.outputs.BUILDER_VSN }}
  101. secrets: inherit
  102. build_and_push_docker_images:
  103. if: needs.prepare.outputs.release == 'true'
  104. needs:
  105. - init
  106. - prepare
  107. uses: ./.github/workflows/build_and_push_docker_images.yaml
  108. with:
  109. profile: ${{ needs.prepare.outputs.profile }}
  110. publish: true
  111. latest: ${{ needs.prepare.outputs.latest }}
  112. build_from: ${{ needs.init.outputs.BUILD_FROM }}
  113. run_from: ${{ needs.init.outputs.RUN_FROM }}
  114. secrets: inherit
  115. build_slim_packages:
  116. if: needs.prepare.outputs.release != 'true'
  117. needs:
  118. - init
  119. - prepare
  120. uses: ./.github/workflows/build_slim_packages.yaml
  121. compile:
  122. if: needs.prepare.outputs.release != 'true'
  123. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  124. container: ${{ needs.init.outputs.BUILDER }}
  125. needs:
  126. - init
  127. - prepare
  128. strategy:
  129. matrix:
  130. profile:
  131. - emqx
  132. - emqx-enterprise
  133. permissions:
  134. contents: read
  135. steps:
  136. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  137. with:
  138. ref: ${{ github.event.inputs.ref }}
  139. fetch-depth: 0
  140. - name: Work around https://github.com/actions/checkout/issues/766
  141. run: |
  142. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  143. - id: compile
  144. env:
  145. PROFILE: ${{ matrix.profile }}
  146. ENABLE_COVER_COMPILE: 1
  147. run: |
  148. make $PROFILE
  149. echo "PROFILE=${PROFILE}" | tee -a .env
  150. echo "PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a .env
  151. zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
  152. - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
  153. with:
  154. name: ${{ matrix.profile }}
  155. path: ${{ matrix.profile }}.zip
  156. retention-days: 1
  157. run_emqx_app_tests:
  158. needs:
  159. - init
  160. - compile
  161. uses: ./.github/workflows/run_emqx_app_tests.yaml
  162. with:
  163. builder: ${{ needs.init.outputs.BUILDER }}
  164. before_ref: ${{ github.event.before }}
  165. after_ref: ${{ github.sha }}
  166. run_test_cases:
  167. if: needs.prepare.outputs.release != 'true'
  168. needs:
  169. - init
  170. - prepare
  171. - compile
  172. uses: ./.github/workflows/run_test_cases.yaml
  173. with:
  174. builder: ${{ needs.init.outputs.BUILDER }}
  175. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}
  176. ct-host: ${{ needs.prepare.outputs.ct-host }}
  177. ct-docker: ${{ needs.prepare.outputs.ct-docker }}
  178. run_conf_tests:
  179. if: needs.prepare.outputs.release != 'true'
  180. needs:
  181. - init
  182. - prepare
  183. - compile
  184. uses: ./.github/workflows/run_conf_tests.yaml
  185. with:
  186. builder: ${{ needs.init.outputs.BUILDER }}
  187. static_checks:
  188. if: needs.prepare.outputs.release != 'true'
  189. needs:
  190. - init
  191. - prepare
  192. - compile
  193. uses: ./.github/workflows/static_checks.yaml
  194. with:
  195. builder: ${{ needs.init.outputs.BUILDER }}
  196. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}