|
| 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 uv 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 | + tck-test: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - name: Checkout a2a-java |
| 28 | + uses: actions/checkout@v4 |
| 29 | + - name: Checkout a2a-tck |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + repository: maeste/a2a-tck |
| 33 | + path: tck/a2a-tck |
| 34 | + ref: ${{ env.TCK_VERSION }} |
| 35 | + - name: Set up JDK 17 |
| 36 | + uses: actions/setup-java@v4 |
| 37 | + with: |
| 38 | + java-version: '17' |
| 39 | + distribution: 'temurin' |
| 40 | + cache: maven |
| 41 | + - name: check java_home |
| 42 | + run: echo $JAVA_HOME |
| 43 | + - name: Set up Python |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version-file: "tck/a2a-tck/pyproject.toml" |
| 47 | + - name: Install uv and Python dependencies |
| 48 | + run: | |
| 49 | + pip install uv |
| 50 | + uv pip install -e . |
| 51 | + working-directory: tck/a2a-tck |
| 52 | + - name: Build with Maven, skipping tests |
| 53 | + run: mvn -B install -DskipTests |
| 54 | + - name: Start SUT |
| 55 | + run: mvn -B quarkus:dev & |
| 56 | + working-directory: tck |
| 57 | + - name: Wait for SUT to start |
| 58 | + run: | |
| 59 | + URL="http://localhost:9999/.well-known/agent.json" |
| 60 | + EXPECTED_STATUS=200 |
| 61 | + TIMEOUT=120 |
| 62 | + RETRY_INTERVAL=2 |
| 63 | + START_TIME=$(date +%s) |
| 64 | +
|
| 65 | + while true; do |
| 66 | + # Calculate elapsed time |
| 67 | + CURRENT_TIME=$(date +%s) |
| 68 | + ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) |
| 69 | +
|
| 70 | + # Check for timeout |
| 71 | + if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then |
| 72 | + echo "❌ Timeout: Server did not respond with status $EXPECTED_STATUS within $TIMEOUT seconds." |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | +
|
| 76 | + # Get HTTP status code. || true is to reporting a failure to connect as an error |
| 77 | + HTTP_STATUS=$(curl --output /dev/null --silent --write-out "%{http_code}" "$URL") || true |
| 78 | + echo "STATUS: ${HTTP_STATUS}" |
| 79 | +
|
| 80 | + # Check if we got the correct status code |
| 81 | + if [ "$HTTP_STATUS" -eq "$EXPECTED_STATUS" ]; then |
| 82 | + echo "✅ Server is up! Received status $HTTP_STATUS after $ELAPSED_TIME seconds." |
| 83 | + break; |
| 84 | + fi |
| 85 | +
|
| 86 | + # Wait before retrying |
| 87 | + echo "⏳ Server not ready (status: $HTTP_STATUS). Retrying in $RETRY_INTERVAL seconds..." |
| 88 | + sleep "$RETRY_INTERVAL" |
| 89 | + done |
| 90 | + |
| 91 | + - name: Run TCK |
| 92 | + run: | |
| 93 | + ./run_tck.py --sut-url http://localhost:9999 --category all --compliance-report report.json |
| 94 | + working-directory: tck/a2a-tck |
0 commit comments