build_slim_packages.yaml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. pull_request:
  10. # GitHub pull_request action is by default triggered when
  11. # opened reopened or synchronize,
  12. # we add labeled and unlabeled to the list because
  13. # the mac job dpends on the PR having a 'Mac' label
  14. types:
  15. - labeled
  16. - unlabeled
  17. - opened
  18. - reopened
  19. - synchronize
  20. workflow_dispatch:
  21. jobs:
  22. linux:
  23. runs-on: aws-amd64
  24. strategy:
  25. fail-fast: false
  26. matrix:
  27. profile:
  28. - emqx-edge
  29. - emqx
  30. - emqx-enterprise
  31. otp:
  32. - 24.2.1-1
  33. elixir:
  34. - 1.13.3
  35. os:
  36. - ubuntu20.04
  37. - rockylinux8
  38. container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  39. steps:
  40. - name: cleanup
  41. run: |
  42. rm -rf "${GITHUB_WORKSPACE}/"
  43. - uses: actions/checkout@v1
  44. - name: prepare
  45. run: |
  46. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  47. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  48. - name: Get deps git refs for cache
  49. id: deps-refs
  50. run: |
  51. scripts/get-dep-refs.sh
  52. make clean-all
  53. - name: load quicer cache
  54. uses: actions/cache@v2
  55. with:
  56. path: |
  57. _build/default/lib/quicer/
  58. deps/quicer/
  59. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  60. - name: build and test tgz package
  61. run: |
  62. make ${EMQX_NAME}-tgz
  63. ./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
  64. - name: run static checks
  65. if: contains(matrix.os, 'ubuntu')
  66. run: |
  67. make static_checks
  68. - name: build and test deb/rpm packages
  69. run: |
  70. make ${EMQX_NAME}-pkg
  71. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  72. - name: build and test tgz package (Elixir)
  73. run: |
  74. make ${EMQX_NAME}-elixir-tgz
  75. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-tgz
  76. - name: build and test deb/rpm packages (Elixir)
  77. run: |
  78. make ${EMQX_NAME}-elixir-pkg
  79. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-pkg
  80. - uses: actions/upload-artifact@v2
  81. with:
  82. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  83. path: _packages/${{ matrix.profile}}/*.tar.gz
  84. - uses: actions/upload-artifact@v2
  85. with:
  86. name: "${{ matrix.profile }}_schema_dump"
  87. path: _build/*/lib/emqx_dashboard/priv/www/static/schema.json
  88. windows:
  89. runs-on: windows-2019
  90. strategy:
  91. fail-fast: false
  92. matrix:
  93. profile:
  94. - emqx
  95. otp:
  96. - 24.2.1
  97. steps:
  98. - uses: actions/checkout@v2
  99. - uses: ilammy/msvc-dev-cmd@v1
  100. - uses: erlef/setup-beam@v1
  101. with:
  102. otp-version: ${{ matrix.otp }}
  103. - name: build
  104. env:
  105. PYTHON: python
  106. DIAGNOSTIC: 1
  107. run: |
  108. # ensure crypto app (openssl)
  109. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  110. make ${{ matrix.profile }}-tgz
  111. - name: run emqx
  112. timeout-minutes: 5
  113. run: |
  114. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  115. Start-Sleep -s 5
  116. echo "EMQX started"
  117. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  118. echo "EMQX stopped"
  119. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  120. echo "EMQX installed"
  121. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  122. echo "EMQX uninstalled"
  123. mac:
  124. strategy:
  125. fail-fast: false
  126. matrix:
  127. profile:
  128. - emqx
  129. - emqx-enterprise
  130. otp:
  131. - 24.2.1-1
  132. macos:
  133. - macos-11
  134. - macos-10.15
  135. runs-on: ${{ matrix.macos }}
  136. steps:
  137. - uses: actions/checkout@v2
  138. - name: prepare
  139. run: |
  140. brew update
  141. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  142. echo "/usr/local/bin" >> $GITHUB_PATH
  143. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  144. - uses: actions/cache@v2
  145. id: cache
  146. with:
  147. path: ~/.kerl/${{ matrix.otp }}
  148. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  149. - name: build erlang
  150. if: steps.cache.outputs.cache-hit != 'true'
  151. timeout-minutes: 60
  152. env:
  153. KERL_BUILD_BACKEND: git
  154. OTP_GITHUB_URL: https://github.com/emqx/otp
  155. run: |
  156. kerl update releases
  157. kerl build ${{ matrix.otp }}
  158. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  159. - name: Get deps git refs for cache
  160. id: deps-refs
  161. run: |
  162. . $HOME/.kerl/${{ matrix.otp }}/activate
  163. make ensure-rebar3
  164. sudo cp rebar3 /usr/local/bin/rebar3
  165. scripts/get-dep-refs.sh
  166. make clean-all
  167. - name: load quicer cache
  168. uses: actions/cache@v2
  169. with:
  170. path: _build/default/lib/quicer/
  171. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  172. - name: build ${{ matrix.profile }}
  173. run: |
  174. . $HOME/.kerl/${{ matrix.otp }}/activate
  175. make ensure-rebar3
  176. sudo cp rebar3 /usr/local/bin/rebar3
  177. make ${{ matrix.profile }}-tgz
  178. - name: test
  179. run: |
  180. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  181. tar -zxf $pkg_name
  182. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  183. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  184. ready='no'
  185. for i in {1..30}; do
  186. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  187. ready='yes'
  188. break
  189. fi
  190. sleep 1
  191. done
  192. if [ "$ready" != "yes" ]; then
  193. echo "Timed out waiting for emqx to be ready"
  194. cat emqx/log/erlang.log.1
  195. exit 1
  196. fi
  197. ./emqx/bin/emqx_ctl status
  198. ./emqx/bin/emqx stop
  199. rm -rf emqx
  200. - uses: actions/upload-artifact@v2
  201. with:
  202. name: macos
  203. path: _packages/**/*.tar.gz
  204. spellcheck:
  205. needs: linux
  206. strategy:
  207. matrix:
  208. profile:
  209. - emqx-edge
  210. - emqx
  211. - emqx-enterprise
  212. runs-on: aws-amd64
  213. container: "ghcr.io/iequ1/emqx-schema-validate:0.3.1"
  214. steps:
  215. - uses: actions/download-artifact@v2
  216. name: Download schema dump
  217. with:
  218. name: "${{ matrix.profile }}_schema_dump"
  219. path: /tmp/
  220. - name: Run spellcheck
  221. run: |
  222. cd /LanguageTool
  223. bash start.sh > /dev/null &
  224. ./emqx_schema_validate /tmp/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json
  225. allgood_packaging:
  226. runs-on: ubuntu-latest
  227. needs:
  228. - linux
  229. - windows
  230. - mac
  231. steps:
  232. - name: Check if all packging builds succeeded
  233. uses: re-actors/alls-green@release/v1
  234. with:
  235. #allowed-failures:
  236. #allowed-skips:
  237. jobs: ${{ toJSON(needs) }}