_push-entrypoint.yaml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. performance_test:
  99. if: needs.prepare.outputs.release == 'true'
  100. needs:
  101. - init
  102. - prepare
  103. - build_packages
  104. uses: ./.github/workflows/performance_test.yaml
  105. secrets: inherit
  106. build_and_push_docker_images:
  107. if: needs.prepare.outputs.release == 'true'
  108. needs:
  109. - init
  110. - prepare
  111. uses: ./.github/workflows/build_and_push_docker_images.yaml
  112. with:
  113. profile: ${{ needs.prepare.outputs.profile }}
  114. publish: true
  115. latest: ${{ needs.prepare.outputs.latest }}
  116. secrets: inherit
  117. build_slim_packages:
  118. if: needs.prepare.outputs.release != 'true'
  119. needs:
  120. - init
  121. - prepare
  122. uses: ./.github/workflows/build_slim_packages.yaml
  123. compile:
  124. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  125. container: ${{ needs.init.outputs.BUILDER }}
  126. needs:
  127. - init
  128. - prepare
  129. strategy:
  130. matrix:
  131. profile:
  132. - emqx
  133. - emqx-enterprise
  134. steps:
  135. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  136. with:
  137. ref: ${{ github.event.inputs.ref }}
  138. fetch-depth: 0
  139. - name: Work around https://github.com/actions/checkout/issues/766
  140. run: |
  141. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  142. - id: compile
  143. env:
  144. PROFILE: ${{ matrix.profile }}
  145. ENABLE_COVER_COMPILE: 1
  146. run: |
  147. make $PROFILE
  148. echo "export PROFILE=${PROFILE}" | tee -a env.sh
  149. echo "export PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a env.sh
  150. zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
  151. make ${PROFILE}-rel
  152. - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
  153. with:
  154. name: ${{ matrix.profile }}
  155. path: ${{ matrix.profile }}.zip
  156. retention-days: 7
  157. - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
  158. with:
  159. name: "${{ matrix.profile }}-schema-dump"
  160. path: |
  161. env.sh
  162. _build/docgen/${{ matrix.profile }}/*.json
  163. _build/docgen/${{ matrix.profile }}/*.hocon
  164. retention-days: 7
  165. update_emqx_i18n:
  166. if: needs.prepare.outputs.release == 'true'
  167. needs:
  168. - prepare
  169. - compile
  170. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  171. steps:
  172. - name: Create PR in emqx/emqx-i18n
  173. env:
  174. GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN_DOCS_I18N_RW }}
  175. run: |
  176. 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}
  177. update_emqx_docs:
  178. if: needs.prepare.outputs.release == 'true'
  179. needs:
  180. - prepare
  181. - compile
  182. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  183. steps:
  184. - name: Create PR in emqx/emqx-docs
  185. env:
  186. GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN_DOCS_I18N_RW }}
  187. run: |
  188. 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}
  189. run_emqx_app_tests:
  190. if: needs.prepare.outputs.release != 'true'
  191. needs:
  192. - init
  193. - prepare
  194. - compile
  195. uses: ./.github/workflows/run_emqx_app_tests.yaml
  196. with:
  197. builder: ${{ needs.init.outputs.BUILDER }}
  198. before_ref: ${{ github.event.before }}
  199. after_ref: ${{ github.sha }}
  200. run_test_cases:
  201. if: needs.prepare.outputs.release != 'true'
  202. needs:
  203. - init
  204. - prepare
  205. - compile
  206. permissions:
  207. contents: read
  208. pull-requests: write
  209. uses: ./.github/workflows/run_test_cases.yaml
  210. with:
  211. builder: ${{ needs.init.outputs.BUILDER }}
  212. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}
  213. ct-host: ${{ needs.prepare.outputs.ct-host }}
  214. ct-docker: ${{ needs.prepare.outputs.ct-docker }}
  215. run_conf_tests:
  216. if: needs.prepare.outputs.release != 'true'
  217. needs:
  218. - init
  219. - prepare
  220. - compile
  221. uses: ./.github/workflows/run_conf_tests.yaml
  222. with:
  223. builder: ${{ needs.init.outputs.BUILDER }}
  224. static_checks:
  225. if: needs.prepare.outputs.release != 'true'
  226. needs:
  227. - init
  228. - prepare
  229. - compile
  230. uses: ./.github/workflows/static_checks.yaml
  231. with:
  232. builder: ${{ needs.init.outputs.BUILDER }}
  233. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}