run_cts_tests.yaml 15 KB

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