_push-entrypoint.yaml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. permissions:
  18. contents: read
  19. defaults:
  20. run:
  21. shell: bash
  22. env:
  23. IS_CI: 'yes'
  24. jobs:
  25. init:
  26. runs-on: ubuntu-22.04
  27. outputs:
  28. BUILDER_VSN: ${{ steps.env.outputs.BUILDER_VSN }}
  29. OTP_VSN: ${{ steps.env.outputs.OTP_VSN }}
  30. ELIXIR_VSN: ${{ steps.env.outputs.ELIXIR_VSN }}
  31. BUILDER: ${{ steps.env.outputs.BUILDER }}
  32. steps:
  33. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  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. prepare:
  45. runs-on: ubuntu-22.04
  46. needs: init
  47. container: ${{ needs.init.outputs.BUILDER }}
  48. outputs:
  49. profile: ${{ steps.parse-git-ref.outputs.profile }}
  50. release: ${{ steps.parse-git-ref.outputs.release }}
  51. latest: ${{ steps.parse-git-ref.outputs.latest }}
  52. ct-matrix: ${{ steps.matrix.outputs.ct-matrix }}
  53. ct-host: ${{ steps.matrix.outputs.ct-host }}
  54. ct-docker: ${{ steps.matrix.outputs.ct-docker }}
  55. steps:
  56. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  57. with:
  58. ref: ${{ github.event.inputs.ref }}
  59. fetch-depth: 0
  60. - name: Work around https://github.com/actions/checkout/issues/766
  61. shell: bash
  62. run: |
  63. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  64. - name: Detect emqx profile
  65. id: parse-git-ref
  66. run: |
  67. JSON="$(./scripts/parse-git-ref.sh $GITHUB_REF)"
  68. PROFILE=$(echo "$JSON" | jq -cr '.profile')
  69. RELEASE=$(echo "$JSON" | jq -cr '.release')
  70. LATEST=$(echo "$JSON" | jq -cr '.latest')
  71. echo "profile=$PROFILE" | tee -a $GITHUB_OUTPUT
  72. echo "release=$RELEASE" | tee -a $GITHUB_OUTPUT
  73. echo "latest=$LATEST" | tee -a $GITHUB_OUTPUT
  74. - name: Build matrix
  75. id: matrix
  76. run: |
  77. MATRIX="$(./scripts/find-apps.sh --ci)"
  78. echo "${MATRIX}" | jq
  79. CT_MATRIX="$(echo "${MATRIX}" | jq -c 'map({profile}) | unique')"
  80. CT_HOST="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "host"))')"
  81. CT_DOCKER="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "docker"))')"
  82. echo "ct-matrix=${CT_MATRIX}" | tee -a $GITHUB_OUTPUT
  83. echo "ct-host=${CT_HOST}" | tee -a $GITHUB_OUTPUT
  84. echo "ct-docker=${CT_DOCKER}" | tee -a $GITHUB_OUTPUT
  85. build_packages:
  86. if: needs.prepare.outputs.release == 'true'
  87. needs:
  88. - init
  89. - prepare
  90. uses: ./.github/workflows/build_packages.yaml
  91. with:
  92. profile: ${{ needs.prepare.outputs.profile }}
  93. publish: true
  94. otp_vsn: ${{ needs.init.outputs.OTP_VSN }}
  95. elixir_vsn: ${{ needs.init.outputs.ELIXIR_VSN }}
  96. builder_vsn: ${{ needs.init.outputs.BUILDER_VSN }}
  97. secrets: inherit
  98. build_and_push_docker_images:
  99. if: needs.prepare.outputs.release == 'true'
  100. needs:
  101. - init
  102. - prepare
  103. uses: ./.github/workflows/build_and_push_docker_images.yaml
  104. with:
  105. profile: ${{ needs.prepare.outputs.profile }}
  106. publish: true
  107. latest: ${{ needs.prepare.outputs.latest }}
  108. secrets: inherit
  109. build_slim_packages:
  110. if: needs.prepare.outputs.release != 'true'
  111. needs:
  112. - init
  113. - prepare
  114. uses: ./.github/workflows/build_slim_packages.yaml
  115. compile:
  116. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  117. container: ${{ needs.init.outputs.BUILDER }}
  118. needs:
  119. - init
  120. - prepare
  121. strategy:
  122. matrix:
  123. profile:
  124. - emqx
  125. - emqx-enterprise
  126. steps:
  127. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  128. with:
  129. ref: ${{ github.event.inputs.ref }}
  130. fetch-depth: 0
  131. - name: Work around https://github.com/actions/checkout/issues/766
  132. run: |
  133. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  134. - id: compile
  135. env:
  136. PROFILE: ${{ matrix.profile }}
  137. ENABLE_COVER_COMPILE: 1
  138. run: |
  139. make $PROFILE
  140. echo "export PROFILE=${PROFILE}" | tee -a env.sh
  141. echo "export PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a env.sh
  142. zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
  143. make ${PROFILE}-rel
  144. - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
  145. with:
  146. name: ${{ matrix.profile }}
  147. path: ${{ matrix.profile }}.zip
  148. retention-days: 7
  149. - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
  150. with:
  151. name: "${{ matrix.profile }}-schema-dump"
  152. path: |
  153. env.sh
  154. _build/docgen/${{ matrix.profile }}/*.json
  155. _build/docgen/${{ matrix.profile }}/*.hocon
  156. retention-days: 7
  157. performance_test:
  158. if: needs.prepare.outputs.release == 'true'
  159. needs:
  160. - init
  161. - prepare
  162. - build_packages
  163. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  164. steps:
  165. - name: Trigger performance test
  166. env:
  167. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  168. run: |
  169. gh --repo ${{ github.repository }} workflow run performance_test.yaml -f version=${GITHUB_REF_NAME##[v|e]}
  170. update_emqx_i18n:
  171. if: needs.prepare.outputs.release == 'true'
  172. needs:
  173. - prepare
  174. - compile
  175. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  176. steps:
  177. - name: Create PR in emqx/emqx-i18n
  178. env:
  179. GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN_DOCS_I18N_RW }}
  180. run: |
  181. gh --repo emqx/emqx-i18n workflow run sync-en-doc.yaml -f version=${GITHUB_REF_NAME##[v|e]} -f repository=${GITHUB_REPOSITORY} -f run_id=${GITHUB_RUN_ID}
  182. update_emqx_docs:
  183. if: needs.prepare.outputs.release == 'true'
  184. needs:
  185. - prepare
  186. - compile
  187. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  188. steps:
  189. - name: Create PR in emqx/emqx-docs
  190. env:
  191. GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN_DOCS_I18N_RW }}
  192. run: |
  193. gh --repo emqx/emqx-docs workflow run update-api-and-cfg-manual.yaml -f version=${GITHUB_REF_NAME##[v|e]} -f repository=${GITHUB_REPOSITORY} -f run_id=${GITHUB_RUN_ID}
  194. run_emqx_app_tests:
  195. if: needs.prepare.outputs.release != 'true'
  196. needs:
  197. - init
  198. - prepare
  199. - compile
  200. uses: ./.github/workflows/run_emqx_app_tests.yaml
  201. with:
  202. builder: ${{ needs.init.outputs.BUILDER }}
  203. before_ref: ${{ github.event.before }}
  204. after_ref: ${{ github.sha }}
  205. run_test_cases:
  206. if: needs.prepare.outputs.release != 'true'
  207. needs:
  208. - init
  209. - prepare
  210. - compile
  211. permissions:
  212. contents: read
  213. pull-requests: write
  214. uses: ./.github/workflows/run_test_cases.yaml
  215. with:
  216. builder: ${{ needs.init.outputs.BUILDER }}
  217. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}
  218. ct-host: ${{ needs.prepare.outputs.ct-host }}
  219. ct-docker: ${{ needs.prepare.outputs.ct-docker }}
  220. run_conf_tests:
  221. if: needs.prepare.outputs.release != 'true'
  222. needs:
  223. - init
  224. - prepare
  225. - compile
  226. uses: ./.github/workflows/run_conf_tests.yaml
  227. with:
  228. builder: ${{ needs.init.outputs.BUILDER }}
  229. static_checks:
  230. if: needs.prepare.outputs.release != 'true'
  231. needs:
  232. - init
  233. - prepare
  234. - compile
  235. uses: ./.github/workflows/static_checks.yaml
  236. with:
  237. builder: ${{ needs.init.outputs.BUILDER }}
  238. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}