apisix-docker-test.yaml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. - alpine-dev
  19. runs-on: ubuntu-latest
  20. env:
  21. APISIX_PATH: "./apisix-local"
  22. APISIX_DOCKER_TAG: 2.13.1-${{ matrix.platform }}
  23. steps:
  24. - uses: actions/checkout@v2
  25. - name: Clone apisix for local test
  26. if: ${{ matrix.platform == 'alpine-local' }}
  27. run: |
  28. git clone --depth 1 http://github.com/apache/apisix apisix-local
  29. - name: Build and run
  30. run: |
  31. make build-on-${{ matrix.platform }}
  32. docker-compose -f ./compose/docker-compose.yaml up -d
  33. sleep 30
  34. docker logs compose_apisix_1
  35. - name: Test
  36. run: |
  37. grep -C 3 '\[error\]' example/apisix_log/error.log && exit 1
  38. curl http://127.0.0.1:9080/apisix/admin/routes/1 \
  39. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  40. {
  41. "uri": "/get",
  42. "upstream": {
  43. "type": "roundrobin",
  44. "nodes": {
  45. "httpbin.org:80": 1
  46. }
  47. }
  48. }'
  49. result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
  50. if [[ $result_code -ne 200 ]];then
  51. printf "result_code: %s\n" "$result_code"
  52. exit 125
  53. fi
  54. - name: Tar Image
  55. if: ${{ !endsWith(matrix.platform, '-local') && !endsWith(matrix.platform, '-dev') }}
  56. run: |
  57. make save-${{ matrix.platform }}-tar
  58. - name: Upload Image
  59. if: ${{ !endsWith(matrix.platform, '-local') && !endsWith(matrix.platform, '-dev') }}
  60. uses: actions/upload-artifact@v2
  61. with:
  62. path: ./package