build_slim_packages.yaml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. name: Build slim packages
  2. concurrency:
  3. group: slim-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. branches:
  8. - master
  9. - release-51
  10. pull_request:
  11. # GitHub pull_request action is by default triggered when
  12. # opened reopened or synchronize,
  13. # we add labeled and unlabeled to the list because
  14. # the mac job dpends on the PR having a 'Mac' label
  15. types:
  16. - labeled
  17. - unlabeled
  18. - opened
  19. - reopened
  20. - synchronize
  21. workflow_dispatch:
  22. jobs:
  23. linux:
  24. runs-on: aws-amd64
  25. strategy:
  26. fail-fast: false
  27. matrix:
  28. profile:
  29. - ["emqx", "25.3.2-1", "el7", "erlang"]
  30. - ["emqx", "25.3.2-1", "ubuntu22.04", "elixir"]
  31. - ["emqx-enterprise", "25.3.2-1", "amzn2023", "erlang"]
  32. - ["emqx-enterprise", "25.3.2-1", "ubuntu20.04", "erlang"]
  33. builder:
  34. - 5.1-3
  35. elixir:
  36. - '1.14.5'
  37. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.profile[1] }}-${{ matrix.profile[2] }}"
  38. steps:
  39. - uses: AutoModality/action-clean@v1
  40. - uses: actions/checkout@v3
  41. with:
  42. fetch-depth: 0
  43. - name: prepare
  44. run: |
  45. echo "EMQX_NAME=${{ matrix.profile[0] }}" >> $GITHUB_ENV
  46. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  47. - name: Work around https://github.com/actions/checkout/issues/766
  48. run: |
  49. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  50. - name: build and test tgz package
  51. if: matrix.profile[3] == 'erlang'
  52. run: |
  53. make ${EMQX_NAME}-tgz
  54. ./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
  55. - name: build and test deb/rpm packages
  56. if: matrix.profile[3] == 'erlang'
  57. run: |
  58. make ${EMQX_NAME}-pkg
  59. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  60. - name: build and test tgz package (Elixir)
  61. if: matrix.profile[3] == 'elixir'
  62. run: |
  63. make ${EMQX_NAME}-elixir-tgz
  64. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-tgz
  65. - name: build and test deb/rpm packages (Elixir)
  66. if: matrix.profile[3] == 'elixir'
  67. run: |
  68. make ${EMQX_NAME}-elixir-pkg
  69. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-pkg
  70. - uses: actions/upload-artifact@v3
  71. with:
  72. name: "${{ matrix.profile[0] }}-${{ matrix.profile[1] }}-${{ matrix.profile[2] }}"
  73. path: _packages/${{ matrix.profile[0] }}/*
  74. - uses: actions/upload-artifact@v3
  75. with:
  76. name: "${{ matrix.profile[0] }}_schema_dump"
  77. path: |
  78. scripts/spellcheck
  79. _build/docgen/${{ matrix.profile[0] }}/schema-en.json
  80. windows:
  81. runs-on: windows-2019
  82. strategy:
  83. fail-fast: false
  84. matrix:
  85. profile:
  86. - emqx
  87. otp:
  88. - 25.3.2
  89. steps:
  90. - uses: actions/checkout@v3
  91. - uses: ilammy/msvc-dev-cmd@v1.12.0
  92. - uses: erlef/setup-beam@v1.15.4
  93. with:
  94. otp-version: ${{ matrix.otp }}
  95. - name: build
  96. env:
  97. PYTHON: python
  98. DIAGNOSTIC: 1
  99. run: |
  100. # ensure crypto app (openssl)
  101. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  102. make ${{ matrix.profile }}-tgz
  103. - name: run emqx
  104. timeout-minutes: 5
  105. run: |
  106. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  107. Start-Sleep -s 10
  108. $pingOutput = ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx ping
  109. if ($pingOutput = 'pong') {
  110. echo "EMQX started OK"
  111. } else {
  112. echo "Failed to ping EMQX $pingOutput"
  113. Exit 1
  114. }
  115. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  116. echo "EMQX stopped"
  117. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  118. echo "EMQX installed"
  119. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  120. echo "EMQX uninstalled"
  121. - uses: actions/upload-artifact@v3
  122. with:
  123. name: windows
  124. path: _packages/${{ matrix.profile }}/*
  125. mac:
  126. strategy:
  127. fail-fast: false
  128. matrix:
  129. profile:
  130. - emqx
  131. - emqx-enterprise
  132. otp:
  133. - 25.3.2-1
  134. os:
  135. - macos-11
  136. - macos-12-arm64
  137. runs-on: ${{ matrix.os }}
  138. steps:
  139. - uses: actions/checkout@v3
  140. - name: prepare
  141. run: |
  142. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  143. - uses: ./.github/actions/package-macos
  144. with:
  145. profile: ${{ matrix.profile }}
  146. otp: ${{ matrix.otp }}
  147. os: ${{ matrix.os }}
  148. apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
  149. apple_developer_identity: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
  150. apple_developer_id_bundle: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE }}
  151. apple_developer_id_bundle_password: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE_PASSWORD }}
  152. - uses: actions/upload-artifact@v3
  153. with:
  154. name: ${{ matrix.os }}
  155. path: _packages/**/*
  156. docker:
  157. runs-on: aws-amd64
  158. strategy:
  159. fail-fast: false
  160. matrix:
  161. profile:
  162. - ["emqx", "5.0.16"]
  163. - ["emqx-enterprise", "5.0.1"]
  164. steps:
  165. - uses: actions/checkout@v3
  166. - name: prepare
  167. run: |
  168. EMQX_NAME=${{ matrix.profile[0] }}
  169. PKG_VSN=${PKG_VSN:-$(./pkg-vsn.sh $EMQX_NAME)}
  170. EMQX_IMAGE_TAG=emqx/$EMQX_NAME:test
  171. EMQX_IMAGE_OLD_VERSION_TAG=emqx/$EMQX_NAME:${{ matrix.profile[1] }}
  172. echo "EMQX_NAME=$EMQX_NAME" >> $GITHUB_ENV
  173. echo "PKG_VSN=$PKG_VSN" >> $GITHUB_ENV
  174. echo "EMQX_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
  175. echo "EMQX_IMAGE_OLD_VERSION_TAG=$EMQX_IMAGE_OLD_VERSION_TAG" >> $GITHUB_ENV
  176. - uses: docker/setup-buildx-action@v2
  177. - name: build and export to Docker
  178. uses: docker/build-push-action@v4
  179. with:
  180. context: .
  181. file: ./deploy/docker/Dockerfile
  182. load: true
  183. tags: ${{ env.EMQX_IMAGE_TAG }}
  184. build-args: |
  185. EMQX_NAME=${{ env.EMQX_NAME }}
  186. - name: smoke test
  187. run: |
  188. CID=$(docker run -d --rm -P $EMQX_IMAGE_TAG)
  189. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' $CID)
  190. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  191. docker stop $CID
  192. - name: dashboard tests
  193. working-directory: ./scripts/ui-tests
  194. run: |
  195. set -eu
  196. docker compose up --abort-on-container-exit --exit-code-from selenium
  197. - name: test two nodes cluster with proto_dist=inet_tls in docker
  198. run: |
  199. ./scripts/test/start-two-nodes-in-docker.sh -P $EMQX_IMAGE_TAG $EMQX_IMAGE_OLD_VERSION_TAG
  200. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' haproxy)
  201. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  202. # cleanup
  203. ./scripts/test/start-two-nodes-in-docker.sh -c
  204. - name: export docker image
  205. run: |
  206. docker save $EMQX_IMAGE_TAG | gzip > $EMQX_NAME-$PKG_VSN.tar.gz
  207. - uses: actions/upload-artifact@v3
  208. with:
  209. name: "${{ matrix.profile[0] }}-docker"
  210. path: "${{ env.EMQX_NAME }}-${{ env.PKG_VSN }}.tar.gz"
  211. - name: cleanup
  212. if: always()
  213. working-directory: ./scripts/ui-tests
  214. run: |
  215. docker compose rm -fs
  216. spellcheck:
  217. needs: linux
  218. strategy:
  219. matrix:
  220. profile:
  221. - emqx
  222. - emqx-enterprise
  223. runs-on: aws-amd64
  224. steps:
  225. - uses: actions/download-artifact@v3
  226. name: Download schema dump
  227. with:
  228. name: "${{ matrix.profile }}_schema_dump"
  229. path: /tmp/
  230. - name: Run spellcheck
  231. run: |
  232. bash /tmp/scripts/spellcheck/spellcheck.sh /tmp/_build/docgen/${{ matrix.profile }}/schema-en.json