apisix-docker-example-test.yaml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.3.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. - redhat
  40. steps:
  41. - uses: actions/checkout@v2
  42. - name: Build image
  43. run: |
  44. make build-on-${{ matrix.platform }}
  45. - name: use docker-compose
  46. env:
  47. APISIX_IMAGE_TAG: ${{ format('{0}-{1}', env.APISIX_VERSION, matrix.platform) }}
  48. run: docker-compose -p docker-apisix -f example/docker-compose.yml up -d
  49. - name: Test APISIX
  50. run: |
  51. sleep 30
  52. curl http://127.0.0.1:9180/apisix/admin/routes/1 \
  53. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  54. {
  55. "uri": "/get",
  56. "upstream": {
  57. "type": "roundrobin",
  58. "nodes": {
  59. "web1:80": 1
  60. }
  61. }
  62. }'
  63. result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
  64. if [[ $result_code -ne 200 ]];then
  65. printf "result_code: %s\n" "$result_code"
  66. exit 125
  67. fi