From 29572d7eafdc2fc4404cb8bf45e22a6a6565d7c9 Mon Sep 17 00:00:00 2001 From: aazizk Date: Fri, 23 Jun 2023 05:39:42 +0500 Subject: [PATCH] workflows --- .github/workflows/ci_test_api_service.yml | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/ci_test_api_service.yml diff --git a/.github/workflows/ci_test_api_service.yml b/.github/workflows/ci_test_api_service.yml new file mode 100644 index 0000000..07bc7c6 --- /dev/null +++ b/.github/workflows/ci_test_api_service.yml @@ -0,0 +1,44 @@ +name: Test API Service + +on: + push: + branches: + - main + pull_request: + branches: + - "*" + +jobs: + test_api_service: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build and run Docker Compose + run: | + docker-compose build + docker-compose up -d + + - name: Wait for API to start + run: sleep 10 + + - name: Test Quote Disp Health + run: | + status=$(curl --write-out %{http_code} --silent --output /dev/null http://localhost:5001/health) + if [[ "$status" -ne 200 ]]; then + echo "API endpoint returned $status" + exit 1 + fi + + - name: Test Quote Gen Health + run: | + status=$(curl --write-out %{http_code} --silent --output /dev/null http://localhost:5000/health) + if [[ "$status" -ne 200 ]]; then + echo "API endpoint returned $status" + exit 1 + fi + + - name: Stop Docker Compose + run: docker-compose down