- Notifications
You must be signed in to change notification settings - Fork 0
Adding the Integrations Tests #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c8c5d4d 75ac121 8f51022 54996c2 bd1a129 2446a36 e10ad36 7e69b1a fcb8313 4104748 be036c0 30875ea ea16c53 b4d87d7 6c7de97 b61699b cac62f8 90d93e7 579dd97 1ffabf7 ba43d93 5a13b31 550d043 258045d cebe84d 95401c0 bfab5aa File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| 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: Checkout scale-agentex repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: scaleapi/scale-agentex | ||
| path: scale-agentex | ||
| | ||
| - name: Configure Docker Compose for host networking | ||
| run: | | ||
| cd scale-agentex/agentex | ||
| echo "🔧 Configuring AgentEx container for GitHub Actions networking..." | ||
| | ||
| # Install yq for YAML manipulation | ||
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | ||
| sudo chmod +x /usr/local/bin/yq | ||
| | ||
| # Add extra_hosts to agentex service to make host.docker.internal work | ||
| yq eval '.services.agentex.extra_hosts = ["host.docker.internal:host-gateway"]' -i docker-compose.yml | ||
| | ||
| echo "✅ Added extra_hosts configuration to agentex service" | ||
| | ||
| - name: Start AgentEx Server | ||
| run: | | ||
| cd scale-agentex/agentex | ||
| echo "🚀 Starting AgentEx server and dependencies..." | ||
| | ||
| # Start all services | ||
| docker compose up -d | ||
| | ||
| echo "⏳ Waiting for dependencies to be healthy..." | ||
| | ||
| # Wait for services to be healthy | ||
| for i in {1..30}; do | ||
| if docker compose ps | grep -q "healthy"; then | ||
| echo "✅ Dependencies are healthy" | ||
| break | ||
| fi | ||
| echo " Attempt $i/30: Waiting for services..." | ||
| sleep 5 | ||
| done | ||
| | ||
| # Wait specifically for AgentEx server to be ready | ||
| 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 | ||
| | ||
| - 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 }}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -24,3 +24,91 @@ on: | |
| required: true | ||
| type: string | ||
| default: "latest" | ||
| | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| | ||
| jobs: | ||
| build-and-push-agent: | ||
| timeout-minutes: 10 | ||
| name: Build Tutorial Agent | ||
| runs-on: ubuntu-latest | ||
| | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| | ||
| - name: Validate agent path exists | ||
| run: | | ||
| if [ ! -d "${{ inputs.agent_path }}" ]; then | ||
| echo "❌ Error: Agent path '${{ inputs.agent_path }}' does not exist" | ||
| exit 1 | ||
| fi | ||
| echo "✅ Agent path verified: ${{ inputs.agent_path }}" | ||
| | ||
| - name: Validate manifest.yaml exists | ||
| run: | | ||
| if [ ! -f "${{ inputs.agent_path }}/manifest.yaml" ]; then | ||
| echo "❌ Error: manifest.yaml not found in '${{ inputs.agent_path }}'" | ||
| exit 1 | ||
| fi | ||
| echo "✅ manifest.yaml found" | ||
| echo "### Validation Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Agent Path**: ${{ inputs.agent_path }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Version Tag**: ${{ inputs.version_tag }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Status**: ✅ Validation passed" >> $GITHUB_STEP_SUMMARY | ||
| | ||
| Comment on lines +51 to +61 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semgrep identified an issue in your code: To resolve this comment: 🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods. 💬 Ignore this findingReply with Semgrep commands to ignore this finding.
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by run-shell-injection. You can view more details about this finding in the Semgrep AppSec Platform. | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.12" | ||
| | ||
| - name: Get latest agentex-sdk version from PyPI | ||
| id: get-version | ||
| run: | | ||
| LATEST_VERSION=$(curl -s https://pypi.org/pypi/agentex-sdk/json | jq -r '.info.version') | ||
| echo "Latest agentex-sdk version: $LATEST_VERSION" | ||
| echo "AGENTEX_SDK_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | ||
| pip install agentex-sdk==$LATEST_VERSION | ||
| echo "Installed agentex-sdk version $LATEST_VERSION" | ||
| | ||
| - name: Generate Image name | ||
| id: image-name | ||
| run: | | ||
| # Remove examples/tutorials/ prefix and replace / with - | ||
| AGENT_NAME=$(echo "${{ inputs.agent_path }}" | sed 's|^examples/tutorials/||' | sed 's|/|-|g') | ||
| echo "AGENT_NAME=$AGENT_NAME" >> $GITHUB_ENV | ||
| echo "agent_name=$AGENT_NAME" >> $GITHUB_OUTPUT | ||
| echo "Agent name set to $AGENT_NAME" | ||
| | ||
| Comment on lines +81 to +87 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semgrep identified an issue in your code: To resolve this comment: 🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods. 💬 Ignore this findingReply with Semgrep commands to ignore this finding.
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by run-shell-injection. You can view more details about this finding in the Semgrep AppSec Platform. | ||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| | ||
| - name: Build and Push Agent Image | ||
| env: | ||
| REGISTRY: ghcr.io | ||
| run: | | ||
| AGENT_NAME="${{ steps.image-name.outputs.agent_name }}" | ||
| VERSION_TAG="${{ inputs.version_tag }}" | ||
| REPOSITORY_NAME="${{ github.repository }}/tutorial-agents/${AGENT_NAME}" | ||
| FULL_IMAGE="${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" | ||
| | ||
| agentex agents build \ | ||
| --manifest "${{ inputs.agent_path }}/manifest.yaml" \ | ||
| --registry "${REGISTRY}" \ | ||
| --tag "${VERSION_TAG}" \ | ||
| --platforms "linux/amd64" \ | ||
| --repository-name "${REPOSITORY_NAME}" \ | ||
| --push | ||
| | ||
| echo "Successfully built and pushed: ${FULL_IMAGE}" | ||
| echo "### Build Complete" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Image**: \`${FULL_IMAGE}\`" >> $GITHUB_STEP_SUMMARY | ||
| Comment on lines +98 to +114 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semgrep identified an issue in your code: To resolve this comment: 🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods. 💬 Ignore this findingReply with Semgrep commands to ignore this finding.
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by run-shell-injection. You can view more details about this finding in the Semgrep AppSec Platform. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep identified an issue in your code:
Using variable interpolation
${{...}}withgithubcontext data in arun:step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code.githubcontext data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable withenv:to store the data and use the environment variable in therun:script. Be sure to use double-quotes the environment variable, like this: "$ENVVAR".To resolve this comment:
🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasonsAlternatively, triage in Semgrep AppSec Platform to ignore the finding created by run-shell-injection.
You can view more details about this finding in the Semgrep AppSec Platform.