apisix-docker-example-test.yaml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. paths:
  12. - 'example/*'
  13. jobs:
  14. build:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v2
  18. - name: use docker-compose
  19. run: docker-compose -p docker-apisix -f example/docker-compose.yml up -d
  20. - name: Test APISIX
  21. run: |
  22. sleep 30
  23. grep -C 3 '\[error\]' example/apisix_log/error.log && exit 1
  24. curl http://127.0.0.1:9080/apisix/admin/routes/1 \
  25. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  26. {
  27. "uri": "/get",
  28. "upstream": {
  29. "type": "roundrobin",
  30. "nodes": {
  31. "web1:80": 1
  32. }
  33. }
  34. }'
  35. result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
  36. if [[ $result_code -ne 200 ]];then
  37. printf "result_code: %s\n" "$result_code"
  38. exit 125
  39. fi