run_cts_tests.yaml 15 KB

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