run_cts_tests.yaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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__SSL__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem
  79. EMQX_AUTH__MONGO__SSL__CERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem
  80. EMQX_AUTH__MONGO__SSL__KEYFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem
  81. EMQX_AUTH__MONGO__SSL__VERIFY=true
  82. EMQX_AUTH__MONGO__SSL__SERVER_NAME_INDICATION=disable
  83. EOF
  84. - name: setup
  85. env:
  86. MONGO_TAG: ${{ matrix.mongo_tag }}
  87. if: matrix.connect_type == 'tcp'
  88. run: |
  89. docker-compose -f .ci/compatibility_tests/docker-compose-mongo.yaml up -d
  90. echo EMQX_AUTH__MONGO__SSL=off >> "$GITHUB_ENV"
  91. - name: setup
  92. if: matrix.network_type == 'ipv4'
  93. run: |
  94. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  95. - name: setup
  96. if: matrix.network_type == 'ipv6'
  97. run: |
  98. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  99. - name: set git token
  100. run: |
  101. if make emqx-ee --dry-run > /dev/null 2>&1; then
  102. 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"
  103. fi
  104. - name: run test cases
  105. run: |
  106. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  107. printenv > .env
  108. docker exec -i erlang sh -c "make ensure-rebar3"
  109. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mongo"
  110. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mongo"
  111. - uses: actions/upload-artifact@v1
  112. if: failure()
  113. with:
  114. name: logs_mongo${{ matrix.mongo_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  115. path: _build/test/logs
  116. mysql:
  117. runs-on: ubuntu-20.04
  118. strategy:
  119. fail-fast: false
  120. matrix:
  121. mysql_tag:
  122. - 5.7
  123. - 8
  124. network_type:
  125. - ipv4
  126. - ipv6
  127. connect_type:
  128. - tls
  129. - tcp
  130. steps:
  131. - uses: actions/checkout@v1
  132. - name: setup
  133. env:
  134. MYSQL_TAG: ${{ matrix.mysql_tag }}
  135. if: matrix.connect_type == 'tls'
  136. run: |
  137. docker-compose -f .ci/compatibility_tests/docker-compose-mysql-tls.yaml up -d
  138. cat <<-EOF >> "$GITHUB_ENV"
  139. EMQX_AUTH__MYSQL__SSL=on
  140. EMQX_AUTH__MYSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem
  141. EMQX_AUTH__MYSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-cert.pem
  142. EMQX_AUTH__MYSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-key.pem
  143. EMQX_AUTH__MYSQL__SSL__VERIFY=true
  144. EMQX_AUTH__MYSQL__SSL__SERVER_NAME_INDICATION=disable
  145. EOF
  146. - name: setup
  147. env:
  148. MYSQL_TAG: ${{ matrix.mysql_tag }}
  149. if: matrix.connect_type == 'tcp'
  150. run: |
  151. docker-compose -f .ci/compatibility_tests/docker-compose-mysql.yaml up -d
  152. echo EMQX_AUTH__MYSQL__SSL=off >> "$GITHUB_ENV"
  153. - name: setup
  154. if: matrix.network_type == 'ipv4'
  155. run: |
  156. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  157. - name: setup
  158. if: matrix.network_type == 'ipv6'
  159. run: |
  160. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  161. - name: set git token
  162. run: |
  163. if make emqx-ee --dry-run > /dev/null 2>&1; then
  164. 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"
  165. fi
  166. - name: run test cases
  167. run: |
  168. export EMQX_AUTH__MYSQL__USERNAME=root \
  169. EMQX_AUTH__MYSQL__PASSWORD=public \
  170. EMQX_AUTH__MYSQL__DATABASE=mqtt \
  171. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  172. printenv > .env
  173. docker exec -i erlang sh -c "make ensure-rebar3"
  174. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mysql"
  175. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mysql"
  176. - uses: actions/upload-artifact@v1
  177. if: failure()
  178. with:
  179. name: logs_mysql${{ matrix.mysql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  180. path: _build/test/logs
  181. pgsql:
  182. runs-on: ubuntu-20.04
  183. strategy:
  184. fail-fast: false
  185. matrix:
  186. pgsql_tag:
  187. - 9
  188. - 10
  189. - 11
  190. - 12
  191. - 13
  192. network_type:
  193. - ipv4
  194. - ipv6
  195. connect_type:
  196. - tls
  197. - tcp
  198. steps:
  199. - uses: actions/checkout@v1
  200. - name: setup
  201. env:
  202. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  203. if: matrix.connect_type == 'tls'
  204. run: |
  205. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml build --no-cache
  206. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml up -d
  207. cat <<-EOF >> "$GITHUB_ENV"
  208. EMQX_AUTH__PGSQL__SSL=on
  209. EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem
  210. EMQX_AUTH__PGSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/client-cert.pem
  211. EMQX_AUTH__PGSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/client-key.pem
  212. EMQX_AUTH__PGSQL__SSL__VERIFY=true
  213. EMQX_AUTH__PGSQL__SSL__SERVER_NAME_INDICATION=disable
  214. EOF
  215. - name: setup
  216. env:
  217. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  218. if: matrix.connect_type == 'tcp'
  219. run: |
  220. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
  221. echo EMQX_AUTH__PGSQL__SSL=off >> "$GITHUB_ENV"
  222. - name: setup
  223. if: matrix.network_type == 'ipv4'
  224. run: |
  225. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  226. - name: setup
  227. if: matrix.network_type == 'ipv6'
  228. run: |
  229. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  230. - name: set git token
  231. run: |
  232. if make emqx-ee --dry-run > /dev/null 2>&1; then
  233. 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"
  234. fi
  235. - name: run test cases
  236. run: |
  237. export EMQX_AUTH__PGSQL__USERNAME=root \
  238. EMQX_AUTH__PGSQL__PASSWORD=public \
  239. EMQX_AUTH__PGSQL__DATABASE=mqtt \
  240. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  241. printenv > .env
  242. docker exec -i erlang sh -c "make ensure-rebar3"
  243. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_pgsql"
  244. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
  245. - uses: actions/upload-artifact@v1
  246. if: failure()
  247. with:
  248. name: logs_pgsql${{ matrix.pgsql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  249. path: _build/test/logs
  250. redis:
  251. runs-on: ubuntu-20.04
  252. strategy:
  253. fail-fast: false
  254. matrix:
  255. redis_tag:
  256. - 5
  257. - 6
  258. network_type:
  259. - ipv4
  260. - ipv6
  261. connect_type:
  262. - tls
  263. - tcp
  264. node_type:
  265. - single
  266. - cluster
  267. exclude:
  268. - redis_tag: 5
  269. connect_type: tls
  270. steps:
  271. - uses: actions/checkout@v1
  272. - name: setup
  273. env:
  274. REDIS_TAG: ${{ matrix.redis_tag }}
  275. if: matrix.connect_type == 'tls'
  276. run: |
  277. set -exu
  278. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
  279. cat <<-EOF >> "$GITHUB_ENV"
  280. EMQX_AUTH__REDIS__SSL=on
  281. EMQX_AUTH__REDIS__SSL__CACERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt
  282. EMQX_AUTH__REDIS__SSL__CERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.crt
  283. EMQX_AUTH__REDIS__SSL__KEYFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.key
  284. EMQX_AUTH__REDIS__SSL__VERIFY=true
  285. EMQX_AUTH__REDIS__SSL__SERVER_NAME_INDICATION=disable
  286. EOF
  287. - name: setup
  288. env:
  289. REDIS_TAG: ${{ matrix.redis_tag }}
  290. if: matrix.connect_type == 'tcp'
  291. run: |
  292. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}.yaml up -d
  293. echo EMQX_AUTH__REDIS__SSL=off >> "$GITHUB_ENV"
  294. - name: get server address
  295. run: |
  296. set -exu
  297. ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
  298. ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis)
  299. cat <<-EOF >> "$GITHUB_ENV"
  300. redis_ipv4_address=$ipv4_address
  301. redis_ipv6_address=$ipv6_address
  302. EOF
  303. - name: setup
  304. if: matrix.node_type == 'single' && matrix.connect_type == 'tcp'
  305. run: |
  306. set -exu
  307. cat <<-EOF >> "$GITHUB_ENV"
  308. EMQX_AUTH__REDIS__TYPE=single
  309. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379
  310. EOF
  311. - name: setup
  312. if: matrix.node_type == 'single' && matrix.connect_type == 'tls'
  313. run: |
  314. set -exu
  315. cat <<-EOF >> "$GITHUB_ENV"
  316. EMQX_AUTH__REDIS__TYPE=single
  317. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380
  318. EOF
  319. - name: setup
  320. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
  321. run: |
  322. set -exu
  323. cat <<-EOF >> "$GITHUB_ENV"
  324. EMQX_AUTH__REDIS__TYPE=cluster
  325. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
  326. EOF
  327. - name: setup
  328. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls'
  329. run: |
  330. set -exu
  331. cat <<-EOF >> "$GITHUB_ENV"
  332. EMQX_AUTH__REDIS__TYPE=cluster
  333. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
  334. EOF
  335. - name: set git token
  336. run: |
  337. if make emqx-ee --dry-run > /dev/null 2>&1; then
  338. 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"
  339. fi
  340. - name: run test cases
  341. run: |
  342. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  343. printenv > .env
  344. docker exec -i erlang sh -c "make ensure-rebar3"
  345. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_redis"
  346. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
  347. - uses: actions/upload-artifact@v1
  348. if: failure()
  349. with:
  350. name: logs_redis${{ matrix.redis_tag }}_${{ matrix.node_type }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  351. path: _build/test/logs