apisix-docker-example-test.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: Docker compose CI for example
  2. on:
  3. schedule:
  4. - cron: "0 1 * * *"
  5. push:
  6. branches: [master]
  7. paths-ignore:
  8. - 'docs/**'
  9. - '**/*.md'
  10. pull_request:
  11. branches:
  12. - master
  13. - 'release/apisix-2.15.**'
  14. env:
  15. APISIX_VERSION: "3.2.0"
  16. jobs:
  17. prepare:
  18. runs-on: ubuntu-latest
  19. steps:
  20. - name: Set apisix version
  21. id: apisix
  22. run: |
  23. branch=${{ github.base_ref }}
  24. apisix_version=$( (echo ${branch} | grep -Po '\d*\.\d*\.\d*') || echo ${APISIX_VERSION} )
  25. echo "version=${apisix_version}" >> $GITHUB_OUTPUT
  26. outputs:
  27. apisix-version: ${{ steps.apisix.outputs.version }}
  28. build:
  29. runs-on: ubuntu-latest
  30. needs: prepare
  31. env:
  32. APISIX_VERSION: ${{ needs.prepare.outputs.apisix-version }}
  33. strategy:
  34. fail-fast: false
  35. matrix:
  36. platform:
  37. - centos
  38. - debian
  39. steps:
  40. - uses: actions/checkout@v2
  41. - name: Build image
  42. run: |
  43. make build-on-${{ matrix.platform }}
  44. - name: use docker-compose
  45. env:
  46. APISIX_IMAGE_TAG: ${{ format('{0}-{1}', env.APISIX_VERSION, matrix.platform) }}
  47. run: docker-compose -p docker-apisix -f example/docker-compose.yml up -d
  48. - name: Test APISIX
  49. run: |
  50. sleep 30
  51. curl http://127.0.0.1:9180/apisix/admin/routes/1 \
  52. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  53. {
  54. "uri": "/get",
  55. "upstream": {
  56. "type": "roundrobin",
  57. "nodes": {
  58. "web1:80": 1
  59. }
  60. }
  61. }'
  62. result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
  63. if [[ $result_code -ne 200 ]];then
  64. printf "result_code: %s\n" "$result_code"
  65. exit 125
  66. fi