Test Tutorial Agents #62
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: Test Tutorial Agents | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| find-tutorials: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tutorials: ${{ steps.get-tutorials.outputs.tutorials }} | |
| steps: | |
| - name: Checkout agentex-python repo | |
| uses: actions/checkout@v4 | |
| - name: Find all tutorials | |
| id: get-tutorials | |
| run: | | |
| cd examples/tutorials | |
| # Find all tutorials and exclude specific temporal ones | |
| all_tutorials=$(find . -name "manifest.yaml" -exec dirname {} \; | sort | sed 's|^\./||') | |
| # Filter out the specified temporal tutorials that are being updated | |
| filtered_tutorials=$(echo "$all_tutorials" | grep -v -E "(temporal)") | |
| # Convert to JSON array | |
| tutorials=$(echo "$filtered_tutorials" | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "tutorials=$tutorials" >> $GITHUB_OUTPUT | |
| echo "All tutorials found: $(echo "$all_tutorials" | wc -l)" | |
| echo "Filtered tutorials: $(echo "$filtered_tutorials" | wc -l)" | |
| echo "Excluded tutorials:" | |
| echo "$all_tutorials" | grep -E "(10_temporal/050_|10_temporal/070_|10_temporal/080_)" || echo " (none matched exclusion pattern)" | |
| echo "Final tutorial list: $tutorials" | |
| test-tutorial: | |
| needs: find-tutorials | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: | |
| tutorial: ${{ fromJson(needs.find-tutorials.outputs.tutorials) }} | |
| fail-fast: false | |
| name: test-${{ matrix.tutorial }} | |
| steps: | |
| - name: Checkout agentex-python repo | |
| uses: actions/checkout@v4 | |
| - name: Install UV | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Pull Scale AgentEx Docker image | |
| run: | | |
| echo "π³ Pulling Scale AgentEx Docker image..." | |
| docker pull ghcr.io/scaleapi/scale-agentex/agentex:latest | |
| echo "β Successfully pulled AgentEx Docker image" | |
| - name: Start AgentEx Server from Docker image | |
| run: | | |
| echo "π Starting AgentEx server from Docker image..." | |
| # Start the AgentEx container with host networking for GitHub Actions | |
| docker run -d \ | |
| --name agentex-server \ | |
| --add-host=host.docker.internal:host-gateway \ | |
| -p 5003:5003 \ | |
| ghcr.io/scaleapi/scale-agentex/agentex:latest | |
| echo "β³ Waiting for AgentEx server to be ready..." | |
| for i in {1..30}; do | |
| if curl -s --max-time 5 http://localhost:5003/health >/dev/null 2>&1; then | |
| echo "β AgentEx server is ready" | |
| break | |
| fi | |
| echo " Attempt $i/30: Waiting for AgentEx server..." | |
| sleep 5 | |
| done | |
| # Verify the server is responding | |
| if ! curl -s --max-time 5 http://localhost:5003/health >/dev/null 2>&1; then | |
| echo "β AgentEx server failed to start or is not responding" | |
| docker logs agentex-server | |
| exit 1 | |
| fi | |
| - name: Build AgentEx SDK | |
| run: | | |
| echo "π¨ Building AgentEx SDK wheel..." | |
| uv build | |
| echo "β SDK built successfully" | |
| ls -la dist/ | |
| - name: Test Tutorial | |
| working-directory: ./examples/tutorials | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.TUTORIAL_OPENAI_API_KEY }} | |
| HEALTH_CHECK_PORT: 8080 # Use non-privileged port for temporal worker health checks | |
| run: | | |
| echo "Testing tutorial: ${{ matrix.tutorial }}" | |
| AGENTEX_API_BASE_URL="http://localhost:5003" \ | |
| ./run_agent_test.sh --build-cli "${{ matrix.tutorial }}" | |
| - name: Record test result | |
| id: test-result | |
| if: always() | |
| run: | | |
| if [ "${{ steps.run-test.outcome }}" == "success" ]; then | |
| echo "result=passed" >> $GITHUB_OUTPUT | |
| else | |
| echo "result=failed" >> $GITHUB_OUTPUT | |
| fi | |
| test-summary: | |
| if: always() | |
| needs: [find-tutorials, test-tutorial] | |
| runs-on: ubuntu-latest | |
| name: Test Summary | |
| steps: | |
| - name: Generate Test Summary | |
| run: | | |
| echo "# π§ͺ Tutorial Tests Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Get tutorial list from needs context | |
| tutorials='${{ needs.find-tutorials.outputs.tutorials }}' |