build_slim_packages.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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-2", "el7"]
  30. - ["emqx", "24.3.4.2-2", "ubuntu20.04"]
  31. - ["emqx", "25.1.2-2", "ubuntu22.04"]
  32. - ["emqx-enterprise", "24.3.4.2-2", "ubuntu20.04"]
  33. - ["emqx-enterprise", "25.1.2-2", "ubuntu22.04"]
  34. builder:
  35. - 5.0-28
  36. elixir:
  37. - 1.13.4
  38. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.profile[1] }}-${{ matrix.profile[2] }}"
  39. steps:
  40. - uses: AutoModality/action-clean@v1
  41. - uses: actions/checkout@v3
  42. with:
  43. fetch-depth: 0
  44. - name: prepare
  45. run: |
  46. echo "EMQX_NAME=${{ matrix.profile[0] }}" >> $GITHUB_ENV
  47. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  48. - name: Work around https://github.com/actions/checkout/issues/766
  49. run: |
  50. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  51. - name: build and test tgz package
  52. run: |
  53. make ${EMQX_NAME}-tgz
  54. ./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
  55. - name: build and test deb/rpm packages
  56. run: |
  57. make ${EMQX_NAME}-pkg
  58. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  59. - name: build and test tgz package (Elixir)
  60. run: |
  61. make ${EMQX_NAME}-elixir-tgz
  62. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-tgz
  63. - name: build and test deb/rpm packages (Elixir)
  64. run: |
  65. make ${EMQX_NAME}-elixir-pkg
  66. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-pkg
  67. - uses: actions/upload-artifact@v3
  68. with:
  69. name: "${{ matrix.profile[0] }}-${{ matrix.profile[1] }}-${{ matrix.profile[2] }}"
  70. path: _packages/${{ matrix.profile[0] }}/*
  71. - uses: actions/upload-artifact@v3
  72. with:
  73. name: "${{ matrix.profile[0] }}_schema_dump"
  74. path: |
  75. scripts/spellcheck
  76. _build/${{ matrix.profile[0] }}/lib/emqx_dashboard/priv/www/static/schema.json
  77. windows:
  78. runs-on: windows-2019
  79. strategy:
  80. fail-fast: false
  81. matrix:
  82. profile:
  83. - emqx
  84. otp:
  85. - 25.1.2
  86. steps:
  87. - uses: actions/checkout@v3
  88. - uses: ilammy/msvc-dev-cmd@v1.12.0
  89. - uses: erlef/setup-beam@v1.15.2
  90. with:
  91. otp-version: ${{ matrix.otp }}
  92. - name: build
  93. env:
  94. PYTHON: python
  95. DIAGNOSTIC: 1
  96. run: |
  97. # ensure crypto app (openssl)
  98. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  99. make ${{ matrix.profile }}-tgz
  100. - name: run emqx
  101. timeout-minutes: 5
  102. run: |
  103. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  104. Start-Sleep -s 5
  105. echo "EMQX started"
  106. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  107. echo "EMQX stopped"
  108. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  109. echo "EMQX installed"
  110. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  111. echo "EMQX uninstalled"
  112. - uses: actions/upload-artifact@v3
  113. with:
  114. name: windows
  115. path: _packages/${{ matrix.profile }}/*
  116. mac:
  117. strategy:
  118. fail-fast: false
  119. matrix:
  120. profile:
  121. - emqx
  122. - emqx-enterprise
  123. otp:
  124. - 24.3.4.2-2
  125. os:
  126. - macos-11
  127. - macos-12-arm64
  128. runs-on: ${{ matrix.os }}
  129. steps:
  130. - uses: actions/checkout@v3
  131. - name: prepare
  132. run: |
  133. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  134. - uses: ./.github/actions/package-macos
  135. with:
  136. profile: ${{ matrix.profile }}
  137. otp: ${{ matrix.otp }}
  138. os: ${{ matrix.os }}
  139. apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
  140. apple_developer_identity: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
  141. apple_developer_id_bundle: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE }}
  142. apple_developer_id_bundle_password: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE_PASSWORD }}
  143. - uses: actions/upload-artifact@v3
  144. with:
  145. name: ${{ matrix.os }}
  146. path: _packages/**/*
  147. docker:
  148. runs-on: ubuntu-22.04
  149. strategy:
  150. fail-fast: false
  151. matrix:
  152. profile:
  153. - emqx
  154. - emqx-enterprise
  155. steps:
  156. - uses: actions/checkout@v3
  157. - name: prepare
  158. run: |
  159. EMQX_NAME=${{ matrix.profile }}
  160. PKG_VSN=${PKG_VSN:-$(./pkg-vsn.sh $EMQX_NAME)}
  161. EMQX_IMAGE_TAG=emqx/$EMQX_NAME:test
  162. echo "EMQX_NAME=$EMQX_NAME" >> $GITHUB_ENV
  163. echo "PKG_VSN=$PKG_VSN" >> $GITHUB_ENV
  164. echo "EMQX_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
  165. - uses: docker/setup-buildx-action@v2
  166. - name: build and export to Docker
  167. uses: docker/build-push-action@v4
  168. with:
  169. context: .
  170. file: ./deploy/docker/Dockerfile
  171. load: true
  172. tags: ${{ env.EMQX_IMAGE_TAG }}
  173. build-args: |
  174. EMQX_NAME=${{ env.EMQX_NAME }}
  175. - name: test docker image
  176. run: |
  177. CID=$(docker run -d --rm -P $EMQX_IMAGE_TAG)
  178. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' $CID)
  179. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  180. docker stop $CID
  181. - name: export docker image
  182. run: |
  183. docker save $EMQX_IMAGE_TAG | gzip > $EMQX_NAME-$PKG_VSN.tar.gz
  184. - uses: actions/upload-artifact@v3
  185. with:
  186. name: "${{ matrix.profile }}-docker"
  187. path: "${{ env.EMQX_NAME }}-${{ env.PKG_VSN }}.tar.gz"
  188. spellcheck:
  189. needs: linux
  190. strategy:
  191. matrix:
  192. profile:
  193. - emqx
  194. - emqx-enterprise
  195. runs-on: aws-amd64
  196. steps:
  197. - uses: actions/download-artifact@v3
  198. name: Download schema dump
  199. with:
  200. name: "${{ matrix.profile }}_schema_dump"
  201. path: /tmp/
  202. - name: Run spellcheck
  203. run: |
  204. bash /tmp/scripts/spellcheck/spellcheck.sh /tmp/_build/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json