Skip to content

fix(errors): enhance INVALID_MODEL_ID to mention subscription level #187

fix(errors): enhance INVALID_MODEL_ID to mention subscription level

fix(errors): enhance INVALID_MODEL_ID to mention subscription level #187

Workflow file for this run

name: Docker Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests with pytest
run: |
pytest -v --tb=short
- name: Generate coverage report
if: success()
run: |
pip install pytest-cov
pytest --cov=kiro --cov-report=xml --cov-report=term
- name: Upload coverage to artifacts
if: success()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
build:
name: Build and Test Docker Image
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
packages: write
security-events: write # For uploading Trivy scan results
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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 for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Clean up test artifacts
run: |
rm -f credentials.json state.json
echo "Cleaned up test artifacts (credentials.json, state.json)"
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: kiro-gateway:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: kiro-gateway:test
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
exit-code: '0' # Don't fail build, just report
- name: Upload Trivy results to GitHub Security
uses: github/codeql-action/upload-sarif@v3
if: always() # Upload even if previous step fails
with:
sarif_file: 'trivy-results.sarif'
category: 'docker-image'
- name: Test Docker image
run: |
echo "=== Testing Docker image structure ==="
# Test 1: File structure and permissions (verifies our chown fix)
docker run --rm kiro-gateway:test sh -c "
test -f /app/main.py && \
test -d /app/kiro && \
test -w /app && \
touch /app/test.tmp && rm /app/test.tmp && \
echo '✓ File structure and write permissions OK'
"
# Test 2: Python imports (verifies all dependencies installed)
docker run --rm kiro-gateway:test python -c "
import kiro
import kiro.auth
import kiro.account_manager
import kiro.config
import kiro.routes_openai
import kiro.routes_anthropic
import fastapi
import httpx
import loguru
import uvicorn
print('✓ All critical imports OK')
"
# Test 3: CLI works (verifies entry point)
docker run --rm kiro-gateway:test python main.py --version
echo ""
echo "========================================="
echo "✓ Docker image tests passed"
echo "========================================="
- name: Build and push Docker image
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64 # Multi-arch support (x86_64 and ARM64)
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
if: github.event_name != 'pull_request'
run: echo ${{ steps.meta.outputs.digest }}