Merge pull request #139 from mdabcevic/138-integration-tests-for-cont… #363
This file contains hidden or 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: Smoke Test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| deploy-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build images | |
| run: docker compose build | |
| - name: Start Postgres and Redis only | |
| run: docker compose up -d postgres redis | |
| - name: Wait for Postgres readiness | |
| run: | | |
| for i in {1..20}; do | |
| echo "⏳ Attempt $i: checking postgres..." | |
| if pg_isready -h localhost -p 5442 -U admin; then | |
| echo "✅ Postgres is ready" | |
| exit 0 | |
| fi | |
| sleep 3 | |
| done | |
| echo "❌ Postgres failed to respond" | |
| docker compose logs postgres | |
| exit 1 | |
| # Setup .NET SDK + EF CLI | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Install EF CLI tools | |
| run: dotnet tool install --global dotnet-ef | |
| - name: Add EF CLI to PATH | |
| run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | |
| - name: Apply EF Migrations | |
| working-directory: ./backend/BartenderBackend | |
| run: dotnet ef database update --project ../Bartender.Data --startup-project . | |
| - name: Seed database | |
| env: | |
| PGUSER: admin | |
| PGPASSWORD: adminpass | |
| run: | | |
| psql -v ON_ERROR_STOP=1 -h localhost -p 5442 -d bartenderdb -f ./db/initseed.sql | |
| - name: Start services | |
| run: docker compose up -d backend frontend | |
| - name: Wait for backend to be ready (retry loop) | |
| run: | | |
| for i in {1..20}; do | |
| echo "⏳ Attempt $i: checking backend..." | |
| if curl -sf http://localhost:7214/health; then | |
| echo "✅ Backend is ready" | |
| exit 0 | |
| fi | |
| sleep 5 | |
| done | |
| echo "❌ Backend failed to respond within timeout" | |
| docker compose logs backend | |
| exit 1 | |
| - name: Show status | |
| run: docker compose ps -a | |
| - name: Check backend | |
| run: curl -f http://localhost:7214/health | |
| - name: Check frontend | |
| run: curl -f http://localhost:5173 | |
| - name: Run OWASP ZAP Baseline Scan | |
| uses: zaproxy/action-baseline@v0.14.0 | |
| with: | |
| target: 'http://localhost:7214' | |
| fail_action: false | |
| allow_issue_writing: false | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose down -v |