|
| 1 | +name: Run TCK |
| 2 | + |
| 3 | +on: |
| 4 | + # Handle all branches for now |
| 5 | + push: |
| 6 | +# branches: |
| 7 | +# - main |
| 8 | + pull_request: |
| 9 | +# branches: |
| 10 | +# - main |
| 11 | + |
| 12 | +env: |
| 13 | + # Tag of the TCK |
| 14 | + TCK_VERSION: 0.2.3 |
| 15 | + # Tells astral-sh/setup-uv@v5 to not need a venv, and instead use system |
| 16 | + UV_SYSTEM_PYTHON: 1 |
| 17 | + |
| 18 | +# Only run the latest job |
| 19 | +concurrency: |
| 20 | + group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - name: Checkout a2a-java |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + path: a2a-java |
| 31 | + - name: Checkout a2a-tck |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + repository: maeste/a2a-tck |
| 35 | + path: a2a-tck |
| 36 | + ref: ${{env.TCK_VERSION}} |
| 37 | + - name: Set up JDK 17 |
| 38 | + uses: actions/setup-java@v4 |
| 39 | + with: |
| 40 | + java-version: '17' |
| 41 | + distribution: 'temurin' |
| 42 | + cache: maven |
| 43 | + - name: Install uv |
| 44 | + uses: astral-sh/setup-uv@v5 |
| 45 | + with: |
| 46 | + # Install a specific version of uv. |
| 47 | + version: "0.7.19" |
| 48 | + enable-cache: true |
| 49 | + - name: Set up Python |
| 50 | + uses: actions/setup-python@v5 |
| 51 | + with: |
| 52 | + python-version-file: "a2a-tck/pyproject.toml" |
| 53 | + - name: Install Python requirements |
| 54 | + run: uv pip install -e . |
| 55 | + working-directory: a2a-tck |
| 56 | + - name: Build with Maven, skipping tests |
| 57 | + run: mvn -B install -DskipTests |
| 58 | + working-directory: a2a-java |
| 59 | + - name: Start Quarkus |
| 60 | + run: mvn quarkus:dev & |
| 61 | + working-directory: a2a-java/tck |
| 62 | + - name: Wait for server to start |
| 63 | + run: | |
| 64 | + URL="http://localhost:9999/.well-known/agent.json" |
| 65 | + EXPECTED_STATUS=200 |
| 66 | + TIMEOUT=120 |
| 67 | + RETRY_INTERVAL=2 |
| 68 | + START_TIME=$(date +%s) |
| 69 | +
|
| 70 | + while true; do |
| 71 | + # Calculate elapsed time |
| 72 | + CURRENT_TIME=$(date +%s) |
| 73 | + ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) |
| 74 | +
|
| 75 | + # Check for timeout |
| 76 | + if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then |
| 77 | + echo "Timeout: Server did not respond with status $EXPECTED_STATUS within $TIMEOUT seconds." |
| 78 | + exit 1 |
| 79 | + fi |
| 80 | +
|
| 81 | + # Get HTTP status code. || true is to reporting a failure to connect as an error |
| 82 | + HTTP_STATUS=$(curl --output /dev/null --silent --write-out "%{http_code}" "$URL") || true |
| 83 | + echo "STATUS: ${HTTP_STATUS}" |
| 84 | +
|
| 85 | + # Check if we got the correct status code |
| 86 | + if [ "$HTTP_STATUS" -eq "$EXPECTED_STATUS" ]; then |
| 87 | + echo "Server is up! Received status $HTTP_STATUS after $ELAPSED_TIME seconds." |
| 88 | + exit 0 |
| 89 | + fi |
| 90 | +
|
| 91 | + # Wait before retrying |
| 92 | + echo "Server not ready (status: $HTTP_STATUS). Retrying in $RETRY_INTERVAL seconds..." |
| 93 | + sleep "$RETRY_INTERVAL" |
| 94 | + done |
| 95 | + |
| 96 | + - name: Run TCK |
| 97 | + run: ./run_tck.py --category all --sut-url http://localhost:9999 |
| 98 | + working-directory: a2a-tck |
0 commit comments