run_cts_tests.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. name: Compatibility Test Suite
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. - e*
  7. pull_request:
  8. jobs:
  9. ldap:
  10. runs-on: ubuntu-20.04
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. ldap_tag:
  15. - 2.4.50
  16. network_type:
  17. - ipv4
  18. - ipv6
  19. steps:
  20. - uses: actions/checkout@v1
  21. - name: docker compose up
  22. env:
  23. LDAP_TAG: ${{ matrix.ldap_tag }}
  24. run: |
  25. docker-compose \
  26. -f .ci/docker-compose-file/docker-compose-ldap-tcp.yaml \
  27. -f .ci/docker-compose-file/docker-compose.yaml \
  28. up -d --build
  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. export HOCON_ENV_OVERRIDE_PREFIX=EMQX_
  46. printenv > .env
  47. docker exec -i erlang sh -c "make ensure-rebar3"
  48. docker exec -i erlang sh -c "./rebar3 eunit --application=emqx_auth_ldap"
  49. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_ldap"
  50. - uses: actions/upload-artifact@v1
  51. if: failure()
  52. with:
  53. name: logs_ldap${{ matrix.ldap_tag }}_${{ matrix.network_type }}
  54. path: _build/test/logs
  55. mongo:
  56. runs-on: ubuntu-20.04
  57. strategy:
  58. fail-fast: false
  59. matrix:
  60. mongo_tag:
  61. - 3
  62. - 4
  63. network_type:
  64. - ipv4
  65. - ipv6
  66. connect_type:
  67. - tls
  68. - tcp
  69. steps:
  70. - uses: actions/checkout@v1
  71. - name: docker-compose up
  72. run: |
  73. docker-compose \
  74. -f .ci/docker-compose-file/docker-compose-mongo-${{ matrix.connect_type }}.yaml \
  75. -f .ci/docker-compose-file/docker-compose.yaml \
  76. up -d --build
  77. - name: setup
  78. env:
  79. MONGO_TAG: ${{ matrix.mongo_tag }}
  80. if: matrix.connect_type == 'tls'
  81. run: |
  82. cat <<-EOF >> "$GITHUB_ENV"
  83. EMQX_AUTH__MONGO__SSL__ENABLE=on
  84. EMQX_AUTH__MONGO__SSL__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem
  85. EMQX_AUTH__MONGO__SSL__CERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem
  86. EMQX_AUTH__MONGO__SSL__KEYFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem
  87. EMQX_AUTH__MONGO__SSL__VERIFY=true
  88. EMQX_AUTH__MONGO__SSL__SERVER_NAME_INDICATION=disable
  89. EOF
  90. - name: setup
  91. env:
  92. MONGO_TAG: ${{ matrix.mongo_tag }}
  93. if: matrix.connect_type == 'tcp'
  94. run: |
  95. echo EMQX_AUTH__MONGO__SSL__ENABLE=off >> "$GITHUB_ENV"
  96. - name: setup
  97. if: matrix.network_type == 'ipv4'
  98. run: |
  99. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  100. - name: setup
  101. if: matrix.network_type == 'ipv6'
  102. run: |
  103. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  104. - name: set git token
  105. run: |
  106. if make emqx-ee --dry-run > /dev/null 2>&1; then
  107. 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"
  108. fi
  109. - name: run test cases
  110. run: |
  111. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  112. export HOCON_ENV_OVERRIDE_PREFIX=EMQX_
  113. printenv > .env
  114. docker exec -i erlang sh -c "make ensure-rebar3"
  115. docker exec -i erlang sh -c "./rebar3 eunit --application=emqx_auth_mongo"
  116. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mongo"
  117. - uses: actions/upload-artifact@v1
  118. if: failure()
  119. with:
  120. name: logs_mongo${{ matrix.mongo_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  121. path: _build/test/logs
  122. mysql:
  123. runs-on: ubuntu-20.04
  124. strategy:
  125. fail-fast: false
  126. matrix:
  127. mysql_tag:
  128. - 5.7
  129. - 8
  130. network_type:
  131. - ipv4
  132. - ipv6
  133. connect_type:
  134. - tls
  135. - tcp
  136. steps:
  137. - uses: actions/checkout@v1
  138. - name: docker-compose up
  139. timeout-minutes: 5
  140. run: |
  141. docker-compose \
  142. -f .ci/docker-compose-file/docker-compose-mysql-${{ matrix.connect_type }}.yaml \
  143. -f .ci/docker-compose-file/docker-compose.yaml \
  144. up -d --build
  145. while [ $(docker ps -a --filter name=client --filter exited=0 | wc -l) \
  146. != $(docker ps -a --filter name=client | wc -l) ]; do
  147. sleep 5
  148. done
  149. - name: setup
  150. env:
  151. MYSQL_TAG: ${{ matrix.mysql_tag }}
  152. if: matrix.connect_type == 'tls'
  153. run: |
  154. cat <<-EOF >> "$GITHUB_ENV"
  155. EMQX_AUTH__MYSQL__SSL__ENABLE=on
  156. EMQX_AUTH__MYSQL__USERNAME=ssluser
  157. EMQX_AUTH__MYSQL__PASSWORD=public
  158. EMQX_AUTH__MYSQL__DATABASE=mqtt
  159. EMQX_AUTH__MYSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem
  160. EMQX_AUTH__MYSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-cert.pem
  161. EMQX_AUTH__MYSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-key.pem
  162. EMQX_AUTH__MYSQL__SSL__VERIFY=true
  163. EMQX_AUTH__MYSQL__SSL__SERVER_NAME_INDICATION=disable
  164. EOF
  165. - name: setup
  166. env:
  167. MYSQL_TAG: ${{ matrix.mysql_tag }}
  168. if: matrix.connect_type == 'tcp'
  169. run: |
  170. cat <<-EOF >> "$GITHUB_ENV"
  171. EMQX_AUTH__MYSQL__USERNAME=root
  172. EMQX_AUTH__MYSQL__PASSWORD=public
  173. EMQX_AUTH__MYSQL__DATABASE=mqtt
  174. EMQX_AUTH__MYSQL__SSL__ENABLE=off
  175. EOF
  176. - name: setup
  177. if: matrix.network_type == 'ipv4'
  178. run: |
  179. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  180. - name: setup
  181. if: matrix.network_type == 'ipv6'
  182. run: |
  183. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  184. - name: set git token
  185. run: |
  186. if make emqx-ee --dry-run > /dev/null 2>&1; then
  187. 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"
  188. fi
  189. - name: run test cases
  190. run: |
  191. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  192. export HOCON_ENV_OVERRIDE_PREFIX=EMQX_
  193. printenv > .env
  194. docker exec -i erlang sh -c "make ensure-rebar3"
  195. docker exec -i erlang sh -c "./rebar3 eunit --application=emqx_auth_mysql"
  196. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mysql"
  197. - uses: actions/upload-artifact@v1
  198. if: failure()
  199. with:
  200. name: logs_mysql${{ matrix.mysql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  201. path: _build/test/logs
  202. pgsql:
  203. runs-on: ubuntu-20.04
  204. strategy:
  205. fail-fast: false
  206. matrix:
  207. pgsql_tag:
  208. - 9
  209. - 10
  210. - 11
  211. - 12
  212. - 13
  213. network_type:
  214. - ipv4
  215. - ipv6
  216. connect_type:
  217. - tls
  218. - tcp
  219. steps:
  220. - uses: actions/checkout@v1
  221. - name: docker-compose up
  222. run: |
  223. docker-compose \
  224. -f .ci/docker-compose-file/docker-compose-pgsql-${{ matrix.connect_type }}.yaml \
  225. -f .ci/docker-compose-file/docker-compose.yaml \
  226. up -d --build
  227. - name: setup
  228. env:
  229. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  230. if: matrix.connect_type == 'tls'
  231. run: |
  232. cat <<-EOF >> "$GITHUB_ENV"
  233. EMQX_AUTH__PGSQL__SSL__ENABLE=on
  234. EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem
  235. EMQX_AUTH__PGSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/client-cert.pem
  236. EMQX_AUTH__PGSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/client-key.pem
  237. EMQX_AUTH__PGSQL__SSL__VERIFY=true
  238. EMQX_AUTH__PGSQL__SSL__SERVER_NAME_INDICATION=disable
  239. EOF
  240. - name: setup
  241. env:
  242. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  243. if: matrix.connect_type == 'tcp'
  244. run: |
  245. echo EMQX_AUTH__PGSQL__SSL__ENABLE=off >> "$GITHUB_ENV"
  246. - name: setup
  247. if: matrix.network_type == 'ipv4'
  248. run: |
  249. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  250. - name: setup
  251. if: matrix.network_type == 'ipv6'
  252. run: |
  253. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  254. - name: set git token
  255. run: |
  256. if make emqx-ee --dry-run > /dev/null 2>&1; then
  257. 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"
  258. fi
  259. - name: run test cases
  260. run: |
  261. export EMQX_AUTH__PGSQL__USERNAME=root \
  262. EMQX_AUTH__PGSQL__PASSWORD=public \
  263. EMQX_AUTH__PGSQL__DATABASE=mqtt \
  264. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_ \
  265. HOCON_ENV_OVERRIDE_PREFIX=EMQX_
  266. printenv > .env
  267. docker exec -i erlang sh -c "make ensure-rebar3"
  268. docker exec -i erlang sh -c "./rebar3 eunit --application=emqx_auth_pgsql"
  269. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
  270. - uses: actions/upload-artifact@v1
  271. if: failure()
  272. with:
  273. name: logs_pgsql${{ matrix.pgsql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  274. path: _build/test/logs
  275. redis:
  276. runs-on: ubuntu-20.04
  277. strategy:
  278. fail-fast: false
  279. matrix:
  280. redis_tag:
  281. - 5
  282. - 6
  283. network_type:
  284. - ipv4
  285. - ipv6
  286. connect_type:
  287. - tls
  288. - tcp
  289. node_type:
  290. - single
  291. - sentinel
  292. - cluster
  293. exclude:
  294. - redis_tag: 5
  295. connect_type: tls
  296. steps:
  297. - uses: actions/checkout@v1
  298. - name: docker-compose up
  299. run: |
  300. docker-compose \
  301. -f .ci/docker-compose-file/docker-compose-redis-${{ matrix.node_type }}-${{ matrix.connect_type }}.yaml \
  302. -f .ci/docker-compose-file/docker-compose.yaml \
  303. up -d --build
  304. - name: setup
  305. env:
  306. REDIS_TAG: ${{ matrix.redis_tag }}
  307. if: matrix.connect_type == 'tls'
  308. run: |
  309. cat <<-EOF >> "$GITHUB_ENV"
  310. EMQX_AUTH__REDIS__SSL__ENABLE=on
  311. EMQX_AUTH__REDIS__SSL__CACERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt
  312. EMQX_AUTH__REDIS__SSL__CERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.crt
  313. EMQX_AUTH__REDIS__SSL__KEYFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.key
  314. EMQX_AUTH__REDIS__SSL__VERIFY=true
  315. EMQX_AUTH__REDIS__SSL__SERVER_NAME_INDICATION=disable
  316. EOF
  317. - name: setup
  318. env:
  319. REDIS_TAG: ${{ matrix.redis_tag }}
  320. if: matrix.connect_type == 'tcp'
  321. run: |
  322. echo EMQX_AUTH__REDIS__SSL__ENABLE=off >> "$GITHUB_ENV"
  323. - name: get server address
  324. run: |
  325. ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
  326. ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis)
  327. cat <<-EOF >> "$GITHUB_ENV"
  328. redis_ipv4_address=$ipv4_address
  329. redis_ipv6_address=$ipv6_address
  330. EOF
  331. - name: setup
  332. if: matrix.node_type == 'single' && matrix.connect_type == 'tcp'
  333. run: |
  334. cat <<-EOF >> "$GITHUB_ENV"
  335. EMQX_AUTH__REDIS__TYPE=single
  336. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379
  337. EOF
  338. - name: setup
  339. if: matrix.node_type == 'single' && matrix.connect_type == 'tls'
  340. run: |
  341. cat <<-EOF >> "$GITHUB_ENV"
  342. EMQX_AUTH__REDIS__TYPE=single
  343. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380
  344. EOF
  345. - name: setup
  346. if: matrix.node_type == 'sentinel' && matrix.connect_type == 'tcp'
  347. run: |
  348. cat <<-EOF >> "$GITHUB_ENV"
  349. EMQX_AUTH__REDIS__TYPE=sentinel
  350. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:26379
  351. EMQX_AUTH__REDIS__SENTINEL=mymaster
  352. EOF
  353. - name: setup
  354. if: matrix.node_type == 'sentinel' && matrix.connect_type == 'tls'
  355. run: |
  356. cat <<-EOF >> "$GITHUB_ENV"
  357. EMQX_AUTH__REDIS__TYPE=sentinel
  358. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:26380
  359. EMQX_AUTH__REDIS__SENTINEL=mymaster
  360. EOF
  361. - name: setup
  362. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
  363. run: |
  364. cat <<-EOF >> "$GITHUB_ENV"
  365. EMQX_AUTH__REDIS__TYPE=cluster
  366. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
  367. EOF
  368. - name: setup
  369. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls'
  370. run: |
  371. cat <<-EOF >> "$GITHUB_ENV"
  372. EMQX_AUTH__REDIS__TYPE=cluster
  373. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
  374. EOF
  375. - name: set git token
  376. run: |
  377. if make emqx-ee --dry-run > /dev/null 2>&1; then
  378. 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"
  379. fi
  380. - name: run test cases
  381. run: |
  382. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  383. export EMQX_AUTH__REIDS__PASSWORD=public
  384. printenv > .env
  385. docker exec -i erlang sh -c "make ensure-rebar3"
  386. docker exec -i erlang sh -c "./rebar3 eunit --application=emqx_auth_redis"
  387. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
  388. - uses: actions/upload-artifact@v1
  389. if: failure()
  390. with:
  391. name: logs_redis${{ matrix.redis_tag }}_${{ matrix.node_type }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  392. path: _build/test/logs