Github workflow test command #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Verify Docker installation | |
run: | | |
docker --version | |
docker-compose --version | |
- name: Down any existing docker-compose | |
run: docker compose down | |
- name: Build and run docker-compose | |
run: docker-compose up -d --build | |
- name: List running Docker containers | |
run: docker ps | |
- name: Wait for services to be healthy | |
run: | | |
while ! docker-compose exec -T api curl -sSf http://api:5000/health; do | |
echo "Waiting for API to be healthy..." | |
sleep 5 | |
done | |
- name: Run tests | |
run: docker-compose exec -T api sh -c "cd /app/tests && dotnet test" | |
- name: Tear down Docker containers | |
run: docker-compose down |