Update docs project.md #72
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: Build and run docker-compose | |
run: docker-compose -f docker-compose.yml -f docker-compose.projects.yml up -d --build | |
- name: List running Docker containers | |
run: docker ps | |
- name: Update database | |
run: | | |
dotnet tool install --global dotnet-ef | |
dotnet tool restore | |
dotnet ef database update -c ApplicationDbContext -p Motto.Data | |
- name: Install curl | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl | |
- name: Wait for api to be healthy | |
run: | | |
count=0 | |
max_retries=10 | |
while ! curl -sSf http://localhost:5000/api/health; do | |
count=$((count + 1)) | |
if [ $count -ge $max_retries ]; then | |
echo "Max retries reached. Exiting..." | |
exit 1 | |
fi | |
echo "Waiting for API to be healthy... Attempt $count" | |
sleep 5 | |
done | |
echo "API is healthy!" | |
- name: Run tests | |
run: dotnet test ./Motto.Tests -e ASPNETCORE_ENVIRONMENT=Local | |
- name: Tear down Docker containers | |
run: docker-compose -f docker-compose.yml -f docker-compose.projects.yml down |