run_cts_tests.yaml 13 KB

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