-
Notifications
You must be signed in to change notification settings - Fork 156
feat: Enable ITK tests #403
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
Merged
bartek-gralewicz
merged 22 commits into
epic/1.0_breaking_changes
from
bgralewicz/enable_itk_tests
Apr 16, 2026
Merged
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7a4c332
Add run_itk.sh bash script.
bartek-gralewicz 063d11c
Add ITK workflow.
bartek-gralewicz 5c5fe4e
Apply PR suggestions.
bartek-gralewicz 5ad4f8a
Enable ITK test suite.
bartek-gralewicz d530a9a
Add node setup to the ITK CI workflow.
bartek-gralewicz cd55661
Update tag and remove redundant state_map definitions.
bartek-gralewicz 4ba1f84
Add middle layer comment and update npm env setup in the CI workflow,
bartek-gralewicz 882ada7
Move the middle layer comment under the imports.
bartek-gralewicz 748cca7
Mode adaptation mechanisms to the middle layer instead of transport i…
bartek-gralewicz b96dacb
Fix lint formatting.
bartek-gralewicz e5fa80f
Merge remote-tracking branch 'origin/epic/1.0_breaking_changes' into …
bartek-gralewicz 3a877ca
Update ITK to transport agnostic orchestrator.
bartek-gralewicz 34dc9b9
Remove no longer needed method mapping.
bartek-gralewicz 8f60af4
Switch a2a-samples revision to a tag.
bartek-gralewicz ac39c21
Fix typo in tag name.
bartek-gralewicz 2ee7aa3
Tag is in a broken state. Switching to a branch instead.
bartek-gralewicz 611a9d9
Switch to itk v014 tag once it got fixed.
bartek-gralewicz 36f6d26
Merge remote-tracking branch 'origin/epic/1.0_breaking_changes' into …
bartek-gralewicz a5679ec
Merge remote-tracking branch 'origin/epic/1.0_breaking_changes' into …
bartek-gralewicz 973c023
Used toJSON for JSON-RPC server side. Simplified clients usage and pr…
bartek-gralewicz 634b60e
Update StreamResponse so that is returns properly serializable object…
bartek-gralewicz b546372
Add a TODO comment over the payload conversion in jsonrpc transport h…
bartek-gralewicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Run ITK | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main", "epic" ] | ||
| pull_request: | ||
| paths: | ||
| - 'src/**' | ||
| - 'itk/**' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # Only run the latest job | ||
| concurrency: | ||
| group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| itk-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 | ||
|
|
||
| - name: Run ITK Tests | ||
| run: bash run_itk.sh | ||
| working-directory: itk | ||
| env: | ||
| A2A_SAMPLES_REVISION: itk-v.0.11-alpha |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| #!/bin/bash | ||
| set -ex | ||
|
|
||
| # Initialize default exit code | ||
| RESULT=1 | ||
|
|
||
| # Cleanup function to be called on exit | ||
| cleanup() { | ||
| set +x | ||
| echo "Cleaning up artifacts..." | ||
| docker stop itk-service > /dev/null 2>&1 || true | ||
| docker rm itk-service > /dev/null 2>&1 || true | ||
| docker rmi itk_service > /dev/null 2>&1 || true | ||
| rm -rf a2a-samples > /dev/null 2>&1 || true | ||
| rm -rf pyproto > /dev/null 2>&1 || true | ||
| rm -f instruction.proto > /dev/null 2>&1 || true | ||
| echo "Done. Final exit code: $RESULT" | ||
| } | ||
|
|
||
| # Register cleanup function to run on script exit | ||
| trap cleanup EXIT | ||
|
|
||
| # 1. Pull a2a-samples and checkout revision | ||
| : "${A2A_SAMPLES_REVISION:?A2A_SAMPLES_REVISION environment variable must be set}" | ||
|
|
||
| if [ ! -d "a2a-samples" ]; then | ||
| git clone https://github.com/a2aproject/a2a-samples.git a2a-samples | ||
| fi | ||
| cd a2a-samples | ||
| git fetch origin | ||
| git checkout "$A2A_SAMPLES_REVISION" | ||
|
|
||
| # Only pull if it's a branch (not a detached HEAD) | ||
| if git symbolic-ref -q HEAD > /dev/null; then | ||
| git pull origin "$A2A_SAMPLES_REVISION" | ||
| fi | ||
| cd .. | ||
|
|
||
| # 2. Copy instruction.proto from a2a-samples | ||
| cp a2a-samples/itk/protos/instruction.proto ./instruction.proto | ||
|
|
||
| # 3. Build pyproto library | ||
| mkdir -p pyproto | ||
| touch pyproto/__init__.py | ||
| uv run --with grpcio-tools python -m grpc_tools.protoc \ | ||
| -I. \ | ||
| --python_out=pyproto \ | ||
| --grpc_python_out=pyproto \ | ||
| instruction.proto | ||
|
|
||
| # Fix imports in generated file | ||
| sed -i 's/^import instruction_pb2 as instruction__pb2/from . import instruction_pb2 as instruction__pb2/' pyproto/instruction_pb2_grpc.py | ||
|
|
||
| # 4. Build jit itk_service docker image from root of a2a-samples/itk | ||
| # We run docker build from the itk directory inside a2a-samples | ||
| docker build -t itk_service a2a-samples/itk | ||
|
|
||
| # 5. Start docker service | ||
| # Mounting a2a-python as repo and itk as current agent | ||
| A2A_PYTHON_ROOT=$(cd .. && pwd) | ||
| ITK_DIR=$(pwd) | ||
|
|
||
| # Stop existing container if any | ||
| docker rm -f itk-service || true | ||
|
|
||
| docker run -d --name itk-service \ | ||
| -v "$A2A_PYTHON_ROOT:/app/agents/repo" \ | ||
| -v "$ITK_DIR:/app/agents/repo/itk" \ | ||
| -p 8000:8000 \ | ||
| itk_service | ||
|
|
||
| # 5.1. Fix dubious ownership for git (needed for uv-dynamic-versioning) | ||
| docker exec itk-service git config --global --add safe.directory /app/agents/repo | ||
| docker exec itk-service git config --global --add safe.directory /app/agents/repo/itk | ||
|
|
||
| # 6. Verify service is up and send post request | ||
| MAX_RETRIES=30 | ||
| echo "Waiting for ITK service to start on 127.0.0.1:8000..." | ||
| set +e | ||
| for i in $(seq 1 $MAX_RETRIES); do | ||
| if curl -s http://127.0.0.1:8000/ > /dev/null; then | ||
| echo "Service is up!" | ||
| break | ||
| fi | ||
| echo "Still waiting... ($i/$MAX_RETRIES)" | ||
| sleep 2 | ||
| done | ||
|
|
||
| # If we reached the end of the loop without success | ||
| if ! curl -s http://127.0.0.1:8000/ > /dev/null; then | ||
| echo "Error: ITK service failed to start on port 8000" | ||
| docker logs itk-service | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "ITK Service is up! Sending compatibility test request..." | ||
| RESPONSE=$(curl -s -X POST http://127.0.0.1:8000/run \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "tests": [ | ||
| { | ||
| "name": "Star Topology (Full) - JSONRPC & GRPC", | ||
| "sdks": ["current", "python_v10", "python_v03", "go_v10", "go_v03"], | ||
| "traversal": "euler", | ||
| "edges": ["0->1", "0->2", "0->3", "0->4", "1->0", "2->0", "3->0", "4->0"], | ||
| "protocols": ["jsonrpc", "grpc"] | ||
| }, | ||
| { | ||
| "name": "Star Topology (No Go v03) - HTTP_JSON", | ||
| "sdks": ["current", "python_v10", "python_v03", "go_v10"], | ||
| "traversal": "euler", | ||
| "edges": ["0->1", "0->2", "0->3", "1->0", "2->0", "3->0"], | ||
| "protocols": ["http_json"] | ||
| }, | ||
| { | ||
| "name": "Star Topology (Full) - JSONRPC & GRPC (Streaming)", | ||
| "sdks": ["current", "python_v10", "python_v03", "go_v10", "go_v03"], | ||
| "traversal": "euler", | ||
| "edges": ["0->1", "0->2", "0->3", "0->4", "1->0", "2->0", "3->0", "4->0"], | ||
| "protocols": ["jsonrpc", "grpc"], | ||
| "streaming": true | ||
| }, | ||
| { | ||
| "name": "Star Topology (No Go v03) - HTTP_JSON (Streaming)", | ||
| "sdks": ["current", "python_v10", "python_v03", "go_v10"], | ||
| "traversal": "euler", | ||
| "edges": ["0->1", "0->2", "0->3", "1->0", "2->0", "3->0"], | ||
| "protocols": ["http_json"], | ||
| "streaming": true | ||
| } | ||
| ] | ||
| }') | ||
|
|
||
| echo "--------------------------------------------------------" | ||
| echo "ITK TEST RESULTS:" | ||
| echo "--------------------------------------------------------" | ||
| echo "$RESPONSE" | python3 -c " | ||
| import sys, json | ||
| try: | ||
| data = json.load(sys.stdin) | ||
| all_passed = data.get('all_passed', False) | ||
| results = data.get('results', {}) | ||
| for test, passed in results.items(): | ||
| status = 'PASSED' if passed else 'FAILED' | ||
| print(f'{test}: {status}') | ||
| print('--------------------------------------------------------') | ||
| print(f'OVERALL STATUS: {\"PASSED\" if all_passed else \"FAILED\"}') | ||
| if not all_passed: | ||
| sys.exit(1) | ||
| except Exception as e: | ||
| print(f'Error parsing results: {e}') | ||
| print(f'Raw response: {data if \"data\" in locals() else \"no data\"}') | ||
| sys.exit(1) | ||
| " | ||
|
bartek-gralewicz marked this conversation as resolved.
Outdated
|
||
| RESULT=$? | ||
| set -e | ||
|
|
||
| if [ $RESULT -ne 0 ]; then | ||
| echo "Tests failed. Container logs:" | ||
| docker logs itk-service | ||
| fi | ||
| echo "--------------------------------------------------------" | ||
|
|
||
| # Final exit result will be captured by trap cleanup | ||
| exit $RESULT | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.