Add list_models route #14
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 Build and Test | |
| on: | |
| push: | |
| branches: [ master, develop, feature/* ] | |
| pull_request: | |
| branches: [ master, develop ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| test-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Generate test environment file | |
| run: | | |
| cat > .env << EOF | |
| FABRIC_MNEMONIC=abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art | |
| MYSQL_PASSWORD=test_password_for_ci | |
| ADMIN_USERNAME=admin | |
| ADMIN_PASSWORD=test_admin_password | |
| NODE_ENV=production | |
| OLLAMA_MODELS_PATH=./empty-ollama-models | |
| EOF | |
| - name: Create empty Ollama models directory | |
| run: mkdir -p empty-ollama-models | |
| - name: Test Docker build | |
| run: | | |
| docker compose build --no-cache | |
| - name: Test services startup | |
| run: | | |
| docker compose up -d | |
| - name: Wait for services to be ready | |
| run: | | |
| echo "Waiting for services to start..." | |
| sleep 30 | |
| - name: Check service health | |
| run: | | |
| docker compose ps | |
| # Check if app container is running | |
| if ! docker compose ps app | grep -q "Up"; then | |
| echo "App container failed to start" | |
| docker compose logs app | |
| exit 1 | |
| fi | |
| echo "✅ All services started successfully" | |
| - name: Test basic functionality | |
| run: | | |
| # Test if app responds to health check | |
| timeout 60 bash -c 'until curl -f http://localhost:5050/metrics/health; do sleep 2; done' | |
| echo "✅ Health check endpoint is responding" | |
| - name: Show logs on failure | |
| if: failure() | |
| run: | | |
| echo "=== Application Logs ===" | |
| docker compose logs app | |
| echo "=== Database Logs ===" | |
| docker compose logs db | |
| echo "=== Redis Logs ===" | |
| docker compose logs redis | |
| echo "=== Ollama Logs ===" | |
| docker compose logs ollama | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker compose down -v | |
| docker system prune -f | |
| build-multiplatform: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/master') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha,prefix={{branch}}- | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push multi-platform image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |