|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | commit-sha: |
7 | | - description: "Commit SHA to test against (defaults to main)" |
| 7 | + description: "Commit SHA to test against (defaults to current branch)" |
8 | 8 | required: false |
9 | 9 | type: string |
10 | | - default: main |
11 | 10 |
|
12 | 11 | permissions: |
13 | 12 | contents: read |
14 | 13 | packages: write |
15 | 14 |
|
16 | 15 | jobs: |
17 | | - pull-agent-images: |
18 | | - name: "Pull AgentEx Images" |
| 16 | + run-integration-tests: |
| 17 | + name: "Run Integration Tests - s000-hello-acp" |
19 | 18 | runs-on: ubuntu-latest |
20 | 19 | steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + ref: ${{ inputs.commit-sha || github.ref }} |
| 24 | + |
21 | 25 | - name: Login to GitHub Container Registry |
22 | 26 | uses: docker/login-action@v3 |
23 | 27 | with: |
24 | 28 | registry: ghcr.io |
25 | 29 | username: ${{ github.repository_owner }} |
26 | 30 | password: ${{ secrets.GITHUB_TOKEN }} |
27 | 31 |
|
28 | | - - name: Debug API Permissions |
29 | | - env: |
30 | | - GH_TOKEN: ${{ secrets.GH_READ_PACKAGES_SECRET }} |
| 32 | + - name: Pull agent image |
31 | 33 | run: | |
32 | | - echo "🔍 Testing API permissions..." |
33 | | -
|
34 | | - # Test basic user access |
35 | | - echo "👤 Current user:" |
36 | | - gh api user --jq '.login' || echo "❌ User API failed" |
37 | | -
|
38 | | - # Test organization access |
39 | | - echo "🏢 Organization access:" |
40 | | - gh api orgs/scaleapi --jq '.login' || echo "❌ Org API failed" |
| 34 | + echo "🐳 Pulling agent image..." |
| 35 | + docker pull ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest |
| 36 | + echo "✅ Agent image pulled successfully" |
41 | 37 |
|
42 | | - # Test different package API endpoints |
43 | | - echo "📦 Testing package API endpoints:" |
44 | | -
|
45 | | - echo "1. Basic packages endpoint:" |
46 | | - gh api "orgs/scaleapi/packages" --jq 'length' || echo "❌ Basic packages API failed" |
| 38 | + - name: Start AgentEx services with host access |
| 39 | + working-directory: ./agentex |
| 40 | + run: | |
| 41 | + echo "🚀 Starting AgentEx services with host access override..." |
| 42 | + docker compose -f docker-compose.yml -f docker-compose.host-access.yml up -d |
| 43 | + echo "⏳ Waiting for services to be ready..." |
| 44 | + sleep 30 |
| 45 | + docker compose ps |
47 | 46 |
|
48 | | - echo "2. Container packages endpoint:" |
49 | | - gh api "orgs/scaleapi/packages?package_type=container" --jq 'length' || echo "❌ Container packages API failed" |
| 47 | + - name: Run agent integration test |
| 48 | + run: | |
| 49 | + echo "🧪 Running integration test for agent: s000-hello-acp" |
| 50 | + echo "🐳 Using image: ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest" |
| 51 | +
|
| 52 | + # Start the agent container |
| 53 | + docker run -d --name agent-test-s000-hello-acp \ |
| 54 | + -e AGENT_NAME=s000-hello-acp \ |
| 55 | + -e ACP_URL=http://localhost \ |
| 56 | + -e ACP_PORT=8000 \ |
| 57 | + -e ACP_TYPE=sync \ |
| 58 | + -e AGENTEX_BASE_URL=http://agentex:5003 \ |
| 59 | + -e AGENTEX_API_BASE_URL=http://agentex:5003 \ |
| 60 | + -p 8000:8000 \ |
| 61 | + --network agentex-network \ |
| 62 | + ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest |
| 63 | +
|
| 64 | + echo "⏳ Waiting for agent to start..." |
| 65 | + sleep 10 |
| 66 | +
|
| 67 | + # Check for "Application startup complete" log message |
| 68 | + echo "🔍 Waiting for 'Application startup complete' log message..." |
| 69 | + TIMEOUT=60 |
| 70 | + ELAPSED=0 |
| 71 | +
|
| 72 | + while [ $ELAPSED -lt $TIMEOUT ]; do |
| 73 | + if docker logs agent-test-s000-hello-acp 2>&1 | grep -q "Application startup complete"; then |
| 74 | + echo "✅ Agent application has started successfully" |
| 75 | + break |
| 76 | + fi |
| 77 | +
|
| 78 | + echo "⏳ Still waiting for startup... (${ELAPSED}s/${TIMEOUT}s)" |
| 79 | + sleep 2 |
| 80 | + ELAPSED=$((ELAPSED + 2)) |
| 81 | + done |
50 | 82 |
|
51 | | - echo "3. Public packages endpoint:" |
52 | | - gh api "orgs/scaleapi/packages?package_type=container&visibility=public" --jq 'length' || echo "❌ Public packages API failed" |
| 83 | + if [ $ELAPSED -ge $TIMEOUT ]; then |
| 84 | + echo "❌ Timeout waiting for 'Application startup complete' message" |
| 85 | + echo "📋 Container logs:" |
| 86 | + docker logs agent-test-s000-hello-acp |
| 87 | + exit 1 |
| 88 | + fi |
53 | 89 |
|
54 | | - - name: Discover and pull scale-agentex-python packages |
55 | | - env: |
56 | | - GH_TOKEN: ${{ github.token }} |
| 90 | + - name: Run agent tests with retry |
57 | 91 | run: | |
58 | | - echo "🔍 Discovering packages from scale-agentex-python repo..." |
| 92 | + echo "🧪 Running pytest tests against the agent..." |
| 93 | + MAX_ATTEMPTS=2 |
| 94 | + ATTEMPT=1 |
| 95 | + SUCCESS=false |
| 96 | +
|
| 97 | + while [ $ATTEMPT -le $MAX_ATTEMPTS ] && [ "$SUCCESS" = false ]; do |
| 98 | + echo "📝 Test attempt $ATTEMPT/$MAX_ATTEMPTS" |
| 99 | +
|
| 100 | + if docker exec agent-test-s000-hello-acp pytest tests/test_agent.py -v; then |
| 101 | + echo "✅ Tests passed on attempt $ATTEMPT!" |
| 102 | + SUCCESS=true |
| 103 | + else |
| 104 | + echo "❌ Tests failed on attempt $ATTEMPT" |
| 105 | + if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then |
| 106 | + echo "⏳ Waiting 5 seconds before retry..." |
| 107 | + sleep 5 |
| 108 | + fi |
| 109 | + fi |
| 110 | +
|
| 111 | + ATTEMPT=$((ATTEMPT + 1)) |
| 112 | + done |
59 | 113 |
|
60 | | - # First get all packages and save to temp file to avoid shell issues |
61 | | - gh api "orgs/scaleapi/packages?package_type=container" > /tmp/packages.json |
| 114 | + if [ "$SUCCESS" = false ]; then |
| 115 | + echo "❌ All $MAX_ATTEMPTS test attempts failed" |
| 116 | + exit 1 |
| 117 | + fi |
62 | 118 |
|
63 | | - # Extract packages from scale-agentex-python repo |
64 | | - PACKAGES=$(cat /tmp/packages.json | jq -r '.[] | select(.repository.name == "scale-agentex-python") | .name') |
| 119 | + echo "🎉 Agent tests completed successfully!" |
65 | 120 |
|
66 | | - if [ -z "$PACKAGES" ]; then |
67 | | - echo "❌ No packages found in scale-agentex-python repo" |
68 | | - echo "🔍 Available packages and their repos:" |
69 | | - cat /tmp/packages.json | jq -r '.[] | "\(.name) -> \(.repository.name // "null")"' |
70 | | - exit 0 |
71 | | - fi |
| 121 | + - name: Show agent logs |
| 122 | + if: always() |
| 123 | + run: | |
| 124 | + echo "📋 Agent logs for s000-hello-acp:" |
| 125 | + docker logs agent-test-s000-hello-acp || echo "No logs available" |
72 | 126 |
|
73 | | - echo "📦 Found packages:" |
74 | | - echo "$PACKAGES" |
| 127 | + - name: Show AgentEx server logs |
| 128 | + if: always() |
| 129 | + run: | |
| 130 | + echo "📋 AgentEx server logs:" |
| 131 | + docker logs agentex || echo "No AgentEx server logs available" |
75 | 132 |
|
76 | | - # Pull each package |
77 | | - for package in $PACKAGES; do |
78 | | - echo "🐳 Pulling ghcr.io/scaleapi/$package:latest" |
79 | | - docker pull "ghcr.io/scaleapi/$package:latest" || echo "⚠️ Failed to pull $package:latest" |
80 | | - done |
| 133 | + - name: Cleanup agent container |
| 134 | + if: always() |
| 135 | + run: | |
| 136 | + echo "🧹 Cleaning up agent container..." |
| 137 | + docker stop agent-test-s000-hello-acp || true |
| 138 | + docker rm agent-test-s000-hello-acp || true |
81 | 139 |
|
82 | | - - name: Show pulled images |
| 140 | + - name: Cleanup services |
| 141 | + if: always() |
| 142 | + working-directory: ./agentex |
83 | 143 | run: | |
84 | | - echo "🐳 Successfully pulled images:" |
85 | | - docker images | grep "ghcr.io/scaleapi" || echo "No scaleapi images found" |
86 | | -
|
87 | | - # run-integration-tests: |
88 | | - # name: "Run Integration Tests" |
89 | | - # needs: pull-agent-images |
90 | | - # runs-on: ubuntu-latest |
91 | | - # steps: |
92 | | - # - name: Checkout |
93 | | - # uses: actions/checkout@v4 |
94 | | - # with: |
95 | | - # ref: ${{ inputs.commit-sha || 'main' }} |
96 | | - # |
97 | | - # - name: Login to GitHub Container Registry |
98 | | - # uses: docker/login-action@v3 |
99 | | - # with: |
100 | | - # registry: ghcr.io |
101 | | - # username: ${{ github.repository_owner }} |
102 | | - # password: ${{ secrets.GITHUB_TOKEN }} |
103 | | - # |
104 | | - # - name: Verify available images |
105 | | - # run: | |
106 | | - # echo "🐳 Available Docker images for testing:" |
107 | | - # docker images | grep "ghcr.io/scaleapi" || echo "No scaleapi images available" |
108 | | - # |
109 | | - # - name: Placeholder - Integration Tests |
110 | | - # run: | |
111 | | - # echo "🧪 Integration tests will run here" |
112 | | - # echo "📦 AgentEx Python dependency images are available for testing" |
113 | | - # echo "🔄 This is where actual integration test commands should be added" |
| 144 | + echo "🧹 Cleaning up services..." |
| 145 | + docker compose -f docker-compose.yml -f docker-compose.host-access.yml down |
| 146 | + docker system prune -f |
0 commit comments