Update comments in docker-compose.yml #16
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: Docker Image CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '.github/**' | |
| # - 'README.md' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - '.editorconfig' | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '.github/**' | |
| # - 'README.md' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - '.editorconfig' | |
| jobs: | |
| test-changed-services: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed services | |
| id: changes | |
| run: | | |
| # Detect changed files | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) | |
| else | |
| CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD) | |
| fi | |
| # Find services that changed | |
| SERVICES=$(echo "$CHANGED_FILES" | grep "^services/" | cut -d'/' -f2 | sort -u) | |
| echo "Changed files: $CHANGED_FILES" | |
| echo "Changed services: $SERVICES" | |
| # Export for next steps | |
| echo "$SERVICES" > changed_services.txt | |
| - name: Test each changed service | |
| env: | |
| TS_AUTHKEY: ${{ secrets.TS_AUTHKEY }} | |
| run: | | |
| if [ ! -s changed_services.txt ]; then | |
| echo "No services changed, only README or other files modified" | |
| exit 0 | |
| fi | |
| while IFS= read -r service; do | |
| if [ -z "$service" ]; then | |
| continue | |
| fi | |
| echo "=======================================" | |
| echo "Testing service: $service" | |
| echo "=======================================" | |
| SERVICE_DIR="./services/$service" | |
| if [ ! -d "$SERVICE_DIR" ]; then | |
| echo "Warning: Service directory $SERVICE_DIR not found, skipping..." | |
| continue | |
| fi | |
| cd "$SERVICE_DIR" | |
| # Find compose file | |
| if [ -f "docker-compose.yml" ]; then | |
| COMPOSE_CMD="docker compose" | |
| else | |
| echo "No compose file found in $SERVICE_DIR, trying root directory with service name..." | |
| fi | |
| echo "Starting service test..." | |
| # Use tee to show output in real-time while capturing it | |
| set +e # Disable exit on error temporarily | |
| timeout 300 $COMPOSE_CMD up --abort-on-container-exit --wait-timeout 180 | tee service_output.log | |
| exit_status=${PIPESTATUS[0]} # Get exit status from timeout command, not tee | |
| set -e | |
| case $exit_status in | |
| 0) | |
| echo "✅ Service completed successfully" | |
| ;; | |
| 124) | |
| echo "⏱️ Service timed out after 300 seconds (acceptable)" | |
| ;; | |
| *) | |
| echo "❌ Service failed with exit code: $exit_status" | |
| echo "Recent output:" | |
| tail -50 service_output.log || true | |
| exit 1 | |
| ;; | |
| esac | |
| # Cleanup | |
| $COMPOSE_CMD down --remove-orphans --volumes 2>/dev/null || true | |
| cd - > /dev/null | |
| done < changed_services.txt | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker system prune -f | |
| rm -f changed_services.txt |