Fix working directory paths in CI workflow for consistency #18
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: End-to-End Tests | |
| on: | |
| push: | |
| branches: [week7] | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🔧 Build Docker containers | |
| run: docker compose build | |
| working-directory: week7 | |
| - name: 🚀 Start containers | |
| run: docker compose up -d | |
| working-directory: week7 | |
| - name: 💤 Wait for DB healthcheck | |
| run: | | |
| timeout=30 | |
| for i in $(seq 1 $timeout); do | |
| status=$(docker inspect --format='{{.State.Health.Status}}' $(docker compose ps -q db)) | |
| echo "DB health: $status" | |
| [ "$status" = "healthy" ] && break | |
| sleep 1 | |
| done | |
| working-directory: week7 | |
| - name: 🧪 Test API endpoints | |
| run: | | |
| curl --fail http://localhost:3000/health | |
| curl --fail http://localhost:3000/api/users | |
| working-directory: week7 | |
| - name: 📜 Capture logs on failure | |
| if: failure() | |
| run: docker compose logs > full_logs.txt | |
| working-directory: week7 | |
| - name: 📤 Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-compose-logs | |
| path: week7/full_logs.txt | |
| - name: 🧹 Shut down containers | |
| if: always() | |
| run: docker compose down --volumes | |
| working-directory: week7 |