Skip to content

Commit

Permalink
fix: update docker compose tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tituschewxj committed Oct 8, 2024
1 parent 6944b89 commit ec42c8c
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,15 @@ jobs:
test:
runs-on: ubuntu-latest

services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Compose
run: sudo apt-get update && sudo apt-get install docker-compose -y
- name: Set up Docker
run: |
# Install Docker and Docker Compose
sudo apt-get update
sudo apt-get install -y docker.io docker-compose
- name: Create Environment Files
run: |
Expand All @@ -52,14 +46,25 @@ jobs:
- name: Clean up environment files
run: |
rm ./frontend/.env
rm ./question-service/.env
rm ./user-service/.env
rm ./apps/frontend/.env
rm ./apps/question-service/.env
rm ./apps/user-service/.env
- name: Wait for services to be ready
run: sleep 10 # this is the estimated service startup time
run: sleep 10

- name: Run Tests
run: |
curl --fail http://localhost:3000
# check if non-error status code received
curl --fail ${{ env.FRONTEND_URL }}
curl --fail ${{ env.USER_SERVICE_URL }}
# check if any response received
curl -s -o /dev/null ${{ env.QUESTION_SERVICE_URL }}
# We can add more tests here
- name: Stop Services
run: |
cd .apps
docker-compose down

0 comments on commit ec42c8c

Please sign in to comment.