build_slim_packages.yaml 6.4 KB

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