@@ -14,100 +14,128 @@ permissions:
1414 packages : write
1515
1616jobs :
17- pull-agent-images :
18- name : " Pull AgentEx Images "
17+ run-integration-tests :
18+ name : " Run Integration Tests - s000-hello-acp "
1919 runs-on : ubuntu-latest
2020 steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+ with :
24+ ref : ${{ inputs.commit-sha || 'main' }}
25+
2126 - name : Login to GitHub Container Registry
2227 uses : docker/login-action@v3
2328 with :
2429 registry : ghcr.io
2530 username : ${{ github.repository_owner }}
2631 password : ${{ secrets.GITHUB_TOKEN }}
2732
28- - name : Debug API Permissions
29- env :
30- GH_TOKEN : ${{ secrets.GH_READ_PACKAGES_SECRET }}
33+ - name : Pull agent image
3134 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"
35+ echo "🐳 Pulling agent image..."
36+ docker pull ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest
37+ echo "✅ Agent image pulled successfully"
4138
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"
47-
48- echo "2. Container packages endpoint:"
49- gh api "orgs/scaleapi/packages?package_type=container" --jq 'length' || echo "❌ Container packages API failed"
50-
51- echo "3. Public packages endpoint:"
52- gh api "orgs/scaleapi/packages?package_type=container&visibility=public" --jq 'length' || echo "❌ Public packages API failed"
39+ - name : Start AgentEx services with host access
40+ working-directory : ./agentex
41+ run : |
42+ echo "🚀 Starting AgentEx services with host access override..."
43+ docker compose -f docker-compose.yml -f docker-compose.host-access.yml up -d
44+ echo "⏳ Waiting for services to be ready..."
45+ sleep 30
46+ docker compose ps
5347
54- - name : Discover and pull scale-agentex-python packages
55- env :
56- GH_TOKEN : ${{ github.token }}
48+ - name : Run agent integration test
5749 run : |
58- echo "🔍 Discovering packages from scale-agentex-python repo..."
50+ echo "🧪 Running integration test for agent: s000-hello-acp"
51+ echo "🐳 Using image: ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest"
52+
53+ # Start the agent container
54+ docker run -d --name agent-test-s000-hello-acp \
55+ -e AGENT_NAME=s000-hello-acp \
56+ -e ACP_URL=http://localhost \
57+ -e ACP_PORT=8000 \
58+ -e ACP_TYPE=sync \
59+ -e AGENTEX_BASE_URL=http://agentex:5003 \
60+ -e AGENTEX_API_BASE_URL=http://agentex:5003 \
61+ -p 8000:8000 \
62+ --network agentex-network \
63+ ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest
64+
65+ echo "⏳ Waiting for agent to start..."
66+ sleep 10
67+
68+ # Check for "Application startup complete" log message
69+ echo "🔍 Waiting for 'Application startup complete' log message..."
70+ TIMEOUT=60
71+ ELAPSED=0
72+
73+ while [ $ELAPSED -lt $TIMEOUT ]; do
74+ if docker logs agent-test-s000-hello-acp 2>&1 | grep -q "Application startup complete"; then
75+ echo "✅ Agent application has started successfully"
76+ break
77+ fi
78+
79+ echo "⏳ Still waiting for startup... (${ELAPSED}s/${TIMEOUT}s)"
80+ sleep 2
81+ ELAPSED=$((ELAPSED + 2))
82+ done
5983
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
84+ if [ $ELAPSED -ge $TIMEOUT ]; then
85+ echo "❌ Timeout waiting for 'Application startup complete' message"
86+ echo "📋 Container logs:"
87+ docker logs agent-test-s000-hello-acp
88+ exit 1
89+ fi
6290
63- # Extract packages from scale-agentex-python repo
64- PACKAGES=$(cat /tmp/packages.json | jq -r '.[] | select(.repository.name == "scale-agentex-python") | .name')
91+ - name : Run agent tests with retry
92+ run : |
93+ echo "🧪 Running pytest tests against the agent..."
94+ MAX_ATTEMPTS=5
95+ ATTEMPT=1
96+ SUCCESS=false
97+
98+ while [ $ATTEMPT -le $MAX_ATTEMPTS ] && [ "$SUCCESS" = false ]; do
99+ echo "📝 Test attempt $ATTEMPT/$MAX_ATTEMPTS"
100+
101+ if docker exec agent-test-s000-hello-acp pytest tests/test_agent.py -v; then
102+ echo "✅ Tests passed on attempt $ATTEMPT!"
103+ SUCCESS=true
104+ else
105+ echo "❌ Tests failed on attempt $ATTEMPT"
106+ if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
107+ echo "⏳ Waiting 5 seconds before retry..."
108+ sleep 5
109+ fi
110+ fi
111+
112+ ATTEMPT=$((ATTEMPT + 1))
113+ done
65114
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
115+ if [ "$SUCCESS" = false ]; then
116+ echo "❌ All $MAX_ATTEMPTS test attempts failed"
117+ exit 1
71118 fi
72119
73- echo "📦 Found packages:"
74- echo "$PACKAGES"
120+ echo "🎉 Agent tests completed successfully!"
75121
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
122+ - name : Show agent logs
123+ if : always()
124+ run : |
125+ echo "📋 Agent logs for s000-hello-acp:"
126+ docker logs agent-test-s000-hello-acp || echo "No logs available"
127+
128+ - name : Cleanup agent container
129+ if : always()
130+ run : |
131+ echo "🧹 Cleaning up agent container..."
132+ docker stop agent-test-s000-hello-acp || true
133+ docker rm agent-test-s000-hello-acp || true
81134
82- - name : Show pulled images
135+ - name : Cleanup services
136+ if : always()
137+ working-directory : ./agentex
83138 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"
139+ echo "🧹 Cleaning up services..."
140+ docker compose -f docker-compose.yml -f docker-compose.host-access.yml down
141+ docker system prune -f
0 commit comments