build_slim_packages.yaml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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-50
  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", "24.3.4.2-3", "el7", "erlang"]
  30. - ["emqx", "25.1.2-3", "ubuntu22.04", "elixir"]
  31. - ["emqx-enterprise", "24.3.4.2-3", "amzn2", "erlang"]
  32. - ["emqx-enterprise", "25.1.2-3", "ubuntu20.04", "erlang"]
  33. builder:
  34. - 5.0-33
  35. elixir:
  36. - '1.13.4'
  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.1.2
  89. steps:
  90. - uses: actions/checkout@v3
  91. - uses: ilammy/msvc-dev-cmd@v1.12.0
  92. - uses: erlef/setup-beam@v1.15.2
  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 5
  108. echo "EMQX started"
  109. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  110. echo "EMQX stopped"
  111. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  112. echo "EMQX installed"
  113. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  114. echo "EMQX uninstalled"
  115. - uses: actions/upload-artifact@v3
  116. with:
  117. name: windows
  118. path: _packages/${{ matrix.profile }}/*
  119. mac:
  120. strategy:
  121. fail-fast: false
  122. matrix:
  123. profile:
  124. - emqx
  125. - emqx-enterprise
  126. otp:
  127. - 24.3.4.2-3
  128. os:
  129. - macos-11
  130. - macos-12-arm64
  131. runs-on: ${{ matrix.os }}
  132. steps:
  133. - uses: actions/checkout@v3
  134. - name: prepare
  135. run: |
  136. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  137. - uses: ./.github/actions/package-macos
  138. with:
  139. profile: ${{ matrix.profile }}
  140. otp: ${{ matrix.otp }}
  141. os: ${{ matrix.os }}
  142. apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
  143. apple_developer_identity: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
  144. apple_developer_id_bundle: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE }}
  145. apple_developer_id_bundle_password: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE_PASSWORD }}
  146. - uses: actions/upload-artifact@v3
  147. with:
  148. name: ${{ matrix.os }}
  149. path: _packages/**/*
  150. docker:
  151. runs-on: ubuntu-22.04
  152. strategy:
  153. fail-fast: false
  154. matrix:
  155. profile:
  156. - ["emqx", "5.0.16"]
  157. - ["emqx-enterprise", "5.0.1"]
  158. steps:
  159. - uses: actions/checkout@v3
  160. - name: prepare
  161. run: |
  162. EMQX_NAME=${{ matrix.profile[0] }}
  163. PKG_VSN=${PKG_VSN:-$(./pkg-vsn.sh $EMQX_NAME)}
  164. EMQX_IMAGE_TAG=emqx/$EMQX_NAME:test
  165. EMQX_IMAGE_OLD_VERSION_TAG=emqx/$EMQX_NAME:${{ matrix.profile[1] }}
  166. echo "EMQX_NAME=$EMQX_NAME" >> $GITHUB_ENV
  167. echo "PKG_VSN=$PKG_VSN" >> $GITHUB_ENV
  168. echo "EMQX_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
  169. echo "EMQX_IMAGE_OLD_VERSION_TAG=$EMQX_IMAGE_OLD_VERSION_TAG" >> $GITHUB_ENV
  170. - uses: docker/setup-buildx-action@v2
  171. - name: build and export to Docker
  172. uses: docker/build-push-action@v4
  173. with:
  174. context: .
  175. file: ./deploy/docker/Dockerfile
  176. load: true
  177. tags: ${{ env.EMQX_IMAGE_TAG }}
  178. build-args: |
  179. EMQX_NAME=${{ env.EMQX_NAME }}
  180. - name: test docker image
  181. run: |
  182. CID=$(docker run -d --rm -P $EMQX_IMAGE_TAG)
  183. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' $CID)
  184. export EMQX_SMOKE_TEST_CHECK_HIDDEN_FIELDS='yes'
  185. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  186. docker stop $CID
  187. - name: test two nodes cluster with proto_dist=inet_tls in docker
  188. run: |
  189. ./scripts/test/start-two-nodes-in-docker.sh -P $EMQX_IMAGE_TAG $EMQX_IMAGE_OLD_VERSION_TAG
  190. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' haproxy)
  191. # versions before 5.0.22 have hidden fields included in the API spec
  192. export EMQX_SMOKE_TEST_CHECK_HIDDEN_FIELDS='no'
  193. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  194. # cleanup
  195. ./scripts/test/start-two-nodes-in-docker.sh -c
  196. - name: export docker image
  197. run: |
  198. docker save $EMQX_IMAGE_TAG | gzip > $EMQX_NAME-$PKG_VSN.tar.gz
  199. - uses: actions/upload-artifact@v3
  200. with:
  201. name: "${{ matrix.profile[0] }}-docker"
  202. path: "${{ env.EMQX_NAME }}-${{ env.PKG_VSN }}.tar.gz"
  203. spellcheck:
  204. needs: linux
  205. strategy:
  206. matrix:
  207. profile:
  208. - emqx
  209. - emqx-enterprise
  210. runs-on: aws-amd64
  211. steps:
  212. - uses: actions/download-artifact@v3
  213. name: Download schema dump
  214. with:
  215. name: "${{ matrix.profile }}_schema_dump"
  216. path: /tmp/
  217. - name: Run spellcheck
  218. run: |
  219. bash /tmp/scripts/spellcheck/spellcheck.sh /tmp/_build/docgen/${{ matrix.profile }}/schema-en.json