Update branch on Github workflow #1
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: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and run docker-compose | |
run: docker-compose up -d --build | |
- name: Wait for services to be healthy | |
run: | | |
while ! docker-compose exec api curl -sSf http://localhost:5000/health; do | |
echo "Waiting for API to be healthy..." | |
sleep 5 | |
done | |
- name: Run tests | |
run: docker-compose exec api dotnet test ./tests | |
- name: Tear down Docker containers | |
run: docker-compose down |