run_cts_tests.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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: docker compose up
  24. env:
  25. LDAP_TAG: ${{ matrix.ldap_tag }}
  26. run: |
  27. docker-compose \
  28. -f .ci/docker-compose-file/docker-compose-ldap-tcp.yaml \
  29. -f .ci/docker-compose-file/docker-compose.yaml \
  30. up -d --build
  31. - name: setup
  32. if: matrix.network_type == 'ipv4'
  33. run: |
  34. echo EMQX_AUTH__LDAP__SERVERS=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ldap) >> "$GITHUB_ENV"
  35. - name: setup
  36. if: matrix.network_type == 'ipv6'
  37. run: |
  38. echo EMQX_AUTH__LDAP__SERVERS=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' ldap) >> "$GITHUB_ENV"
  39. - name: set git token
  40. run: |
  41. if make emqx-ee --dry-run > /dev/null 2>&1; then
  42. 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"
  43. fi
  44. - name: run test cases
  45. run: |
  46. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  47. printenv > .env
  48. docker exec -i erlang sh -c "make ensure-rebar3"
  49. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_ldap"
  50. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_ldap"
  51. - uses: actions/upload-artifact@v1
  52. if: failure()
  53. with:
  54. name: logs_ldap${{ matrix.ldap_tag }}_${{ matrix.network_type }}
  55. path: _build/test/logs
  56. mongo:
  57. runs-on: ubuntu-20.04
  58. strategy:
  59. fail-fast: false
  60. matrix:
  61. mongo_tag:
  62. - 3
  63. - 4
  64. network_type:
  65. - ipv4
  66. - ipv6
  67. connect_type:
  68. - tls
  69. - tcp
  70. steps:
  71. - uses: actions/checkout@v1
  72. - name: docker-compose up
  73. run: |
  74. docker-compose \
  75. -f .ci/docker-compose-file/docker-compose-mongo-${{ matrix.connect_type }}.yaml \
  76. -f .ci/docker-compose-file/docker-compose.yaml \
  77. up -d --build
  78. - name: setup
  79. env:
  80. MONGO_TAG: ${{ matrix.mongo_tag }}
  81. if: matrix.connect_type == 'tls'
  82. run: |
  83. cat <<-EOF >> "$GITHUB_ENV"
  84. EMQX_AUTH__MONGO__SSL__ENABLE=on
  85. EMQX_AUTH__MONGO__SSL__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem
  86. EMQX_AUTH__MONGO__SSL__CERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem
  87. EMQX_AUTH__MONGO__SSL__KEYFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem
  88. EMQX_AUTH__MONGO__SSL__VERIFY=true
  89. EMQX_AUTH__MONGO__SSL__SERVER_NAME_INDICATION=disable
  90. EOF
  91. - name: setup
  92. env:
  93. MONGO_TAG: ${{ matrix.mongo_tag }}
  94. if: matrix.connect_type == 'tcp'
  95. run: |
  96. echo EMQX_AUTH__MONGO__SSL__ENABLE=off >> "$GITHUB_ENV"
  97. - name: setup
  98. if: matrix.network_type == 'ipv4'
  99. run: |
  100. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  101. - name: setup
  102. if: matrix.network_type == 'ipv6'
  103. run: |
  104. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  105. - name: set git token
  106. run: |
  107. if make emqx-ee --dry-run > /dev/null 2>&1; then
  108. 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"
  109. fi
  110. - name: run test cases
  111. run: |
  112. export CUTTLEFISH_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 --dir apps/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. printenv > .env
  193. docker exec -i erlang sh -c "make ensure-rebar3"
  194. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mysql"
  195. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mysql"
  196. - uses: actions/upload-artifact@v1
  197. if: failure()
  198. with:
  199. name: logs_mysql${{ matrix.mysql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  200. path: _build/test/logs
  201. pgsql:
  202. runs-on: ubuntu-20.04
  203. strategy:
  204. fail-fast: false
  205. matrix:
  206. pgsql_tag:
  207. - 9
  208. - 10
  209. - 11
  210. - 12
  211. - 13
  212. network_type:
  213. - ipv4
  214. - ipv6
  215. connect_type:
  216. - tls
  217. - tcp
  218. steps:
  219. - uses: actions/checkout@v1
  220. - name: docker-compose up
  221. run: |
  222. docker-compose \
  223. -f .ci/docker-compose-file/docker-compose-pgsql-${{ matrix.connect_type }}.yaml \
  224. -f .ci/docker-compose-file/docker-compose.yaml \
  225. up -d --build
  226. - name: setup
  227. env:
  228. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  229. if: matrix.connect_type == 'tls'
  230. run: |
  231. cat <<-EOF >> "$GITHUB_ENV"
  232. EMQX_AUTH__PGSQL__SSL__ENABLE=on
  233. EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem
  234. EMQX_AUTH__PGSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/client-cert.pem
  235. EMQX_AUTH__PGSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/client-key.pem
  236. EMQX_AUTH__PGSQL__SSL__VERIFY=true
  237. EMQX_AUTH__PGSQL__SSL__SERVER_NAME_INDICATION=disable
  238. EOF
  239. - name: setup
  240. env:
  241. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  242. if: matrix.connect_type == 'tcp'
  243. run: |
  244. echo EMQX_AUTH__PGSQL__SSL__ENABLE=off >> "$GITHUB_ENV"
  245. - name: setup
  246. if: matrix.network_type == 'ipv4'
  247. run: |
  248. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  249. - name: setup
  250. if: matrix.network_type == 'ipv6'
  251. run: |
  252. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  253. - name: set git token
  254. run: |
  255. if make emqx-ee --dry-run > /dev/null 2>&1; then
  256. 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"
  257. fi
  258. - name: run test cases
  259. run: |
  260. export EMQX_AUTH__PGSQL__USERNAME=root \
  261. EMQX_AUTH__PGSQL__PASSWORD=public \
  262. EMQX_AUTH__PGSQL__DATABASE=mqtt \
  263. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  264. printenv > .env
  265. docker exec -i erlang sh -c "make ensure-rebar3"
  266. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_pgsql"
  267. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
  268. - uses: actions/upload-artifact@v1
  269. if: failure()
  270. with:
  271. name: logs_pgsql${{ matrix.pgsql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  272. path: _build/test/logs
  273. redis:
  274. runs-on: ubuntu-20.04
  275. strategy:
  276. fail-fast: false
  277. matrix:
  278. redis_tag:
  279. - 5
  280. - 6
  281. network_type:
  282. - ipv4
  283. - ipv6
  284. connect_type:
  285. - tls
  286. - tcp
  287. node_type:
  288. - single
  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__ENABLE=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__ENABLE=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 == 'cluster' && matrix.connect_type == 'tcp'
  344. run: |
  345. cat <<-EOF >> "$GITHUB_ENV"
  346. EMQX_AUTH__REDIS__TYPE=cluster
  347. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
  348. EOF
  349. - name: setup
  350. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls'
  351. run: |
  352. cat <<-EOF >> "$GITHUB_ENV"
  353. EMQX_AUTH__REDIS__TYPE=cluster
  354. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
  355. EOF
  356. - name: set git token
  357. run: |
  358. if make emqx-ee --dry-run > /dev/null 2>&1; then
  359. 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"
  360. fi
  361. - name: run test cases
  362. run: |
  363. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  364. export EMQX_AUTH__REIDS__PASSWORD=public
  365. printenv > .env
  366. docker exec -i erlang sh -c "make ensure-rebar3"
  367. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_redis"
  368. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
  369. - uses: actions/upload-artifact@v1
  370. if: failure()
  371. with:
  372. name: logs_redis${{ matrix.redis_tag }}_${{ matrix.node_type }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  373. path: _build/test/logs