run_cts_tests.yaml 15 KB

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