run_cts_tests.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. name: Compatibility Test Suite
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. release:
  7. types:
  8. - published
  9. pull_request:
  10. workflow_dispatch:
  11. repository_dispatch:
  12. types: [run_actions]
  13. jobs:
  14. ldap:
  15. runs-on: ubuntu-20.04
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. ldap_tag:
  20. - 2.4.50
  21. network_type:
  22. - ipv4
  23. - ipv6
  24. steps:
  25. - uses: actions/checkout@v1
  26. - name: setup
  27. env:
  28. LDAP_TAG: ${{ matrix.ldap_tag }}
  29. run: |
  30. docker-compose -f .ci/apps_tests/docker-compose.yaml build --no-cache
  31. docker-compose -f .ci/compatibility_tests/docker-compose-ldap.yaml up -d
  32. - name: setup
  33. if: matrix.network_type == 'ipv4'
  34. run: |
  35. echo EMQX_AUTH__LDAP__SERVERS=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ldap) >> "$GITHUB_ENV"
  36. - name: setup
  37. if: matrix.network_type == 'ipv6'
  38. run: |
  39. echo EMQX_AUTH__LDAP__SERVERS=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' ldap) >> "$GITHUB_ENV"
  40. - name: run test cases
  41. run: |
  42. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  43. printenv > .env
  44. docker exec -i erlang sh -c "make ensure-rebar3"
  45. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_ldap"
  46. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_ldap"
  47. - uses: actions/upload-artifact@v1
  48. if: failure()
  49. with:
  50. name: logs_ldap${{ matrix.ldap_tag }}_${{ matrix.network_type }}
  51. path: _build/test/logs
  52. mongo:
  53. runs-on: ubuntu-20.04
  54. strategy:
  55. fail-fast: false
  56. matrix:
  57. mongo_tag:
  58. - 3
  59. - 4
  60. network_type:
  61. - ipv4
  62. - ipv6
  63. connect_type:
  64. - tls
  65. - tcp
  66. steps:
  67. - uses: actions/checkout@v1
  68. - name: setup
  69. env:
  70. MONGO_TAG: ${{ matrix.mongo_tag }}
  71. if: matrix.connect_type == 'tls'
  72. run: |
  73. docker-compose -f .ci/compatibility_tests/docker-compose-mongo-tls.yaml up -d
  74. cat <<-EOF >> "$GITHUB_ENV"
  75. EMQX_AUTH__MONGO__SSL=on
  76. EMQX_AUTH__MONGO__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem
  77. EMQX_AUTH__MONGO__CERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem
  78. EMQX_AUTH__MONGO__KEYFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem
  79. EOF
  80. - name: setup
  81. env:
  82. MONGO_TAG: ${{ matrix.mongo_tag }}
  83. if: matrix.connect_type == 'tcp'
  84. run: |
  85. docker-compose -f .ci/compatibility_tests/docker-compose-mongo.yaml up -d
  86. echo EMQX_AUTH__MONGO__SSL=off >> "$GITHUB_ENV"
  87. - name: setup
  88. if: matrix.network_type == 'ipv4'
  89. run: |
  90. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  91. - name: setup
  92. if: matrix.network_type == 'ipv6'
  93. run: |
  94. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  95. - name: run test cases
  96. run: |
  97. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  98. printenv > .env
  99. docker exec -i erlang sh -c "make ensure-rebar3"
  100. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mongo"
  101. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mongo"
  102. - uses: actions/upload-artifact@v1
  103. if: failure()
  104. with:
  105. name: logs_mongo${{ matrix.mongo_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  106. path: _build/test/logs
  107. mysql:
  108. runs-on: ubuntu-20.04
  109. strategy:
  110. fail-fast: false
  111. matrix:
  112. mysql_tag:
  113. - 5.7
  114. - 8
  115. network_type:
  116. - ipv4
  117. - ipv6
  118. connect_type:
  119. - tls
  120. - tcp
  121. steps:
  122. - uses: actions/checkout@v1
  123. - name: setup
  124. env:
  125. MYSQL_TAG: ${{ matrix.mysql_tag }}
  126. if: matrix.connect_type == 'tls'
  127. run: |
  128. docker-compose -f .ci/compatibility_tests/docker-compose-mysql-tls.yaml up -d
  129. cat <<-EOF >> "$GITHUB_ENV"
  130. EMQX_AUTH__MYSQL__SSL=on
  131. EMQX_AUTH__MYSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem
  132. EMQX_AUTH__MYSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-cert.pem
  133. EMQX_AUTH__MYSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-key.pem
  134. EOF
  135. - name: setup
  136. env:
  137. MYSQL_TAG: ${{ matrix.mysql_tag }}
  138. if: matrix.connect_type == 'tcp'
  139. run: |
  140. docker-compose -f .ci/compatibility_tests/docker-compose-mysql.yaml up -d
  141. echo EMQX_AUTH__MYSQL__SSL=off >> "$GITHUB_ENV"
  142. - name: setup
  143. if: matrix.network_type == 'ipv4'
  144. run: |
  145. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  146. - name: setup
  147. if: matrix.network_type == 'ipv6'
  148. run: |
  149. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  150. - name: run test cases
  151. run: |
  152. export EMQX_AUTH__MYSQL__USERNAME=root \
  153. EMQX_AUTH__MYSQL__PASSWORD=public \
  154. EMQX_AUTH__MYSQL__DATABASE=mqtt \
  155. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  156. printenv > .env
  157. docker exec -i erlang sh -c "make ensure-rebar3"
  158. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mysql"
  159. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mysql"
  160. - uses: actions/upload-artifact@v1
  161. if: failure()
  162. with:
  163. name: logs_mysql${{ matrix.mysql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  164. path: _build/test/logs
  165. pgsql:
  166. runs-on: ubuntu-20.04
  167. strategy:
  168. fail-fast: false
  169. matrix:
  170. pgsql_tag:
  171. - 9
  172. - 10
  173. - 11
  174. - 12
  175. - 13
  176. network_type:
  177. - ipv4
  178. - ipv6
  179. connect_type:
  180. - tls
  181. - tcp
  182. steps:
  183. - uses: actions/checkout@v1
  184. - name: setup
  185. env:
  186. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  187. if: matrix.connect_type == 'tls'
  188. run: |
  189. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml build --no-cache
  190. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml up -d
  191. cat <<-EOF >> "$GITHUB_ENV"
  192. EMQX_AUTH__PGSQL__SSL=on
  193. EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/root.crt
  194. EOF
  195. - name: setup
  196. env:
  197. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  198. if: matrix.connect_type == 'tcp'
  199. run: |
  200. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
  201. echo EMQX_AUTH__PGSQL__SSL=off >> "$GITHUB_ENV"
  202. - name: setup
  203. if: matrix.network_type == 'ipv4'
  204. run: |
  205. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  206. - name: setup
  207. if: matrix.network_type == 'ipv6'
  208. run: |
  209. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  210. - name: run test cases
  211. run: |
  212. export EMQX_AUTH__PGSQL__USERNAME=root \
  213. EMQX_AUTH__PGSQL__PASSWORD=public \
  214. EMQX_AUTH__PGSQL__DATABASE=mqtt \
  215. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  216. printenv > .env
  217. docker exec -i erlang sh -c "make ensure-rebar3"
  218. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_pgsql"
  219. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
  220. - uses: actions/upload-artifact@v1
  221. if: failure()
  222. with:
  223. name: logs_pgsql${{ matrix.pgsql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  224. path: _build/test/logs
  225. redis:
  226. runs-on: ubuntu-20.04
  227. strategy:
  228. fail-fast: false
  229. matrix:
  230. redis_tag:
  231. - 5
  232. - 6
  233. network_type:
  234. - ipv4
  235. - ipv6
  236. connect_type:
  237. - tls
  238. - tcp
  239. node_type:
  240. - single
  241. - cluster
  242. steps:
  243. - uses: actions/checkout@v1
  244. - name: setup
  245. env:
  246. REDIS_TAG: ${{ matrix.redis_tag }}
  247. if: matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  248. run: |
  249. set -exu
  250. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
  251. cat <<-EOF >> "$GITHUB_ENV"
  252. EMQX_AUTH__REDIS__SSL=on
  253. EMQX_AUTH__REDIS__SSL__CACERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt
  254. EMQX_AUTH__REDIS__SSL__CERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.crt
  255. EMQX_AUTH__REDIS__SSL__KEYFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.key
  256. EOF
  257. - name: setup
  258. env:
  259. REDIS_TAG: ${{ matrix.redis_tag }}
  260. if: matrix.connect_type == 'tcp'
  261. run: |
  262. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}.yaml up -d
  263. echo EMQX_AUTH__REDIS__SSL=off >> "$GITHUB_ENV"
  264. - name: get server address
  265. if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
  266. run: |
  267. set -exu
  268. ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
  269. ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis)
  270. cat <<-EOF >> "$GITHUB_ENV"
  271. redis_ipv4_address=$ipv4_address
  272. redis_ipv6_address=$ipv6_address
  273. EOF
  274. - name: setup
  275. if: matrix.node_type == 'single' && matrix.connect_type == 'tcp'
  276. run: |
  277. set -exu
  278. cat <<-EOF >> "$GITHUB_ENV"
  279. EMQX_AUTH__REDIS__TYPE=single
  280. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379
  281. EOF
  282. - name: setup
  283. if: matrix.node_type == 'single' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  284. run: |
  285. set -exu
  286. cat <<-EOF >> "$GITHUB_ENV"
  287. EMQX_AUTH__REDIS__TYPE=single
  288. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380
  289. EOF
  290. - name: setup
  291. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
  292. run: |
  293. set -exu
  294. cat <<-EOF >> "$GITHUB_ENV"
  295. EMQX_AUTH__REDIS__TYPE=cluster
  296. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
  297. EOF
  298. - name: setup
  299. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  300. run: |
  301. set -exu
  302. cat <<-EOF >> "$GITHUB_ENV"
  303. EMQX_AUTH__REDIS__TYPE=cluster
  304. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
  305. EOF
  306. - name: run test cases
  307. if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
  308. run: |
  309. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  310. printenv > .env
  311. docker exec -i erlang sh -c "make ensure-rebar3"
  312. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_redis"
  313. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
  314. - uses: actions/upload-artifact@v1
  315. if: failure()
  316. with:
  317. name: logs_redis${{ matrix.redis_tag }}_${{ matrix.node_type }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  318. path: _build/test/logs