apisix-docker-test.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: APISIX Docker Test
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. branches:
  8. - master
  9. jobs:
  10. build:
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. platform:
  15. - alpine
  16. - centos
  17. - alpine-local
  18. runs-on: ubuntu-latest
  19. env:
  20. APISIX_PATH: "./apisix-local"
  21. APISIX_DOCKER_TAG: 2.11.0-${{ matrix.platform }}
  22. steps:
  23. - uses: actions/checkout@v2
  24. - name: Clone apisix for local test
  25. if: ${{ matrix.platform == 'alpine-local' }}
  26. run: |
  27. git clone http://github.com/apache/apisix apisix-local
  28. - name: Build and run
  29. run: |
  30. make build-on-${{ matrix.platform }}
  31. docker-compose -f ./compose/docker-compose.yaml up -d
  32. sleep 30
  33. docker logs compose_apisix_1
  34. - name: Test
  35. run: |
  36. curl http://127.0.0.1:9080/apisix/admin/routes/1 \
  37. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  38. {
  39. "uri": "/get",
  40. "upstream": {
  41. "type": "roundrobin",
  42. "nodes": {
  43. "httpbin.org:80": 1
  44. }
  45. }
  46. }'
  47. result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
  48. if [[ $result_code -ne 200 ]];then
  49. printf "result_code: %s\n" "$result_code"
  50. exit 125
  51. fi
  52. - name: Tar Image
  53. if: ${{ !endsWith(matrix.platform, 'local') }}
  54. run: |
  55. make save-${{ matrix.platform }}-tar
  56. - name: Upload Image
  57. if: ${{ !endsWith(matrix.platform, 'local') }}
  58. uses: actions/upload-artifact@v2
  59. with:
  60. path: ./package