Fix structured LLM response handling, update eval model name #505
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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| # First job: Build and test the image before pushing | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Build Docker image for testing | |
| run: | | |
| docker build -t hed-bot-test:ci -f ./deploy/Dockerfile --build-arg GIT_COMMIT=${{ github.sha }} . | |
| - name: Smoke test - Start container | |
| run: | | |
| docker run -d --name hed-bot-test \ | |
| -p 38427:38427 \ | |
| -e REQUIRE_API_AUTH=false \ | |
| -e LLM_PROVIDER=openrouter \ | |
| -e OPENROUTER_API_KEY=test-key-for-ci \ | |
| -e LLM_TEMPERATURE=0.1 \ | |
| hed-bot-test:ci | |
| - name: Wait for container to start | |
| run: | | |
| echo "Waiting for container to initialize..." | |
| sleep 45 | |
| - name: Smoke test - Check health endpoint | |
| run: | | |
| echo "Checking health endpoint..." | |
| curl -f http://localhost:38427/health || { | |
| echo "Health check failed! Container logs:" | |
| docker logs hed-bot-test | |
| exit 1 | |
| } | |
| echo "Health check passed!" | |
| - name: Smoke test - Check container is healthy | |
| run: | | |
| STATUS=$(docker inspect --format='{{.State.Health.Status}}' hed-bot-test 2>/dev/null || echo "no-healthcheck") | |
| echo "Container health status: $STATUS" | |
| if [ "$STATUS" = "unhealthy" ]; then | |
| echo "Container is unhealthy! Logs:" | |
| docker logs hed-bot-test | |
| exit 1 | |
| fi | |
| - name: Cleanup test container | |
| if: always() | |
| run: | | |
| docker stop hed-bot-test || true | |
| docker rm hed-bot-test || true | |
| # Second job: Push to registry (on main, develop, and tags - not PRs) | |
| build-and-push: | |
| needs: build-and-test | |
| # Push on main, develop, or tags - skip for PRs (feature branches) | |
| if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| # Branch-based tags | |
| type=ref,event=branch | |
| # Tag-based tags (v1.0.0 -> 1.0.0) | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| # Latest tag for main branch | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| # Dev tag for develop branch | |
| type=raw,value=dev,enable=${{ github.ref == 'refs/heads/develop' }} | |
| # Commit SHA for traceability | |
| type=sha,prefix=sha- | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./deploy/Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| GIT_COMMIT=${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Image digest | |
| run: echo "${{ steps.meta.outputs.tags }}" |