_push-entrypoint.yaml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. permissions:
  165. actions: write
  166. steps:
  167. - name: Trigger performance test
  168. env:
  169. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  170. run: |
  171. gh --repo ${{ github.repository }} workflow run performance_test.yaml -f version=${GITHUB_REF_NAME##[v|e]}
  172. update_emqx_i18n:
  173. if: needs.prepare.outputs.release == 'true'
  174. needs:
  175. - prepare
  176. - compile
  177. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  178. steps:
  179. - name: Generate GitHub App token
  180. id: app-token
  181. uses: actions/create-github-app-token@v1
  182. with:
  183. app-id: ${{ vars.AUTH_APP_ID }}
  184. private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
  185. owner: ${{ github.repository_owner }}
  186. - name: Create PR in emqx/emqx-i18n
  187. env:
  188. GH_TOKEN: ${{ steps.app-token.outputs.token }}
  189. run: |
  190. 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}
  191. run_emqx_app_tests:
  192. if: needs.prepare.outputs.release != 'true'
  193. needs:
  194. - init
  195. - prepare
  196. - compile
  197. uses: ./.github/workflows/run_emqx_app_tests.yaml
  198. with:
  199. builder: ${{ needs.init.outputs.BUILDER }}
  200. before_ref: ${{ github.event.before }}
  201. after_ref: ${{ github.sha }}
  202. run_test_cases:
  203. if: needs.prepare.outputs.release != 'true'
  204. needs:
  205. - init
  206. - prepare
  207. - compile
  208. permissions:
  209. contents: read
  210. pull-requests: write
  211. uses: ./.github/workflows/run_test_cases.yaml
  212. with:
  213. builder: ${{ needs.init.outputs.BUILDER }}
  214. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}
  215. ct-host: ${{ needs.prepare.outputs.ct-host }}
  216. ct-docker: ${{ needs.prepare.outputs.ct-docker }}
  217. run_conf_tests:
  218. if: needs.prepare.outputs.release != 'true'
  219. needs:
  220. - init
  221. - prepare
  222. - compile
  223. uses: ./.github/workflows/run_conf_tests.yaml
  224. with:
  225. builder: ${{ needs.init.outputs.BUILDER }}
  226. static_checks:
  227. if: needs.prepare.outputs.release != 'true'
  228. needs:
  229. - init
  230. - prepare
  231. - compile
  232. uses: ./.github/workflows/static_checks.yaml
  233. with:
  234. builder: ${{ needs.init.outputs.BUILDER }}
  235. ct-matrix: ${{ needs.prepare.outputs.ct-matrix }}