build_slim_packages.yaml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. tags:
  10. - v*
  11. - e*
  12. pull_request:
  13. # GitHub pull_request action is by default triggered when
  14. # opened reopened or synchronize,
  15. # we add labeled and unlabeled to the list because
  16. # the mac job dpends on the PR having a 'Mac' label
  17. types:
  18. - labeled
  19. - unlabeled
  20. - opened
  21. - reopened
  22. - synchronize
  23. workflow_dispatch:
  24. jobs:
  25. linux:
  26. runs-on: ubuntu-20.04
  27. strategy:
  28. fail-fast: false
  29. matrix:
  30. profile:
  31. - emqx-edge
  32. - emqx
  33. - emqx-enterprise
  34. otp:
  35. - 24.1.5-4
  36. elixir:
  37. - 1.13.2
  38. os:
  39. - ubuntu20.04
  40. - centos7
  41. container: "ghcr.io/emqx/emqx-builder/5.0-5:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  42. steps:
  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. echo "EMQX_PKG_NAME=${{ matrix.profile }}-$(./pkg-vsn.sh ${{ matrix.profile }})-otp${{ matrix.otp }}-${{ matrix.os }}-amd64" >> $GITHUB_ENV
  49. echo "EMQX_ELIXIRPKG_NAME=${{ matrix.profile }}-$(./pkg-vsn.sh ${{ matrix.profile }})-elixir${{ matrix.elixir }}-otp${{ matrix.otp }}-${{ matrix.os }}-amd64" >> $GITHUB_ENV
  50. - name: Get deps git refs for cache
  51. id: deps-refs
  52. run: |
  53. scripts/get-dep-refs.sh
  54. make clean-all
  55. - name: load rocksdb cache
  56. uses: actions/cache@v2
  57. with:
  58. path: |
  59. _build/default/lib/rocksdb/
  60. deps/rocksdb/
  61. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  62. - name: load quicer cache
  63. uses: actions/cache@v2
  64. with:
  65. path: |
  66. _build/default/lib/quicer/
  67. deps/quicer/
  68. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  69. - name: build and test tgz package
  70. run: |
  71. make ${EMQX_NAME}-tgz
  72. .ci/build_packages/tests.sh "$EMQX_PKG_NAME" tgz amd64
  73. - name: run static checks
  74. if: contains(matrix.os, 'ubuntu')
  75. run: |
  76. make static_checks
  77. - name: build and test deb/rpm packages
  78. run: |
  79. make ${EMQX_NAME}-pkg
  80. .ci/build_packages/tests.sh "$EMQX_PKG_NAME" pkg amd64
  81. - name: build and test tgz package (Elixir)
  82. run: |
  83. make ${EMQX_NAME}-elixir-tgz
  84. .ci/build_packages/tests.sh "$EMQX_ELIXIRPKG_NAME" tgz amd64
  85. - name: build and test deb/rpm packages (Elixir)
  86. run: |
  87. make ${EMQX_NAME}-elixirpkg
  88. .ci/build_packages/tests.sh "$EMQX_ELIXIRPKG_NAME" pkg amd64
  89. - uses: actions/upload-artifact@v2
  90. with:
  91. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  92. path: _packages/${{ matrix.profile}}/*.tar.gz
  93. mac:
  94. strategy:
  95. fail-fast: false
  96. matrix:
  97. profile:
  98. - emqx
  99. - emqx-enterprise
  100. otp:
  101. - 24.1.5-4
  102. macos:
  103. - macos-11
  104. - macos-10.15
  105. runs-on: ${{ matrix.macos }}
  106. steps:
  107. - uses: actions/checkout@v2
  108. - name: prepare
  109. run: |
  110. brew update
  111. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  112. echo "/usr/local/bin" >> $GITHUB_PATH
  113. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  114. - uses: actions/cache@v2
  115. id: cache
  116. with:
  117. path: ~/.kerl/${{ matrix.otp }}
  118. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  119. - name: build erlang
  120. if: steps.cache.outputs.cache-hit != 'true'
  121. timeout-minutes: 60
  122. env:
  123. KERL_BUILD_BACKEND: git
  124. OTP_GITHUB_URL: https://github.com/emqx/otp
  125. run: |
  126. kerl update releases
  127. kerl build ${{ matrix.otp }}
  128. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  129. - name: Get deps git refs for cache
  130. id: deps-refs
  131. run: |
  132. . $HOME/.kerl/${{ matrix.otp }}/activate
  133. make ensure-rebar3
  134. sudo cp rebar3 /usr/local/bin/rebar3
  135. scripts/get-dep-refs.sh
  136. make clean-all
  137. - name: load rocksdb cache
  138. uses: actions/cache@v2
  139. with:
  140. path: _build/default/lib/rocksdb/
  141. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  142. - name: load quicer cache
  143. uses: actions/cache@v2
  144. with:
  145. path: _build/default/lib/quicer/
  146. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  147. - name: build ${{ matrix.profile }}
  148. run: |
  149. . $HOME/.kerl/${{ matrix.otp }}/activate
  150. make ensure-rebar3
  151. sudo cp rebar3 /usr/local/bin/rebar3
  152. make ${{ matrix.profile }}-tgz
  153. - name: test
  154. run: |
  155. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  156. tar -zxf $pkg_name
  157. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  158. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  159. ready='no'
  160. for i in {1..10}; do
  161. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  162. ready='yes'
  163. break
  164. fi
  165. sleep 1
  166. done
  167. if [ "$ready" != "yes" ]; then
  168. echo "Timed out waiting for emqx to be ready"
  169. cat emqx/log/erlang.log.1
  170. exit 1
  171. fi
  172. ./emqx/bin/emqx_ctl status
  173. ./emqx/bin/emqx stop
  174. rm -rf emqx
  175. - uses: actions/upload-artifact@v2
  176. with:
  177. name: macos
  178. path: _packages/**/*.tar.gz